Add validator for byte
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user