Skip to content

Commit 3d043bb

Browse files
committed
[parser]: support for hex literals
1 parent c1d9670 commit 3d043bb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/ecLexer.mll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@ let upper = ['A'-'Z']
334334
let lower = ['a'-'z']
335335
let letter = upper | lower
336336
let digit = ['0'-'9']
337+
let xdigit = ['0'-'9' 'a'-'f' 'A'-'F']
337338
let uint = digit+
339+
let uxint = "0x" xdigit+
338340

339341
let ichar = (letter | digit | '_' | '\'')
340342
let lident = (lower ichar*) | ('_' ichar+)
@@ -361,6 +363,7 @@ rule main = parse
361363
| tident { [TIDENT (Lexing.lexeme lexbuf)] }
362364
| mident { [MIDENT (Lexing.lexeme lexbuf)] }
363365
| uint { [UINT (BI.of_string (Lexing.lexeme lexbuf))] }
366+
| uxint { [UINT (BI.of_string (Lexing.lexeme lexbuf))] }
364367

365368
| (digit+ as n) '.' (digit+ as f) {
366369
let nv, fv = BI.of_string n, BI.of_string f in

0 commit comments

Comments
 (0)