Add hexadecimal numbers

pull/70/head
Max Brunsfeld 2014-09-03 08:28:53 +07:00
parent 16330ce412
commit cc80ba2ef6
2 changed files with 9 additions and 3 deletions

@ -215,9 +215,13 @@ module.exports = compiler.grammar
identifier: -> /[\a_$][\a\d_$]*/
number: -> token(seq(
/\d+/,
optional(seq(".", /\d+/))))
number: -> token(choice(
seq(
"0x",
/[\da-fA-F]+/),
seq(
/\d+/,
optional(seq(".", /\d*/)))))
bool_op: -> choice(
prec(4, seq("!", @expression)),

@ -17,10 +17,12 @@ Numbers
101;
3.14;
0x1ABCDEFabcdef;
---
(program
(expression_statement (number))
(expression_statement (number))
(expression_statement (number)))