From 3b4c02c19e4af645fd37e8bff774b05d546dc0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Thu, 8 Nov 2018 15:42:00 +0100 Subject: Validate string literals --- crates/ra_syntax/src/yellow/syntax_error.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax/src/yellow') diff --git a/crates/ra_syntax/src/yellow/syntax_error.rs b/crates/ra_syntax/src/yellow/syntax_error.rs index c524adf39..cf7b1d495 100644 --- a/crates/ra_syntax/src/yellow/syntax_error.rs +++ b/crates/ra_syntax/src/yellow/syntax_error.rs @@ -71,7 +71,7 @@ pub enum SyntaxErrorKind { UnescapedCodepoint, EmptyChar, UnclosedChar, - LongChar, + OverlongChar, EmptyAsciiEscape, InvalidAsciiEscape, TooShortAsciiCodeEscape, @@ -82,6 +82,7 @@ pub enum SyntaxErrorKind { EmptyUnicodeEcape, OverlongUnicodeEscape, UnicodeEscapeOutOfRange, + UnclosedString, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -96,7 +97,7 @@ impl fmt::Display for SyntaxErrorKind { InvalidAsciiEscape => write!(f, "Invalid escape sequence"), EmptyChar => write!(f, "Empty char literal"), UnclosedChar => write!(f, "Unclosed char literal"), - LongChar => write!(f, "Char literal should be one character long"), + OverlongChar => write!(f, "Char literal should be one character long"), TooShortAsciiCodeEscape => write!(f, "Escape sequence should have two digits"), AsciiCodeEscapeOutOfRange => { write!(f, "Escape sequence should be between \\x00 and \\x7F") @@ -109,6 +110,7 @@ impl fmt::Display for SyntaxErrorKind { write!(f, "Unicode escape sequence should have at most 6 digits") } UnicodeEscapeOutOfRange => write!(f, "Unicode escape code should be at most 0x10FFFF"), + UnclosedString => write!(f, "Unclosed string literal"), ParseError(msg) => write!(f, "{}", msg.0), } } -- cgit v1.2.3