Skip to content

Commit a84a3b1

Browse files
committed
add support for scientific notation
1 parent e13e3ac commit a84a3b1

File tree

7 files changed

+395
-385
lines changed

7 files changed

+395
-385
lines changed

more_math/Parser/MathExpr.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ COLON: ':';
333333
LBRACE: '{';
334334
RBRACE: '}';
335335

336+
NUMBER: ([0-9]+('.'[0-9]*)? | '.'[0-9]+)([eE][+-]?[0-9]+)?;
336337
CONSTANT: ('pi' | 'PI' | 'e' | 'E');
337-
NUMBER: [0-9]+ ('.' [0-9]+)?;
338338
VARIABLE: [a-zA-Z_] [a-zA-Z_0-9]*;
339339

340340
SL_COMMENT : '#' ~[\r\n]* -> skip;

more_math/Parser/MathExpr.interp

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

more_math/Parser/MathExpr.tokens

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ QUESTION=126
127127
COLON=127
128128
LBRACE=128
129129
RBRACE=129
130-
CONSTANT=130
131-
NUMBER=131
130+
NUMBER=130
131+
CONSTANT=131
132132
VARIABLE=132
133133
SL_COMMENT=133
134134
ML_COMMENT=134

more_math/Parser/MathExprLexer.interp

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

more_math/Parser/MathExprLexer.py

Lines changed: 381 additions & 371 deletions
Large diffs are not rendered by default.

more_math/Parser/MathExprLexer.tokens

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ QUESTION=126
127127
COLON=127
128128
LBRACE=128
129129
RBRACE=129
130-
CONSTANT=130
131-
NUMBER=131
130+
NUMBER=130
131+
CONSTANT=131
132132
VARIABLE=132
133133
SL_COMMENT=133
134134
ML_COMMENT=134

more_math/Parser/MathExprParser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def serializedATN():
150150
242,1,0,0,0,240,238,1,0,0,0,240,241,1,0,0,0,241,37,1,0,0,0,242,240,
151151
1,0,0,0,243,279,3,42,21,0,244,279,3,44,22,0,245,279,3,46,23,0,246,
152152
279,3,48,24,0,247,279,3,50,25,0,248,279,3,52,26,0,249,279,3,54,27,
153-
0,250,279,5,132,0,0,251,279,5,131,0,0,252,279,5,130,0,0,253,254,
153+
0,250,279,5,132,0,0,251,279,5,130,0,0,252,279,5,131,0,0,253,254,
154154
5,119,0,0,254,255,3,22,11,0,255,256,5,120,0,0,256,279,1,0,0,0,257,
155155
258,5,118,0,0,258,259,3,22,11,0,259,260,5,118,0,0,260,279,1,0,0,
156156
0,261,262,5,124,0,0,262,267,3,22,11,0,263,264,5,121,0,0,264,266,
@@ -427,7 +427,7 @@ class MathExprParser ( Parser ):
427427
"GT", "LE", "LT", "EQ", "EQUEALS", "NE", "PIPE", "LPAREN",
428428
"RPAREN", "COMMA", "SEMICOLON", "ARROW", "LBRACKET",
429429
"RBRACKET", "QUESTION", "COLON", "LBRACE", "RBRACE",
430-
"CONSTANT", "NUMBER", "VARIABLE", "SL_COMMENT", "ML_COMMENT",
430+
"NUMBER", "CONSTANT", "VARIABLE", "SL_COMMENT", "ML_COMMENT",
431431
"WS" ]
432432

433433
RULE_start = 0
@@ -596,8 +596,8 @@ class MathExprParser ( Parser ):
596596
COLON=127
597597
LBRACE=128
598598
RBRACE=129
599-
CONSTANT=130
600-
NUMBER=131
599+
NUMBER=130
600+
CONSTANT=131
601601
VARIABLE=132
602602
SL_COMMENT=133
603603
ML_COMMENT=134

0 commit comments

Comments
 (0)