about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2011-03-24 10:37:05 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-03-24 12:37:12 -0700
commit2bd78c176dc638773c527d85160e284bcaf0a5b6 (patch)
tree4d14ca5b85f3496e2395cdaef2025f3656ab8eef
parentc0f66a52404521ae159ce9e2778eefa5d27a58e0 (diff)
downloadrust-2bd78c176dc638773c527d85160e284bcaf0a5b6.tar.gz
rust-2bd78c176dc638773c527d85160e284bcaf0a5b6.zip
Improve error message when the lexer sees a bad character
-rw-r--r--src/boot/fe/lexer.mll3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/boot/fe/lexer.mll b/src/boot/fe/lexer.mll
index 84aeb9ab114..b84e5906bb9 100644
--- a/src/boot/fe/lexer.mll
+++ b/src/boot/fe/lexer.mll
@@ -297,7 +297,8 @@ rule token = parse
 | '\''                         { char lexbuf                       }
 | '"'                          { let buf = Buffer.create 32 in
                                    str buf lexbuf                  }
-
+| _ as c                       { let s = Char.escaped c in
+                                   fail lexbuf ("Bad character: " ^ s) }
 | eof                          { EOF        }
 
 and str buf = parse