Commit b9441f2
committed
Improve char escaping in lexer messages
Currently ', " and \ are escaped as \', \" and \\ respectively. This
leads to confusing messages such as `error: unknown start of token: \\`
when encountering a single backslash.
Fix by emitting printable ASCII characters directly. This will still
escape \r, \n, \t and Unicode characters.
Fixes #479021 parent 560a2f4 commit b9441f2
File tree
3 files changed
+33
-13
lines changed- src
- libsyntax/parse/lexer
- test/parse-fail
3 files changed
+33
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
249 | 264 | | |
250 | 265 | | |
251 | 266 | | |
252 | 267 | | |
253 | 268 | | |
254 | | - | |
255 | | - | |
256 | | - | |
| 269 | + | |
257 | 270 | | |
258 | 271 | | |
259 | 272 | | |
| |||
264 | 277 | | |
265 | 278 | | |
266 | 279 | | |
267 | | - | |
268 | | - | |
269 | | - | |
| 280 | + | |
270 | 281 | | |
271 | 282 | | |
272 | 283 | | |
| |||
275 | 286 | | |
276 | 287 | | |
277 | 288 | | |
278 | | - | |
279 | | - | |
280 | | - | |
| 289 | + | |
281 | 290 | | |
282 | 291 | | |
283 | 292 | | |
| |||
288 | 297 | | |
289 | 298 | | |
290 | 299 | | |
291 | | - | |
292 | | - | |
293 | | - | |
| 300 | + | |
294 | 301 | | |
295 | 302 | | |
296 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments