AI: Fix operator precendence, add anonymous lambda, add FALSE, TRUE, relax dictionary, fix things I did not notice
This commit is contained in:
@@ -43,7 +43,8 @@ block: LBRACE stmt* RBRACE;
|
||||
dictEntryList: dictEntry (COMMA dictEntry)*;
|
||||
dictEntry: VARIABLE COLON expr
|
||||
| STRING COLON expr
|
||||
| NUMBER COLON expr;
|
||||
| NUMBER COLON expr
|
||||
| LBRACKET expr RBRACKET COLON expr;
|
||||
|
||||
breakStmt: BREAK SEMICOLON;
|
||||
continueStmt: CONTINUE SEMICOLON;
|
||||
@@ -52,7 +53,7 @@ returnStmt: RETURN expr? SEMICOLON;
|
||||
// A lambda binds loosest, so its body takes the whole following expression, ternaries included.
|
||||
expr: lambdaExpr | ternaryExpr | compExpr;
|
||||
|
||||
lambdaExpr: LPAREN paramList RPAREN ARROW (expr | block) # LambdaExp;
|
||||
lambdaExpr: LPAREN paramList? RPAREN ARROW (expr | block) # LambdaExp;
|
||||
|
||||
ternaryExpr: compExpr QUESTION expr COLON expr # TernaryExp;
|
||||
|
||||
@@ -74,22 +75,22 @@ addExpr:
|
||||
| mulExpr # ToMul;
|
||||
|
||||
mulExpr:
|
||||
mulExpr MULT powExpr # MulExp
|
||||
| mulExpr DIV powExpr # DivExp
|
||||
| mulExpr MOD powExpr # ModExp
|
||||
| powExpr # ToPow;
|
||||
mulExpr MULT unaryExpr # MulExp
|
||||
| mulExpr DIV unaryExpr # DivExp
|
||||
| mulExpr MOD unaryExpr # ModExp
|
||||
| unaryExpr # ToPow;
|
||||
|
||||
shiftExpr:
|
||||
shiftExpr LSHIFT addExpr # LShiftExp
|
||||
| shiftExpr RSHIFT addExpr # RShiftExp
|
||||
| addExpr # ToAdd;
|
||||
|
||||
powExpr: unaryExpr POW powExpr # PowExp | unaryExpr # ToUnary;
|
||||
powExpr: indexExpr POW unaryExpr # PowExp | indexExpr # ToUnary;
|
||||
|
||||
unaryExpr:
|
||||
PLUS unaryExpr # UnaryPlus
|
||||
| MINUS unaryExpr # UnaryMinus
|
||||
| indexExpr # ToIndex;
|
||||
| powExpr # ToIndex;
|
||||
|
||||
indexExpr:
|
||||
indexExpr LBRACKET sliceElement (COMMA sliceElement)* RBRACKET # IndexExp
|
||||
@@ -119,11 +120,12 @@ atom:
|
||||
| VARIABLE # VariableExp
|
||||
| NUMBER # NumberExp
|
||||
| CONSTANT # ConstantExp
|
||||
| TRUE # BooleanExp
|
||||
| FALSE # BooleanExp
|
||||
| STRING # StringExp
|
||||
| LPAREN expr RPAREN # ParenExp
|
||||
| LPAREN expr RPAREN # ParenExp
|
||||
| PIPE expr PIPE # AbsExp
|
||||
| LBRACKET expr (COMMA expr)* RBRACKET # ListExp
|
||||
| LBRACKET (expr (COMMA expr)*)? RBRACKET # ListExp
|
||||
| LBRACE dictEntryList? RBRACE # DictExp
|
||||
| VARIABLE LPAREN exprList? RPAREN # CallExp
|
||||
| NONE # NoneExp
|
||||
@@ -2061,6 +2063,8 @@ CORR: 'corr' | 'correlation';
|
||||
ENTROPY: 'entropy';
|
||||
CROP: 'crop';
|
||||
NONE: 'none'|'None'|'null'|'NULL';
|
||||
TRUE: 'true'|'True'|'TRUE';
|
||||
FALSE: 'false'|'False'|'FALSE';
|
||||
COORDS: 'coords'|'coordinates';
|
||||
GATHER: 'gather';
|
||||
SCATTER: 'scatter';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import bisect
|
||||
import bisect
|
||||
import functools
|
||||
import json
|
||||
import time
|
||||
@@ -812,6 +812,9 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
return math.e
|
||||
return 0.0
|
||||
|
||||
def visitBooleanExp(self, ctx):
|
||||
return 1.0 if ctx.TRUE() else 0.0
|
||||
|
||||
def visitVariableExp(self, ctx):
|
||||
var_name = ctx.VARIABLE().getText()
|
||||
if var_name == "depth":
|
||||
@@ -831,14 +834,19 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
res = MathDict()
|
||||
entries = ctx.dictEntryList().dictEntry() if ctx.dictEntryList() else []
|
||||
for entry in entries:
|
||||
if entry.VARIABLE():
|
||||
key = entry.VARIABLE().getText()
|
||||
elif entry.STRING():
|
||||
key = self._decode_string_literal(entry.STRING().getText())
|
||||
if entry.LBRACKET():
|
||||
expressions = entry.expr()
|
||||
key = yield expressions[0]
|
||||
value = yield expressions[1]
|
||||
else:
|
||||
key_text = entry.NUMBER().getText()
|
||||
key = float(key_text) if any(ch in key_text for ch in ".eE") else int(key_text)
|
||||
value = yield entry.expr()
|
||||
if entry.VARIABLE():
|
||||
key = entry.VARIABLE().getText()
|
||||
elif entry.STRING():
|
||||
key = self._decode_string_literal(entry.STRING().getText())
|
||||
else:
|
||||
key_text = entry.NUMBER().getText()
|
||||
key = float(key_text) if any(ch in key_text for ch in ".eE") else int(key_text)
|
||||
value = yield entry.expr()[0]
|
||||
res[key] = value
|
||||
return res
|
||||
|
||||
@@ -859,7 +867,7 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
return self._unary_op((yield ctx.unaryExpr()), torch.neg, lambda x: -x)
|
||||
|
||||
def visitToIndex(self, ctx):
|
||||
return (yield ctx.indexExpr())
|
||||
return (yield ctx.powExpr())
|
||||
|
||||
def _process_slice_element(self, slice_elem_ctx):
|
||||
"""Process a sliceElement context and return either an index value or a slice object."""
|
||||
@@ -1108,22 +1116,22 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
|
||||
def visitMulExp(self, ctx):
|
||||
a = yield ctx.mulExpr()
|
||||
b = yield ctx.powExpr()
|
||||
b = yield ctx.unaryExpr()
|
||||
return self._bin_op(a, b, torch.mul, lambda a, b: a * b, ctx)
|
||||
|
||||
def visitDivExp(self, ctx):
|
||||
a = yield ctx.mulExpr()
|
||||
b = yield ctx.powExpr()
|
||||
b = yield ctx.unaryExpr()
|
||||
return self._bin_op(a, b, torch.div, lambda a, b: a / b, ctx)
|
||||
|
||||
def visitModExp(self, ctx):
|
||||
a = yield ctx.mulExpr()
|
||||
b = yield ctx.powExpr()
|
||||
b = yield ctx.unaryExpr()
|
||||
return self._bin_op(a, b, torch.remainder, lambda a, b: a % b, ctx)
|
||||
|
||||
def visitPowExp(self, ctx):
|
||||
a = yield ctx.unaryExpr()
|
||||
b = yield ctx.powExpr()
|
||||
a = yield ctx.indexExpr()
|
||||
b = yield ctx.unaryExpr()
|
||||
return self._bin_op(a, b, torch.pow, lambda a, b: a ** b, ctx)
|
||||
|
||||
def _bool_op(self, a, b, torch_op, scalar_op, ctx=None):
|
||||
@@ -1175,10 +1183,10 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
return (yield ctx.mulExpr())
|
||||
|
||||
def visitToPow(self, ctx):
|
||||
return (yield ctx.powExpr())
|
||||
return (yield ctx.unaryExpr())
|
||||
|
||||
def visitToUnary(self, ctx):
|
||||
return (yield ctx.unaryExpr())
|
||||
return (yield ctx.indexExpr())
|
||||
|
||||
# Functions
|
||||
def visitTimestampFunc(self, ctx):
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -245,71 +245,73 @@ CORR=244
|
||||
ENTROPY=245
|
||||
CROP=246
|
||||
NONE=247
|
||||
COORDS=248
|
||||
GATHER=249
|
||||
SCATTER=250
|
||||
SCATTER_ADD=251
|
||||
NOISE=252
|
||||
PINK_NOISE=253
|
||||
BROWN_NOISE=254
|
||||
RAND=255
|
||||
CAUCHY=256
|
||||
EXPONENTIAL=257
|
||||
LOGNORMAL=258
|
||||
BERNOULLI=259
|
||||
BINOMIALDIST=260
|
||||
POISSON=261
|
||||
GAMMADIST=262
|
||||
BETADIST=263
|
||||
LAPLACEDIST=264
|
||||
GUMBELDIST=265
|
||||
WEIBULLDIST=266
|
||||
CHI2DIST=267
|
||||
STUDENTTDIST=268
|
||||
PERLIN=269
|
||||
CELLULAR=270
|
||||
PLASMA=271
|
||||
RIDGED=272
|
||||
DOMAIN_WARP=273
|
||||
PLUS=274
|
||||
MINUS=275
|
||||
MULT=276
|
||||
DIV=277
|
||||
MOD=278
|
||||
POW=279
|
||||
LSHIFT=280
|
||||
RSHIFT=281
|
||||
GE=282
|
||||
GT=283
|
||||
LE=284
|
||||
LT=285
|
||||
EQ=286
|
||||
EQUEALS=287
|
||||
PLUS_EQ=288
|
||||
MINUS_EQ=289
|
||||
MULT_EQ=290
|
||||
DIV_EQ=291
|
||||
MOD_EQ=292
|
||||
NE=293
|
||||
PIPE=294
|
||||
LPAREN=295
|
||||
RPAREN=296
|
||||
COMMA=297
|
||||
SEMICOLON=298
|
||||
ARROW=299
|
||||
LBRACKET=300
|
||||
RBRACKET=301
|
||||
QUESTION=302
|
||||
COLON=303
|
||||
LBRACE=304
|
||||
RBRACE=305
|
||||
NUMBER=306
|
||||
CONSTANT=307
|
||||
STRING=308
|
||||
VARIABLE=309
|
||||
SL_COMMENT=310
|
||||
ML_COMMENT=311
|
||||
WS=312
|
||||
TRUE=248
|
||||
FALSE=249
|
||||
COORDS=250
|
||||
GATHER=251
|
||||
SCATTER=252
|
||||
SCATTER_ADD=253
|
||||
NOISE=254
|
||||
PINK_NOISE=255
|
||||
BROWN_NOISE=256
|
||||
RAND=257
|
||||
CAUCHY=258
|
||||
EXPONENTIAL=259
|
||||
LOGNORMAL=260
|
||||
BERNOULLI=261
|
||||
BINOMIALDIST=262
|
||||
POISSON=263
|
||||
GAMMADIST=264
|
||||
BETADIST=265
|
||||
LAPLACEDIST=266
|
||||
GUMBELDIST=267
|
||||
WEIBULLDIST=268
|
||||
CHI2DIST=269
|
||||
STUDENTTDIST=270
|
||||
PERLIN=271
|
||||
CELLULAR=272
|
||||
PLASMA=273
|
||||
RIDGED=274
|
||||
DOMAIN_WARP=275
|
||||
PLUS=276
|
||||
MINUS=277
|
||||
MULT=278
|
||||
DIV=279
|
||||
MOD=280
|
||||
POW=281
|
||||
LSHIFT=282
|
||||
RSHIFT=283
|
||||
GE=284
|
||||
GT=285
|
||||
LE=286
|
||||
LT=287
|
||||
EQ=288
|
||||
EQUEALS=289
|
||||
PLUS_EQ=290
|
||||
MINUS_EQ=291
|
||||
MULT_EQ=292
|
||||
DIV_EQ=293
|
||||
MOD_EQ=294
|
||||
NE=295
|
||||
PIPE=296
|
||||
LPAREN=297
|
||||
RPAREN=298
|
||||
COMMA=299
|
||||
SEMICOLON=300
|
||||
ARROW=301
|
||||
LBRACKET=302
|
||||
RBRACKET=303
|
||||
QUESTION=304
|
||||
COLON=305
|
||||
LBRACE=306
|
||||
RBRACE=307
|
||||
NUMBER=308
|
||||
CONSTANT=309
|
||||
STRING=310
|
||||
VARIABLE=311
|
||||
SL_COMMENT=312
|
||||
ML_COMMENT=313
|
||||
WS=314
|
||||
'sin'=1
|
||||
'cos'=2
|
||||
'tan'=3
|
||||
@@ -511,38 +513,38 @@ WS=312
|
||||
'cov'=243
|
||||
'entropy'=245
|
||||
'crop'=246
|
||||
'gather'=249
|
||||
'scatter'=250
|
||||
'scatter_add'=251
|
||||
'+'=274
|
||||
'-'=275
|
||||
'*'=276
|
||||
'/'=277
|
||||
'%'=278
|
||||
'^'=279
|
||||
'<<'=280
|
||||
'>>'=281
|
||||
'>='=282
|
||||
'>'=283
|
||||
'<='=284
|
||||
'<'=285
|
||||
'=='=286
|
||||
'='=287
|
||||
'+='=288
|
||||
'-='=289
|
||||
'*='=290
|
||||
'/='=291
|
||||
'%='=292
|
||||
'!='=293
|
||||
'|'=294
|
||||
'('=295
|
||||
')'=296
|
||||
','=297
|
||||
';'=298
|
||||
'->'=299
|
||||
'['=300
|
||||
']'=301
|
||||
'?'=302
|
||||
':'=303
|
||||
'{'=304
|
||||
'}'=305
|
||||
'gather'=251
|
||||
'scatter'=252
|
||||
'scatter_add'=253
|
||||
'+'=276
|
||||
'-'=277
|
||||
'*'=278
|
||||
'/'=279
|
||||
'%'=280
|
||||
'^'=281
|
||||
'<<'=282
|
||||
'>>'=283
|
||||
'>='=284
|
||||
'>'=285
|
||||
'<='=286
|
||||
'<'=287
|
||||
'=='=288
|
||||
'='=289
|
||||
'+='=290
|
||||
'-='=291
|
||||
'*='=292
|
||||
'/='=293
|
||||
'%='=294
|
||||
'!='=295
|
||||
'|'=296
|
||||
'('=297
|
||||
')'=298
|
||||
','=299
|
||||
';'=300
|
||||
'->'=301
|
||||
'['=302
|
||||
']'=303
|
||||
'?'=304
|
||||
':'=305
|
||||
'{'=306
|
||||
'}'=307
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -245,71 +245,73 @@ CORR=244
|
||||
ENTROPY=245
|
||||
CROP=246
|
||||
NONE=247
|
||||
COORDS=248
|
||||
GATHER=249
|
||||
SCATTER=250
|
||||
SCATTER_ADD=251
|
||||
NOISE=252
|
||||
PINK_NOISE=253
|
||||
BROWN_NOISE=254
|
||||
RAND=255
|
||||
CAUCHY=256
|
||||
EXPONENTIAL=257
|
||||
LOGNORMAL=258
|
||||
BERNOULLI=259
|
||||
BINOMIALDIST=260
|
||||
POISSON=261
|
||||
GAMMADIST=262
|
||||
BETADIST=263
|
||||
LAPLACEDIST=264
|
||||
GUMBELDIST=265
|
||||
WEIBULLDIST=266
|
||||
CHI2DIST=267
|
||||
STUDENTTDIST=268
|
||||
PERLIN=269
|
||||
CELLULAR=270
|
||||
PLASMA=271
|
||||
RIDGED=272
|
||||
DOMAIN_WARP=273
|
||||
PLUS=274
|
||||
MINUS=275
|
||||
MULT=276
|
||||
DIV=277
|
||||
MOD=278
|
||||
POW=279
|
||||
LSHIFT=280
|
||||
RSHIFT=281
|
||||
GE=282
|
||||
GT=283
|
||||
LE=284
|
||||
LT=285
|
||||
EQ=286
|
||||
EQUEALS=287
|
||||
PLUS_EQ=288
|
||||
MINUS_EQ=289
|
||||
MULT_EQ=290
|
||||
DIV_EQ=291
|
||||
MOD_EQ=292
|
||||
NE=293
|
||||
PIPE=294
|
||||
LPAREN=295
|
||||
RPAREN=296
|
||||
COMMA=297
|
||||
SEMICOLON=298
|
||||
ARROW=299
|
||||
LBRACKET=300
|
||||
RBRACKET=301
|
||||
QUESTION=302
|
||||
COLON=303
|
||||
LBRACE=304
|
||||
RBRACE=305
|
||||
NUMBER=306
|
||||
CONSTANT=307
|
||||
STRING=308
|
||||
VARIABLE=309
|
||||
SL_COMMENT=310
|
||||
ML_COMMENT=311
|
||||
WS=312
|
||||
TRUE=248
|
||||
FALSE=249
|
||||
COORDS=250
|
||||
GATHER=251
|
||||
SCATTER=252
|
||||
SCATTER_ADD=253
|
||||
NOISE=254
|
||||
PINK_NOISE=255
|
||||
BROWN_NOISE=256
|
||||
RAND=257
|
||||
CAUCHY=258
|
||||
EXPONENTIAL=259
|
||||
LOGNORMAL=260
|
||||
BERNOULLI=261
|
||||
BINOMIALDIST=262
|
||||
POISSON=263
|
||||
GAMMADIST=264
|
||||
BETADIST=265
|
||||
LAPLACEDIST=266
|
||||
GUMBELDIST=267
|
||||
WEIBULLDIST=268
|
||||
CHI2DIST=269
|
||||
STUDENTTDIST=270
|
||||
PERLIN=271
|
||||
CELLULAR=272
|
||||
PLASMA=273
|
||||
RIDGED=274
|
||||
DOMAIN_WARP=275
|
||||
PLUS=276
|
||||
MINUS=277
|
||||
MULT=278
|
||||
DIV=279
|
||||
MOD=280
|
||||
POW=281
|
||||
LSHIFT=282
|
||||
RSHIFT=283
|
||||
GE=284
|
||||
GT=285
|
||||
LE=286
|
||||
LT=287
|
||||
EQ=288
|
||||
EQUEALS=289
|
||||
PLUS_EQ=290
|
||||
MINUS_EQ=291
|
||||
MULT_EQ=292
|
||||
DIV_EQ=293
|
||||
MOD_EQ=294
|
||||
NE=295
|
||||
PIPE=296
|
||||
LPAREN=297
|
||||
RPAREN=298
|
||||
COMMA=299
|
||||
SEMICOLON=300
|
||||
ARROW=301
|
||||
LBRACKET=302
|
||||
RBRACKET=303
|
||||
QUESTION=304
|
||||
COLON=305
|
||||
LBRACE=306
|
||||
RBRACE=307
|
||||
NUMBER=308
|
||||
CONSTANT=309
|
||||
STRING=310
|
||||
VARIABLE=311
|
||||
SL_COMMENT=312
|
||||
ML_COMMENT=313
|
||||
WS=314
|
||||
'sin'=1
|
||||
'cos'=2
|
||||
'tan'=3
|
||||
@@ -511,38 +513,38 @@ WS=312
|
||||
'cov'=243
|
||||
'entropy'=245
|
||||
'crop'=246
|
||||
'gather'=249
|
||||
'scatter'=250
|
||||
'scatter_add'=251
|
||||
'+'=274
|
||||
'-'=275
|
||||
'*'=276
|
||||
'/'=277
|
||||
'%'=278
|
||||
'^'=279
|
||||
'<<'=280
|
||||
'>>'=281
|
||||
'>='=282
|
||||
'>'=283
|
||||
'<='=284
|
||||
'<'=285
|
||||
'=='=286
|
||||
'='=287
|
||||
'+='=288
|
||||
'-='=289
|
||||
'*='=290
|
||||
'/='=291
|
||||
'%='=292
|
||||
'!='=293
|
||||
'|'=294
|
||||
'('=295
|
||||
')'=296
|
||||
','=297
|
||||
';'=298
|
||||
'->'=299
|
||||
'['=300
|
||||
']'=301
|
||||
'?'=302
|
||||
':'=303
|
||||
'{'=304
|
||||
'}'=305
|
||||
'gather'=251
|
||||
'scatter'=252
|
||||
'scatter_add'=253
|
||||
'+'=276
|
||||
'-'=277
|
||||
'*'=278
|
||||
'/'=279
|
||||
'%'=280
|
||||
'^'=281
|
||||
'<<'=282
|
||||
'>>'=283
|
||||
'>='=284
|
||||
'>'=285
|
||||
'<='=286
|
||||
'<'=287
|
||||
'=='=288
|
||||
'='=289
|
||||
'+='=290
|
||||
'-='=291
|
||||
'*='=292
|
||||
'/='=293
|
||||
'%='=294
|
||||
'!='=295
|
||||
'|'=296
|
||||
'('=297
|
||||
')'=298
|
||||
','=299
|
||||
';'=300
|
||||
'->'=301
|
||||
'['=302
|
||||
']'=303
|
||||
'?'=304
|
||||
':'=305
|
||||
'{'=306
|
||||
'}'=307
|
||||
|
||||
@@ -638,6 +638,15 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#BooleanExp.
|
||||
def enterBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#BooleanExp.
|
||||
def exitBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#StringExp.
|
||||
def enterStringExp(self, ctx:MathExprParser.StringExpContext):
|
||||
pass
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -359,6 +359,11 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#BooleanExp.
|
||||
def visitBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#StringExp.
|
||||
def visitStringExp(self, ctx:MathExprParser.StringExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -245,71 +245,73 @@ CORR=244
|
||||
ENTROPY=245
|
||||
CROP=246
|
||||
NONE=247
|
||||
COORDS=248
|
||||
GATHER=249
|
||||
SCATTER=250
|
||||
SCATTER_ADD=251
|
||||
NOISE=252
|
||||
PINK_NOISE=253
|
||||
BROWN_NOISE=254
|
||||
RAND=255
|
||||
CAUCHY=256
|
||||
EXPONENTIAL=257
|
||||
LOGNORMAL=258
|
||||
BERNOULLI=259
|
||||
BINOMIALDIST=260
|
||||
POISSON=261
|
||||
GAMMADIST=262
|
||||
BETADIST=263
|
||||
LAPLACEDIST=264
|
||||
GUMBELDIST=265
|
||||
WEIBULLDIST=266
|
||||
CHI2DIST=267
|
||||
STUDENTTDIST=268
|
||||
PERLIN=269
|
||||
CELLULAR=270
|
||||
PLASMA=271
|
||||
RIDGED=272
|
||||
DOMAIN_WARP=273
|
||||
PLUS=274
|
||||
MINUS=275
|
||||
MULT=276
|
||||
DIV=277
|
||||
MOD=278
|
||||
POW=279
|
||||
LSHIFT=280
|
||||
RSHIFT=281
|
||||
GE=282
|
||||
GT=283
|
||||
LE=284
|
||||
LT=285
|
||||
EQ=286
|
||||
EQUEALS=287
|
||||
PLUS_EQ=288
|
||||
MINUS_EQ=289
|
||||
MULT_EQ=290
|
||||
DIV_EQ=291
|
||||
MOD_EQ=292
|
||||
NE=293
|
||||
PIPE=294
|
||||
LPAREN=295
|
||||
RPAREN=296
|
||||
COMMA=297
|
||||
SEMICOLON=298
|
||||
ARROW=299
|
||||
LBRACKET=300
|
||||
RBRACKET=301
|
||||
QUESTION=302
|
||||
COLON=303
|
||||
LBRACE=304
|
||||
RBRACE=305
|
||||
NUMBER=306
|
||||
CONSTANT=307
|
||||
STRING=308
|
||||
VARIABLE=309
|
||||
SL_COMMENT=310
|
||||
ML_COMMENT=311
|
||||
WS=312
|
||||
TRUE=248
|
||||
FALSE=249
|
||||
COORDS=250
|
||||
GATHER=251
|
||||
SCATTER=252
|
||||
SCATTER_ADD=253
|
||||
NOISE=254
|
||||
PINK_NOISE=255
|
||||
BROWN_NOISE=256
|
||||
RAND=257
|
||||
CAUCHY=258
|
||||
EXPONENTIAL=259
|
||||
LOGNORMAL=260
|
||||
BERNOULLI=261
|
||||
BINOMIALDIST=262
|
||||
POISSON=263
|
||||
GAMMADIST=264
|
||||
BETADIST=265
|
||||
LAPLACEDIST=266
|
||||
GUMBELDIST=267
|
||||
WEIBULLDIST=268
|
||||
CHI2DIST=269
|
||||
STUDENTTDIST=270
|
||||
PERLIN=271
|
||||
CELLULAR=272
|
||||
PLASMA=273
|
||||
RIDGED=274
|
||||
DOMAIN_WARP=275
|
||||
PLUS=276
|
||||
MINUS=277
|
||||
MULT=278
|
||||
DIV=279
|
||||
MOD=280
|
||||
POW=281
|
||||
LSHIFT=282
|
||||
RSHIFT=283
|
||||
GE=284
|
||||
GT=285
|
||||
LE=286
|
||||
LT=287
|
||||
EQ=288
|
||||
EQUEALS=289
|
||||
PLUS_EQ=290
|
||||
MINUS_EQ=291
|
||||
MULT_EQ=292
|
||||
DIV_EQ=293
|
||||
MOD_EQ=294
|
||||
NE=295
|
||||
PIPE=296
|
||||
LPAREN=297
|
||||
RPAREN=298
|
||||
COMMA=299
|
||||
SEMICOLON=300
|
||||
ARROW=301
|
||||
LBRACKET=302
|
||||
RBRACKET=303
|
||||
QUESTION=304
|
||||
COLON=305
|
||||
LBRACE=306
|
||||
RBRACE=307
|
||||
NUMBER=308
|
||||
CONSTANT=309
|
||||
STRING=310
|
||||
VARIABLE=311
|
||||
SL_COMMENT=312
|
||||
ML_COMMENT=313
|
||||
WS=314
|
||||
'sin'=1
|
||||
'cos'=2
|
||||
'tan'=3
|
||||
@@ -511,38 +513,38 @@ WS=312
|
||||
'cov'=243
|
||||
'entropy'=245
|
||||
'crop'=246
|
||||
'gather'=249
|
||||
'scatter'=250
|
||||
'scatter_add'=251
|
||||
'+'=274
|
||||
'-'=275
|
||||
'*'=276
|
||||
'/'=277
|
||||
'%'=278
|
||||
'^'=279
|
||||
'<<'=280
|
||||
'>>'=281
|
||||
'>='=282
|
||||
'>'=283
|
||||
'<='=284
|
||||
'<'=285
|
||||
'=='=286
|
||||
'='=287
|
||||
'+='=288
|
||||
'-='=289
|
||||
'*='=290
|
||||
'/='=291
|
||||
'%='=292
|
||||
'!='=293
|
||||
'|'=294
|
||||
'('=295
|
||||
')'=296
|
||||
','=297
|
||||
';'=298
|
||||
'->'=299
|
||||
'['=300
|
||||
']'=301
|
||||
'?'=302
|
||||
':'=303
|
||||
'{'=304
|
||||
'}'=305
|
||||
'gather'=251
|
||||
'scatter'=252
|
||||
'scatter_add'=253
|
||||
'+'=276
|
||||
'-'=277
|
||||
'*'=278
|
||||
'/'=279
|
||||
'%'=280
|
||||
'^'=281
|
||||
'<<'=282
|
||||
'>>'=283
|
||||
'>='=284
|
||||
'>'=285
|
||||
'<='=286
|
||||
'<'=287
|
||||
'=='=288
|
||||
'='=289
|
||||
'+='=290
|
||||
'-='=291
|
||||
'*='=292
|
||||
'/='=293
|
||||
'%='=294
|
||||
'!='=295
|
||||
'|'=296
|
||||
'('=297
|
||||
')'=298
|
||||
','=299
|
||||
';'=300
|
||||
'->'=301
|
||||
'['=302
|
||||
']'=303
|
||||
'?'=304
|
||||
':'=305
|
||||
'{'=306
|
||||
'}'=307
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -245,71 +245,73 @@ CORR=244
|
||||
ENTROPY=245
|
||||
CROP=246
|
||||
NONE=247
|
||||
COORDS=248
|
||||
GATHER=249
|
||||
SCATTER=250
|
||||
SCATTER_ADD=251
|
||||
NOISE=252
|
||||
PINK_NOISE=253
|
||||
BROWN_NOISE=254
|
||||
RAND=255
|
||||
CAUCHY=256
|
||||
EXPONENTIAL=257
|
||||
LOGNORMAL=258
|
||||
BERNOULLI=259
|
||||
BINOMIALDIST=260
|
||||
POISSON=261
|
||||
GAMMADIST=262
|
||||
BETADIST=263
|
||||
LAPLACEDIST=264
|
||||
GUMBELDIST=265
|
||||
WEIBULLDIST=266
|
||||
CHI2DIST=267
|
||||
STUDENTTDIST=268
|
||||
PERLIN=269
|
||||
CELLULAR=270
|
||||
PLASMA=271
|
||||
RIDGED=272
|
||||
DOMAIN_WARP=273
|
||||
PLUS=274
|
||||
MINUS=275
|
||||
MULT=276
|
||||
DIV=277
|
||||
MOD=278
|
||||
POW=279
|
||||
LSHIFT=280
|
||||
RSHIFT=281
|
||||
GE=282
|
||||
GT=283
|
||||
LE=284
|
||||
LT=285
|
||||
EQ=286
|
||||
EQUEALS=287
|
||||
PLUS_EQ=288
|
||||
MINUS_EQ=289
|
||||
MULT_EQ=290
|
||||
DIV_EQ=291
|
||||
MOD_EQ=292
|
||||
NE=293
|
||||
PIPE=294
|
||||
LPAREN=295
|
||||
RPAREN=296
|
||||
COMMA=297
|
||||
SEMICOLON=298
|
||||
ARROW=299
|
||||
LBRACKET=300
|
||||
RBRACKET=301
|
||||
QUESTION=302
|
||||
COLON=303
|
||||
LBRACE=304
|
||||
RBRACE=305
|
||||
NUMBER=306
|
||||
CONSTANT=307
|
||||
STRING=308
|
||||
VARIABLE=309
|
||||
SL_COMMENT=310
|
||||
ML_COMMENT=311
|
||||
WS=312
|
||||
TRUE=248
|
||||
FALSE=249
|
||||
COORDS=250
|
||||
GATHER=251
|
||||
SCATTER=252
|
||||
SCATTER_ADD=253
|
||||
NOISE=254
|
||||
PINK_NOISE=255
|
||||
BROWN_NOISE=256
|
||||
RAND=257
|
||||
CAUCHY=258
|
||||
EXPONENTIAL=259
|
||||
LOGNORMAL=260
|
||||
BERNOULLI=261
|
||||
BINOMIALDIST=262
|
||||
POISSON=263
|
||||
GAMMADIST=264
|
||||
BETADIST=265
|
||||
LAPLACEDIST=266
|
||||
GUMBELDIST=267
|
||||
WEIBULLDIST=268
|
||||
CHI2DIST=269
|
||||
STUDENTTDIST=270
|
||||
PERLIN=271
|
||||
CELLULAR=272
|
||||
PLASMA=273
|
||||
RIDGED=274
|
||||
DOMAIN_WARP=275
|
||||
PLUS=276
|
||||
MINUS=277
|
||||
MULT=278
|
||||
DIV=279
|
||||
MOD=280
|
||||
POW=281
|
||||
LSHIFT=282
|
||||
RSHIFT=283
|
||||
GE=284
|
||||
GT=285
|
||||
LE=286
|
||||
LT=287
|
||||
EQ=288
|
||||
EQUEALS=289
|
||||
PLUS_EQ=290
|
||||
MINUS_EQ=291
|
||||
MULT_EQ=292
|
||||
DIV_EQ=293
|
||||
MOD_EQ=294
|
||||
NE=295
|
||||
PIPE=296
|
||||
LPAREN=297
|
||||
RPAREN=298
|
||||
COMMA=299
|
||||
SEMICOLON=300
|
||||
ARROW=301
|
||||
LBRACKET=302
|
||||
RBRACKET=303
|
||||
QUESTION=304
|
||||
COLON=305
|
||||
LBRACE=306
|
||||
RBRACE=307
|
||||
NUMBER=308
|
||||
CONSTANT=309
|
||||
STRING=310
|
||||
VARIABLE=311
|
||||
SL_COMMENT=312
|
||||
ML_COMMENT=313
|
||||
WS=314
|
||||
'sin'=1
|
||||
'cos'=2
|
||||
'tan'=3
|
||||
@@ -511,38 +513,38 @@ WS=312
|
||||
'cov'=243
|
||||
'entropy'=245
|
||||
'crop'=246
|
||||
'gather'=249
|
||||
'scatter'=250
|
||||
'scatter_add'=251
|
||||
'+'=274
|
||||
'-'=275
|
||||
'*'=276
|
||||
'/'=277
|
||||
'%'=278
|
||||
'^'=279
|
||||
'<<'=280
|
||||
'>>'=281
|
||||
'>='=282
|
||||
'>'=283
|
||||
'<='=284
|
||||
'<'=285
|
||||
'=='=286
|
||||
'='=287
|
||||
'+='=288
|
||||
'-='=289
|
||||
'*='=290
|
||||
'/='=291
|
||||
'%='=292
|
||||
'!='=293
|
||||
'|'=294
|
||||
'('=295
|
||||
')'=296
|
||||
','=297
|
||||
';'=298
|
||||
'->'=299
|
||||
'['=300
|
||||
']'=301
|
||||
'?'=302
|
||||
':'=303
|
||||
'{'=304
|
||||
'}'=305
|
||||
'gather'=251
|
||||
'scatter'=252
|
||||
'scatter_add'=253
|
||||
'+'=276
|
||||
'-'=277
|
||||
'*'=278
|
||||
'/'=279
|
||||
'%'=280
|
||||
'^'=281
|
||||
'<<'=282
|
||||
'>>'=283
|
||||
'>='=284
|
||||
'>'=285
|
||||
'<='=286
|
||||
'<'=287
|
||||
'=='=288
|
||||
'='=289
|
||||
'+='=290
|
||||
'-='=291
|
||||
'*='=292
|
||||
'/='=293
|
||||
'%='=294
|
||||
'!='=295
|
||||
'|'=296
|
||||
'('=297
|
||||
')'=298
|
||||
','=299
|
||||
';'=300
|
||||
'->'=301
|
||||
'['=302
|
||||
']'=303
|
||||
'?'=304
|
||||
':'=305
|
||||
'{'=306
|
||||
'}'=307
|
||||
|
||||
@@ -638,6 +638,15 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#BooleanExp.
|
||||
def enterBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#BooleanExp.
|
||||
def exitBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#StringExp.
|
||||
def enterStringExp(self, ctx:MathExprParser.StringExpContext):
|
||||
pass
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -359,6 +359,11 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#BooleanExp.
|
||||
def visitBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#StringExp.
|
||||
def visitStringExp(self, ctx:MathExprParser.StringExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Generated automatically by compile.ps1. Do not edit.
|
||||
INBUILT_KEYWORDS = {
|
||||
'break', 'continue', 'else', 'for', 'if', 'in', 'none', 'None', 'null', 'NULL', 'return', 'while'
|
||||
'break', 'continue', 'else', 'false', 'False', 'FALSE', 'for', 'if', 'in', 'none', 'None', 'null', 'NULL', 'return', 'true', 'True', 'TRUE', 'while'
|
||||
}
|
||||
INBUILT_CONSTANTS = {
|
||||
'e', 'E', 'pi', 'PI'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Generated automatically by compile.ps1. Do not edit.
|
||||
|
||||
export const KEYWORDS = new Set([
|
||||
"break", "continue", "else", "for", "if", "in", "none", "None", "null", "NULL", "return", "while"
|
||||
"break", "continue", "else", "false", "False", "FALSE", "for", "if", "in", "none", "None", "null", "NULL", "return", "true", "True", "TRUE", "while"
|
||||
]);
|
||||
|
||||
export const CONSTANTS = new Set([
|
||||
|
||||
Reference in New Issue
Block a user