diff options
author | Veetaha <[email protected]> | 2020-01-29 22:18:21 +0000 |
---|---|---|
committer | Veetaha <[email protected]> | 2020-02-03 22:00:55 +0000 |
commit | 9367b9a2920073a3f79fdff80dcc97d727f6ce17 (patch) | |
tree | 1aebf345e4c85860beb1784b6939c523b5aa32ee /crates/ra_syntax/src | |
parent | c3117eea31392f8f63f1352a127f6b77139c375b (diff) |
ra_syntax: add backticks around tokens specimen
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/syntax_error.rs | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/crates/ra_syntax/src/syntax_error.rs b/crates/ra_syntax/src/syntax_error.rs index 45e11f404..7f9d36618 100644 --- a/crates/ra_syntax/src/syntax_error.rs +++ b/crates/ra_syntax/src/syntax_error.rs | |||
@@ -71,6 +71,10 @@ impl SyntaxError { | |||
71 | 71 | ||
72 | self | 72 | self |
73 | } | 73 | } |
74 | |||
75 | pub fn debug_dump(&self, acc: &mut impl fmt::Write) { | ||
76 | writeln!(acc, "error {:?}: {}", self.location(), self.kind()).unwrap(); | ||
77 | } | ||
74 | } | 78 | } |
75 | 79 | ||
76 | impl fmt::Display for SyntaxError { | 80 | impl fmt::Display for SyntaxError { |
@@ -122,37 +126,44 @@ impl fmt::Display for SyntaxErrorKind { | |||
122 | 126 | ||
123 | impl fmt::Display for TokenizeError { | 127 | impl fmt::Display for TokenizeError { |
124 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | 128 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
129 | #[rustfmt::skip] | ||
125 | let msg = match self { | 130 | let msg = match self { |
126 | TokenizeError::EmptyInt => "Missing digits after integer base prefix", | 131 | TokenizeError::EmptyInt => { |
127 | TokenizeError::EmptyExponent => "Missing digits after the exponent symbol", | 132 | "Missing digits after the integer base prefix" |
133 | } | ||
134 | TokenizeError::EmptyExponent => { | ||
135 | "Missing digits after the exponent symbol" | ||
136 | } | ||
128 | TokenizeError::UnterminatedBlockComment => { | 137 | TokenizeError::UnterminatedBlockComment => { |
129 | "Missing trailing */ symbols to terminate the block comment" | 138 | "Missing trailing `*/` symbols to terminate the block comment" |
130 | } | 139 | } |
131 | TokenizeError::UnterminatedChar => { | 140 | TokenizeError::UnterminatedChar => { |
132 | "Missing trailing ' symbol to terminate the character literal" | 141 | "Missing trailing `'` symbol to terminate the character literal" |
133 | } | 142 | } |
134 | TokenizeError::UnterminatedByte => { | 143 | TokenizeError::UnterminatedByte => { |
135 | "Missing trailing ' symbol to terminate the byte literal" | 144 | "Missing trailing `'` symbol to terminate the byte literal" |
136 | } | 145 | } |
137 | TokenizeError::UnterminatedString => { | 146 | TokenizeError::UnterminatedString => { |
138 | "Missing trailing \" symbol to terminate the string literal" | 147 | "Missing trailing `\"` symbol to terminate the string literal" |
139 | } | 148 | } |
140 | TokenizeError::UnterminatedByteString => { | 149 | TokenizeError::UnterminatedByteString => { |
141 | "Missing trailing \" symbol to terminate the byte string literal" | 150 | "Missing trailing `\"` symbol to terminate the byte string literal" |
142 | } | 151 | } |
143 | TokenizeError::UnterminatedRawString => { | 152 | TokenizeError::UnterminatedRawString => { |
144 | "Missing trailing \" with # symbols to terminate the raw string literal" | 153 | "Missing trailing `\"` with `#` symbols to terminate the raw string literal" |
145 | } | 154 | } |
146 | TokenizeError::UnterminatedRawByteString => { | 155 | TokenizeError::UnterminatedRawByteString => { |
147 | "Missing trailing \" with # symbols to terminate the raw byte string literal" | 156 | "Missing trailing `\"` with `#` symbols to terminate the raw byte string literal" |
148 | } | 157 | } |
149 | TokenizeError::UnstartedRawString => { | 158 | TokenizeError::UnstartedRawString => { |
150 | "Missing \" symbol after # symbols to begin the raw string literal" | 159 | "Missing `\"` symbol after `#` symbols to begin the raw string literal" |
151 | } | 160 | } |
152 | TokenizeError::UnstartedRawByteString => { | 161 | TokenizeError::UnstartedRawByteString => { |
153 | "Missing \" symbol after # symbols to begin the raw byte string literal" | 162 | "Missing `\"` symbol after `#` symbols to begin the raw byte string literal" |
163 | } | ||
164 | TokenizeError::LifetimeStartsWithNumber => { | ||
165 | "Lifetime name cannot start with a number" | ||
154 | } | 166 | } |
155 | TokenizeError::LifetimeStartsWithNumber => "Lifetime name cannot start with a number", | ||
156 | }; | 167 | }; |
157 | write!(f, "{}", msg) | 168 | write!(f, "{}", msg) |
158 | } | 169 | } |