aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-07-01 09:03:47 -0700
committerGraydon Hoare <[email protected]>2010-07-01 09:03:47 -0700
commitafc0dc8bfcc5d6fba1e907ab35c110fc074cad67 (patch)
tree3b1c4a8696049d2bb285a16265cacec04e7c44f6
parentDescribe numeric and textual literals better; clean up lexeme descriptions a ... (diff)
downloadrust-afc0dc8bfcc5d6fba1e907ab35c110fc074cad67.tar.xz
rust-afc0dc8bfcc5d6fba1e907ab35c110fc074cad67.zip
Fix lexer's definition of numeric literals.
-rw-r--r--src/boot/fe/lexer.mll9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/boot/fe/lexer.mll b/src/boot/fe/lexer.mll
index fb4d58c5..4e4e845c 100644
--- a/src/boot/fe/lexer.mll
+++ b/src/boot/fe/lexer.mll
@@ -121,9 +121,10 @@
}
let hexdig = ['0'-'9' 'a'-'f' 'A'-'F']
-let bin = "0b" ['0' '1']['0' '1' '_']*
-let hex = "0x" hexdig ['0'-'9' 'a'-'f' 'A'-'F' '_']*
-let dec = ['0'-'9']+
+let decdig = ['0'-'9']
+let bin = '0' 'b' ['0' '1' '_']*
+let hex = '0' 'x' ['0'-'9' 'a'-'f' 'A'-'F' '_']*
+let dec = decdig ['0'-'9' '_']*
let exp = ['e''E']['-''+']? dec
let flo = (dec '.' dec (exp?)) | (dec exp)
@@ -160,7 +161,7 @@ rule token = parse
| ">>>" { ASR }
| '~' { TILDE }
| '{' { LBRACE }
-| '_' (dec as n) { IDX (int_of_string n) }
+| '_' (decdig+ as n) { IDX (int_of_string n) }
| '_' { UNDERSCORE }
| '}' { RBRACE }