mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Add validator for byte
This commit is contained in:
parent
a4f7d7a7cd
commit
c258b4fdb0
8 changed files with 420 additions and 94 deletions
|
@ -72,6 +72,16 @@ pub enum SyntaxErrorKind {
|
|||
EmptyChar,
|
||||
UnclosedChar,
|
||||
OverlongChar,
|
||||
EmptyByte,
|
||||
UnclosedByte,
|
||||
OverlongByte,
|
||||
ByteOutOfRange,
|
||||
UnescapedByte,
|
||||
EmptyByteEscape,
|
||||
InvalidByteEscape,
|
||||
TooShortByteCodeEscape,
|
||||
MalformedByteCodeEscape,
|
||||
UnicodeEscapeForbidden,
|
||||
EmptyAsciiEscape,
|
||||
InvalidAsciiEscape,
|
||||
TooShortAsciiCodeEscape,
|
||||
|
@ -98,6 +108,16 @@ impl fmt::Display for SyntaxErrorKind {
|
|||
EmptyChar => write!(f, "Empty char literal"),
|
||||
UnclosedChar => write!(f, "Unclosed char literal"),
|
||||
OverlongChar => write!(f, "Char literal should be one character long"),
|
||||
EmptyByte => write!(f, "Empty byte literal"),
|
||||
UnclosedByte => write!(f, "Unclosed byte literal"),
|
||||
OverlongByte => write!(f, "Byte literal should be one character long"),
|
||||
ByteOutOfRange => write!(f, "Byte should be a valid ASCII character"),
|
||||
UnescapedByte => write!(f, "This byte should always be escaped"),
|
||||
EmptyByteEscape => write!(f, "Empty escape sequence"),
|
||||
InvalidByteEscape => write!(f, "Invalid escape sequence"),
|
||||
TooShortByteCodeEscape => write!(f, "Escape sequence should have two digits"),
|
||||
MalformedByteCodeEscape => write!(f, "Escape sequence should be a hexadecimal number"),
|
||||
UnicodeEscapeForbidden => write!(f, "Unicode escapes are not allowed in byte literals or byte strings"),
|
||||
TooShortAsciiCodeEscape => write!(f, "Escape sequence should have two digits"),
|
||||
AsciiCodeEscapeOutOfRange => {
|
||||
write!(f, "Escape sequence should be between \\x00 and \\x7F")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue