Skip to content

Commit 2bd78c1

Browse files
catamorphismgraydon
authored andcommitted
Improve error message when the lexer sees a bad character
1 parent c0f66a5 commit 2bd78c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/boot/fe/lexer.mll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ rule token = parse
297297
| '\'' { char lexbuf }
298298
| '"' { let buf = Buffer.create 32 in
299299
str buf lexbuf }
300-
300+
| _ as c { let s = Char.escaped c in
301+
fail lexbuf ("Bad character: " ^ s) }
301302
| eof { EOF }
302303

303304
and str buf = parse

0 commit comments

Comments
 (0)