Skip to content

Commit

Permalink
support '_' separator in dec/oct/float numbers
Browse files Browse the repository at this point in the history
Allows 100_000 in place of 100000
  • Loading branch information
z80dev committed Nov 8, 2023
1 parent 5482bbc commit dc3ac07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vyper/ast/grammar.lark
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@ _NEWLINE: ( /\r?\n[\t ]*/ | COMMENT )+
STRING: /b?("(?!"").*?(?<!\\)(\\\\)*?"|'(?!'').*?(?<!\\)(\\\\)*?')/i
DOCSTRING: /(""".*?(?<!\\)(\\\\)*?"""|'''.*?(?<!\\)(\\\\)*?''')/is

DEC_NUMBER: /0|[1-9]\d*/i
DEC_NUMBER: /0|[1-9]([0-9]*_)?([0-9]+_)*[0-9]+/
HEX_NUMBER.2: /0x[\da-f]*/i
OCT_NUMBER.2: /0o[0-7]*/i
OCT_NUMBER.2: /0o([0-7]+_)*[0-7]+/
BIN_NUMBER.2 : /0b[0-1]*/i
FLOAT_NUMBER.2: /((\d+\.\d*|\.\d+)(e[-+]?\d+)?|\d+(e[-+]?\d+))/i
FLOAT_NUMBER.2: /((\d+(_\d+)*\.\d*|\.\d+)(e[-+]?\d+)?|\d+(_\d+)*(e[-+]?\d+)?)/i

_number: DEC_NUMBER
| HEX_NUMBER
Expand Down

0 comments on commit dc3ac07

Please sign in to comment.