Skip to content

Commit 13e5b4e

Browse files
committed
Add comments
1 parent 769c6a4 commit 13e5b4e

File tree

7 files changed

+459
-426
lines changed

7 files changed

+459
-426
lines changed

more_math/Parser/MathExpr.g4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,7 @@ RBRACE: '}';
325325
CONSTANT: ('pi' | 'PI' | 'e' | 'E');
326326
NUMBER: [0-9]+ ('.' [0-9]+)?;
327327
VARIABLE: [a-zA-Z_] [a-zA-Z_0-9]*;
328+
329+
SL_COMMENT : '#' ~[\r\n]* -> skip;
330+
ML_COMMENT : '/*' .*? '*/' -> skip;
328331
WS: [ \t\r\n]+ -> skip;

more_math/Parser/MathExpr.interp

Lines changed: 5 additions & 1 deletion
Large diffs are not rendered by default.

more_math/Parser/MathExpr.tokens

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ RBRACE=126
127127
CONSTANT=127
128128
NUMBER=128
129129
VARIABLE=129
130-
WS=130
130+
SL_COMMENT=130
131+
ML_COMMENT=131
132+
WS=132
131133
'sin'=1
132134
'cos'=2
133135
'tan'=3

more_math/Parser/MathExprLexer.interp

Lines changed: 7 additions & 1 deletion
Large diffs are not rendered by default.

more_math/Parser/MathExprLexer.py

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

more_math/Parser/MathExprLexer.tokens

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ RBRACE=126
127127
CONSTANT=127
128128
NUMBER=128
129129
VARIABLE=129
130-
WS=130
130+
SL_COMMENT=130
131+
ML_COMMENT=131
132+
WS=132
131133
'sin'=1
132134
'cos'=2
133135
'tan'=3

more_math/Parser/MathExprParser.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
def serializedATN():
1212
return [
13-
4,1,130,927,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,
13+
4,1,132,927,2,0,7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,
1414
7,6,2,7,7,7,2,8,7,8,2,9,7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,
1515
13,2,14,7,14,2,15,7,15,2,16,7,16,2,17,7,17,2,18,7,18,2,19,7,19,2,
1616
20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,2,24,7,24,1,0,1,0,1,0,5,0,
@@ -418,7 +418,7 @@ class MathExprParser ( Parser ):
418418
"EQUEALS", "NE", "PIPE", "LPAREN", "RPAREN", "COMMA",
419419
"SEMICOLON", "ARROW", "LBRACKET", "RBRACKET", "QUESTION",
420420
"COLON", "LBRACE", "RBRACE", "CONSTANT", "NUMBER",
421-
"VARIABLE", "WS" ]
421+
"VARIABLE", "SL_COMMENT", "ML_COMMENT", "WS" ]
422422

423423
RULE_start = 0
424424
RULE_funcDef = 1
@@ -582,7 +582,9 @@ class MathExprParser ( Parser ):
582582
CONSTANT=127
583583
NUMBER=128
584584
VARIABLE=129
585-
WS=130
585+
SL_COMMENT=130
586+
ML_COMMENT=131
587+
WS=132
586588

587589
def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
588590
super().__init__(input, output)

0 commit comments

Comments
 (0)