AI: added usefull things like passing multiple values
This commit is contained in:
@@ -20,12 +20,18 @@ funcDef:
|
||||
VARIABLE LPAREN paramList? RPAREN ARROW (expr | block) SEMICOLON # FunctionDef;
|
||||
|
||||
varDef:
|
||||
VARIABLE (LBRACKET expr (COMMA expr)* RBRACKET)* (EQUEALS | PLUS_EQ | MINUS_EQ | MULT_EQ | DIV_EQ | MOD_EQ) expr SEMICOLON;
|
||||
destructureTarget assignmentOperator expr SEMICOLON
|
||||
| VARIABLE (LBRACKET expr (COMMA expr)* RBRACKET)* assignmentOperator expr SEMICOLON;
|
||||
|
||||
destructureTarget: LBRACKET variableList RBRACKET;
|
||||
variableList: VARIABLE (COMMA VARIABLE)+;
|
||||
assignmentOperator: EQUEALS | PLUS_EQ | MINUS_EQ | MULT_EQ | DIV_EQ | MOD_EQ;
|
||||
|
||||
paramList: VARIABLE (COMMA VARIABLE)*;
|
||||
|
||||
stmt:
|
||||
ifStmt # IfStatement
|
||||
| funcDef # FunctionDefStatement
|
||||
| whileStmt # WhileStatement
|
||||
| block # BlockStatement
|
||||
| breakStmt # BreakStatement
|
||||
@@ -35,9 +41,9 @@ stmt:
|
||||
| forStmt # ForStatement
|
||||
| expr SEMICOLON # ExprStatement;
|
||||
|
||||
ifStmt: IF LPAREN expr RPAREN stmt (ELSE stmt)?;
|
||||
ifStmt: IF LPAREN expr RPAREN stmt (ELIF LPAREN expr RPAREN stmt)* (ELSE stmt)?;
|
||||
whileStmt: WHILE LPAREN expr RPAREN stmt;
|
||||
forStmt: FOR LPAREN VARIABLE IN expr RPAREN stmt;
|
||||
forStmt: FOR LPAREN (VARIABLE | LBRACKET variableList RBRACKET) IN expr RPAREN stmt;
|
||||
block: LBRACE stmt* RBRACE;
|
||||
|
||||
dictEntryList: dictEntry (COMMA dictEntry)*;
|
||||
@@ -51,7 +57,9 @@ continueStmt: CONTINUE SEMICOLON;
|
||||
returnStmt: RETURN expr? SEMICOLON;
|
||||
|
||||
// A lambda binds loosest, so its body takes the whole following expression, ternaries included.
|
||||
expr: lambdaExpr | ternaryExpr | compExpr;
|
||||
expr: lambdaExpr | assignmentExpr | ternaryExpr | compExpr;
|
||||
|
||||
assignmentExpr: (VARIABLE | destructureTarget) assignmentOperator expr;
|
||||
|
||||
lambdaExpr: LPAREN paramList? RPAREN ARROW (expr | block) # LambdaExp;
|
||||
|
||||
@@ -77,6 +85,7 @@ addExpr:
|
||||
mulExpr:
|
||||
mulExpr MULT unaryExpr # MulExp
|
||||
| mulExpr DIV unaryExpr # DivExp
|
||||
| mulExpr FLOOR_DIV unaryExpr # FloorDivExp
|
||||
| mulExpr MOD unaryExpr # ModExp
|
||||
| unaryExpr # ToPow;
|
||||
|
||||
@@ -90,6 +99,8 @@ powExpr: indexExpr POW unaryExpr # PowExp | indexExpr # ToUnary;
|
||||
unaryExpr:
|
||||
PLUS unaryExpr # UnaryPlus
|
||||
| MINUS unaryExpr # UnaryMinus
|
||||
| INC VARIABLE # PreIncrement
|
||||
| DEC VARIABLE # PreDecrement
|
||||
| powExpr # ToIndex;
|
||||
|
||||
indexExpr:
|
||||
@@ -117,9 +128,13 @@ atom:
|
||||
| func5 # Func5Exp
|
||||
| funcN # FuncNExp
|
||||
| funcNoise # FuncNoiseExp
|
||||
| VARIABLE INC # PostIncrement
|
||||
| VARIABLE DEC # PostDecrement
|
||||
| VARIABLE # VariableExp
|
||||
| NUMBER # NumberExp
|
||||
| CONSTANT # ConstantExp
|
||||
| NAN # NanExp
|
||||
| INF # InfExp
|
||||
| TRUE # BooleanExp
|
||||
| FALSE # BooleanExp
|
||||
| STRING # StringExp
|
||||
@@ -2037,6 +2052,7 @@ SVD: 'svd'|'singular_value_decomposition';
|
||||
DIAG: 'diagonal_matrix'|'diag';
|
||||
|
||||
IF: 'if';
|
||||
ELIF: 'elif';
|
||||
ELSE: 'else';
|
||||
WHILE: 'while';
|
||||
FOR: 'for';
|
||||
@@ -2098,6 +2114,9 @@ MINUS: '-';
|
||||
MULT: '*';
|
||||
DIV: '/';
|
||||
MOD: '%';
|
||||
FLOOR_DIV: '//';
|
||||
INC: '++';
|
||||
DEC: '--';
|
||||
POW: '^';
|
||||
LSHIFT: '<<';
|
||||
RSHIFT: '>>';
|
||||
@@ -2127,8 +2146,10 @@ COLON: ':';
|
||||
LBRACE: '{';
|
||||
RBRACE: '}';
|
||||
|
||||
NUMBER: ([0-9]+ ('.' [0-9]*)? | '.' [0-9]+) ([eE][+-]? [0-9]+)?;
|
||||
NUMBER: ('0' [xX] [0-9a-fA-F] ('_'? [0-9a-fA-F])* | '0' [bB] [01] ('_'? [01])* | [0-9] ('_'? [0-9])* ('.' [0-9] ('_'? [0-9])*)? | '.' [0-9] ('_'? [0-9])*) ([eE][+-]? [0-9] ('_'? [0-9])*)?;
|
||||
CONSTANT: ('pi' | 'PI' | 'e' | 'E');
|
||||
NAN: 'nan' | 'NaN' | 'NAN';
|
||||
INF: 'inf' | 'Inf' | 'INF' | 'infinity' | 'Infinity' | 'INFINITY';
|
||||
STRING: '"' (~["\\\r\n] | '\\' .)* '"'
|
||||
| '\'' (~['\\\r\n] | '\\' .)* '\''
|
||||
;
|
||||
|
||||
@@ -802,7 +802,16 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
# ========================
|
||||
|
||||
def visitNumberExp(self, ctx):
|
||||
return float(ctx.NUMBER().getText())
|
||||
text = ctx.NUMBER().getText().replace("_", "")
|
||||
if text.lower().startswith(("0x", "0b")):
|
||||
return float(int(text, 0))
|
||||
return float(text)
|
||||
|
||||
def visitNanExp(self, ctx):
|
||||
return float("nan")
|
||||
|
||||
def visitInfExp(self, ctx):
|
||||
return float("inf")
|
||||
|
||||
def visitConstantExp(self, ctx):
|
||||
val = ctx.CONSTANT().getText().lower()
|
||||
@@ -1124,6 +1133,11 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
b = yield ctx.unaryExpr()
|
||||
return self._bin_op(a, b, torch.div, lambda a, b: a / b, ctx)
|
||||
|
||||
def visitFloorDivExp(self, ctx):
|
||||
a = yield ctx.mulExpr()
|
||||
b = yield ctx.unaryExpr()
|
||||
return self._bin_op(a, b, lambda x, y: torch.floor(torch.div(x, y)), lambda x, y: math.floor(x / y), ctx)
|
||||
|
||||
def visitModExp(self, ctx):
|
||||
a = yield ctx.mulExpr()
|
||||
b = yield ctx.unaryExpr()
|
||||
@@ -3230,6 +3244,7 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
|
||||
def visitBlock(self, ctx):
|
||||
vars_before = set(self.variables.keys())
|
||||
functions_before = set(self.functions.keys())
|
||||
try:
|
||||
val = None
|
||||
for stmt in ctx.stmt():
|
||||
@@ -3238,17 +3253,23 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
finally:
|
||||
for v in set(self.variables.keys()) - vars_before:
|
||||
del self.variables[v]
|
||||
for name in set(self.functions.keys()) - functions_before:
|
||||
del self.functions[name]
|
||||
|
||||
def visitIfStatement(self, ctx):
|
||||
return (yield ctx.ifStmt())
|
||||
|
||||
def visitIfStmt(self, ctx):
|
||||
cond = yield ctx.expr()
|
||||
def visitFunctionDefStatement(self, ctx):
|
||||
return (yield ctx.funcDef())
|
||||
|
||||
if self._truthy(cond):
|
||||
return (yield ctx.stmt(0))
|
||||
elif ctx.stmt(1):
|
||||
return (yield ctx.stmt(1))
|
||||
def visitIfStmt(self, ctx):
|
||||
conditions = ctx.expr()
|
||||
bodies = ctx.stmt()
|
||||
for index, condition in enumerate(conditions):
|
||||
if self._truthy((yield condition)):
|
||||
return (yield bodies[index])
|
||||
if len(bodies) > len(conditions):
|
||||
return (yield bodies[-1])
|
||||
return None
|
||||
|
||||
def visitWhileStmt(self, ctx):
|
||||
@@ -3265,7 +3286,10 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
return None
|
||||
|
||||
def visitForStmt(self, ctx):
|
||||
var_name = ctx.VARIABLE().getText()
|
||||
if ctx.variableList():
|
||||
var_names = [node.getText() for node in ctx.variableList().VARIABLE()]
|
||||
else:
|
||||
var_names = [ctx.VARIABLE().getText()]
|
||||
iterable = yield ctx.expr()
|
||||
|
||||
iterator = []
|
||||
@@ -3281,7 +3305,13 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
|
||||
for val in iterator:
|
||||
throw_exception_if_processing_interrupted()
|
||||
self.variables[var_name] = val
|
||||
if len(var_names) == 1:
|
||||
self.variables[var_names[0]] = val
|
||||
else:
|
||||
if not self._is_list(val) or len(val) != len(var_names):
|
||||
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: cannot unpack loop value into {len(var_names)} variables")
|
||||
for name, item in zip(var_names, val):
|
||||
self.variables[name] = item
|
||||
try:
|
||||
yield ctx.stmt()
|
||||
except BreakSignal:
|
||||
@@ -3305,10 +3335,27 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
return ReturnSignal(val)
|
||||
|
||||
def visitVarDef(self, ctx):
|
||||
var_name = ctx.VARIABLE().getText()
|
||||
expr_list = ctx.expr()
|
||||
assign_op = ctx.assignmentOperator().getText()
|
||||
|
||||
assign_op = "="
|
||||
if ctx.destructureTarget():
|
||||
value = yield expr_list[0]
|
||||
names = [node.getText() for node in ctx.destructureTarget().variableList().VARIABLE()]
|
||||
if assign_op != "=":
|
||||
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: compound assignment is not supported for destructuring")
|
||||
if not self._is_list(value) or len(value) != len(names):
|
||||
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: cannot unpack value into {len(names)} variables")
|
||||
for name, item in zip(names, value):
|
||||
self.variables[name] = item
|
||||
return value
|
||||
|
||||
var_name = ctx.VARIABLE().getText()
|
||||
|
||||
if not ctx.assignmentOperator():
|
||||
assign_op = "="
|
||||
|
||||
if assign_op == "=":
|
||||
pass
|
||||
if getattr(ctx, "PLUS_EQ", lambda: None)() is not None: assign_op = "+="
|
||||
elif getattr(ctx, "MINUS_EQ", lambda: None)() is not None: assign_op = "-="
|
||||
elif getattr(ctx, "MULT_EQ", lambda: None)() is not None: assign_op = "*="
|
||||
@@ -3461,6 +3508,53 @@ class UnifiedMathVisitor(MathExprVisitor):
|
||||
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: Indexed assignment not supported for {type(target)}")
|
||||
|
||||
|
||||
def visitAssignmentExpr(self, ctx):
|
||||
assign_op = ctx.assignmentOperator().getText()
|
||||
value = yield ctx.expr()
|
||||
if ctx.destructureTarget():
|
||||
names = [node.getText() for node in ctx.destructureTarget().variableList().VARIABLE()]
|
||||
if assign_op != "=" or not self._is_list(value) or len(value) != len(names):
|
||||
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: invalid destructuring assignment")
|
||||
for name, item in zip(names, value):
|
||||
self.variables[name] = item
|
||||
return value
|
||||
|
||||
name = ctx.VARIABLE().getText()
|
||||
if assign_op != "=" and name not in self.variables:
|
||||
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: Variable '{name}' not defined for compound assignment.")
|
||||
if assign_op == "+=":
|
||||
value = self._bin_op(self.variables[name], value, torch.add, lambda a, b: a + b, ctx)
|
||||
elif assign_op == "-=":
|
||||
value = self._bin_op(self.variables[name], value, torch.sub, lambda a, b: a - b, ctx)
|
||||
elif assign_op == "*=":
|
||||
value = self._bin_op(self.variables[name], value, torch.mul, lambda a, b: a * b, ctx)
|
||||
elif assign_op == "/=":
|
||||
value = self._bin_op(self.variables[name], value, torch.div, lambda a, b: a / b, ctx)
|
||||
elif assign_op == "%=":
|
||||
value = self._bin_op(self.variables[name], value, torch.remainder, lambda a, b: a % b, ctx)
|
||||
self.variables[name] = value
|
||||
return value
|
||||
|
||||
def _increment(self, name, delta, ctx):
|
||||
if name not in self.variables:
|
||||
raise ValueError(f"{ctx.start.line}:{ctx.start.column}: Variable '{name}' not found")
|
||||
old = self.variables[name]
|
||||
new = self._bin_op(old, float(delta), torch.add, lambda a, b: a + b, ctx)
|
||||
self.variables[name] = new
|
||||
return old, new
|
||||
|
||||
def visitPreIncrement(self, ctx):
|
||||
return self._increment(ctx.VARIABLE().getText(), 1, ctx)[1]
|
||||
|
||||
def visitPreDecrement(self, ctx):
|
||||
return self._increment(ctx.VARIABLE().getText(), -1, ctx)[1]
|
||||
|
||||
def visitPostIncrement(self, ctx):
|
||||
return self._increment(ctx.VARIABLE().getText(), 1, ctx)[0]
|
||||
|
||||
def visitPostDecrement(self, ctx):
|
||||
return self._increment(ctx.VARIABLE().getText(), -1, ctx)[0]
|
||||
|
||||
def visitFunctionDef(self, ctx):
|
||||
func_name = ctx.VARIABLE().getText()
|
||||
params = []
|
||||
|
||||
@@ -33,10 +33,14 @@ class _DeadCode:
|
||||
if isinstance(n, TerminalNode):
|
||||
continue
|
||||
if isinstance(n, P.VarDefContext):
|
||||
if n.EQUEALS() and not n.LBRACKET():
|
||||
if n.destructureTarget() is None and not n.LBRACKET() and n.assignmentOperator().getText() == "=":
|
||||
assignments.append((n.VARIABLE().getText(), n.expr(0)))
|
||||
elif isinstance(n, P.ForStmtContext):
|
||||
self.unknown.add(n.VARIABLE().getText())
|
||||
if n.VARIABLE():
|
||||
self.unknown.add(n.VARIABLE().getText())
|
||||
elif n.destructureTarget():
|
||||
for variable in n.destructureTarget().variableList().VARIABLE():
|
||||
self.unknown.add(variable.getText())
|
||||
elif isinstance(n, P.FunctionDefContext):
|
||||
self.defs.setdefault(n.VARIABLE().getText(), []).append((_params(n), n.block() or n.expr()))
|
||||
elif isinstance(n, P.LambdaExpContext):
|
||||
@@ -129,6 +133,9 @@ class _DeadCode:
|
||||
todo = [node]
|
||||
while todo:
|
||||
n = todo.pop()
|
||||
if isinstance(n, list):
|
||||
todo.extend(n)
|
||||
continue
|
||||
if isinstance(n, TerminalNode):
|
||||
t = n.getSymbol().type
|
||||
if t == P.VARIABLE:
|
||||
@@ -165,13 +172,16 @@ class _DeadCode:
|
||||
if isinstance(node, P.VarDefStmtContext):
|
||||
node = node.varDef()
|
||||
if isinstance(node, P.VarDefContext):
|
||||
name = node.VARIABLE().getText()
|
||||
reads, effect = set(), False
|
||||
for e in node.expr():
|
||||
r, eff = self.scan(e)
|
||||
reads |= r
|
||||
effect |= eff
|
||||
if node.EQUEALS() and not node.LBRACKET():
|
||||
if node.destructureTarget():
|
||||
names = {variable.getText() for variable in node.destructureTarget().variableList().VARIABLE()}
|
||||
return (live - names) | reads, not (live & names) and not effect
|
||||
name = node.VARIABLE().getText()
|
||||
if not node.LBRACKET() and node.assignmentOperator().getText() == "=":
|
||||
before = (live - {name}) | reads
|
||||
else:
|
||||
before = live | {name} | reads
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -219,99 +219,105 @@ AS_NESTED=218
|
||||
SVD=219
|
||||
DIAG=220
|
||||
IF=221
|
||||
ELSE=222
|
||||
WHILE=223
|
||||
FOR=224
|
||||
IN=225
|
||||
BREAK=226
|
||||
CONTINUE=227
|
||||
RETURN=228
|
||||
TIMESTAMP=229
|
||||
SORT=230
|
||||
ARGSORT=231
|
||||
ARGMIN=232
|
||||
ARGMAX=233
|
||||
SOFTMAX=234
|
||||
SOFTMIN=235
|
||||
UNIQUE=236
|
||||
FLIP=237
|
||||
STARTSWITH=238
|
||||
ENDSWITH=239
|
||||
SQUEEZE=240
|
||||
UNSQUEEZE=241
|
||||
ROLL=242
|
||||
COV=243
|
||||
CORR=244
|
||||
ENTROPY=245
|
||||
CROP=246
|
||||
NONE=247
|
||||
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
|
||||
ELIF=222
|
||||
ELSE=223
|
||||
WHILE=224
|
||||
FOR=225
|
||||
IN=226
|
||||
BREAK=227
|
||||
CONTINUE=228
|
||||
RETURN=229
|
||||
TIMESTAMP=230
|
||||
SORT=231
|
||||
ARGSORT=232
|
||||
ARGMIN=233
|
||||
ARGMAX=234
|
||||
SOFTMAX=235
|
||||
SOFTMIN=236
|
||||
UNIQUE=237
|
||||
FLIP=238
|
||||
STARTSWITH=239
|
||||
ENDSWITH=240
|
||||
SQUEEZE=241
|
||||
UNSQUEEZE=242
|
||||
ROLL=243
|
||||
COV=244
|
||||
CORR=245
|
||||
ENTROPY=246
|
||||
CROP=247
|
||||
NONE=248
|
||||
TRUE=249
|
||||
FALSE=250
|
||||
COORDS=251
|
||||
GATHER=252
|
||||
SCATTER=253
|
||||
SCATTER_ADD=254
|
||||
NOISE=255
|
||||
PINK_NOISE=256
|
||||
BROWN_NOISE=257
|
||||
RAND=258
|
||||
CAUCHY=259
|
||||
EXPONENTIAL=260
|
||||
LOGNORMAL=261
|
||||
BERNOULLI=262
|
||||
BINOMIALDIST=263
|
||||
POISSON=264
|
||||
GAMMADIST=265
|
||||
BETADIST=266
|
||||
LAPLACEDIST=267
|
||||
GUMBELDIST=268
|
||||
WEIBULLDIST=269
|
||||
CHI2DIST=270
|
||||
STUDENTTDIST=271
|
||||
PERLIN=272
|
||||
CELLULAR=273
|
||||
PLASMA=274
|
||||
RIDGED=275
|
||||
DOMAIN_WARP=276
|
||||
PLUS=277
|
||||
MINUS=278
|
||||
MULT=279
|
||||
DIV=280
|
||||
MOD=281
|
||||
FLOOR_DIV=282
|
||||
INC=283
|
||||
DEC=284
|
||||
POW=285
|
||||
LSHIFT=286
|
||||
RSHIFT=287
|
||||
GE=288
|
||||
GT=289
|
||||
LE=290
|
||||
LT=291
|
||||
EQ=292
|
||||
EQUEALS=293
|
||||
PLUS_EQ=294
|
||||
MINUS_EQ=295
|
||||
MULT_EQ=296
|
||||
DIV_EQ=297
|
||||
MOD_EQ=298
|
||||
NE=299
|
||||
PIPE=300
|
||||
LPAREN=301
|
||||
RPAREN=302
|
||||
COMMA=303
|
||||
SEMICOLON=304
|
||||
ARROW=305
|
||||
LBRACKET=306
|
||||
RBRACKET=307
|
||||
QUESTION=308
|
||||
COLON=309
|
||||
LBRACE=310
|
||||
RBRACE=311
|
||||
NUMBER=312
|
||||
CONSTANT=313
|
||||
NAN=314
|
||||
INF=315
|
||||
STRING=316
|
||||
VARIABLE=317
|
||||
SL_COMMENT=318
|
||||
ML_COMMENT=319
|
||||
WS=320
|
||||
'sin'=1
|
||||
'cos'=2
|
||||
'tan'=3
|
||||
@@ -490,61 +496,65 @@ WS=314
|
||||
'interpolate_area'=215
|
||||
'text_image'=217
|
||||
'if'=221
|
||||
'else'=222
|
||||
'while'=223
|
||||
'for'=224
|
||||
'in'=225
|
||||
'break'=226
|
||||
'continue'=227
|
||||
'return'=228
|
||||
'sort'=230
|
||||
'argsort'=231
|
||||
'argmin'=232
|
||||
'argmax'=233
|
||||
'softmax'=234
|
||||
'softmin'=235
|
||||
'unique'=236
|
||||
'flip'=237
|
||||
'startswith'=238
|
||||
'endswith'=239
|
||||
'squeeze'=240
|
||||
'unsqueeze'=241
|
||||
'roll'=242
|
||||
'cov'=243
|
||||
'entropy'=245
|
||||
'crop'=246
|
||||
'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
|
||||
'elif'=222
|
||||
'else'=223
|
||||
'while'=224
|
||||
'for'=225
|
||||
'in'=226
|
||||
'break'=227
|
||||
'continue'=228
|
||||
'return'=229
|
||||
'sort'=231
|
||||
'argsort'=232
|
||||
'argmin'=233
|
||||
'argmax'=234
|
||||
'softmax'=235
|
||||
'softmin'=236
|
||||
'unique'=237
|
||||
'flip'=238
|
||||
'startswith'=239
|
||||
'endswith'=240
|
||||
'squeeze'=241
|
||||
'unsqueeze'=242
|
||||
'roll'=243
|
||||
'cov'=244
|
||||
'entropy'=246
|
||||
'crop'=247
|
||||
'gather'=252
|
||||
'scatter'=253
|
||||
'scatter_add'=254
|
||||
'+'=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
|
||||
'?'=308
|
||||
':'=309
|
||||
'{'=310
|
||||
'}'=311
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -219,99 +219,105 @@ AS_NESTED=218
|
||||
SVD=219
|
||||
DIAG=220
|
||||
IF=221
|
||||
ELSE=222
|
||||
WHILE=223
|
||||
FOR=224
|
||||
IN=225
|
||||
BREAK=226
|
||||
CONTINUE=227
|
||||
RETURN=228
|
||||
TIMESTAMP=229
|
||||
SORT=230
|
||||
ARGSORT=231
|
||||
ARGMIN=232
|
||||
ARGMAX=233
|
||||
SOFTMAX=234
|
||||
SOFTMIN=235
|
||||
UNIQUE=236
|
||||
FLIP=237
|
||||
STARTSWITH=238
|
||||
ENDSWITH=239
|
||||
SQUEEZE=240
|
||||
UNSQUEEZE=241
|
||||
ROLL=242
|
||||
COV=243
|
||||
CORR=244
|
||||
ENTROPY=245
|
||||
CROP=246
|
||||
NONE=247
|
||||
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
|
||||
ELIF=222
|
||||
ELSE=223
|
||||
WHILE=224
|
||||
FOR=225
|
||||
IN=226
|
||||
BREAK=227
|
||||
CONTINUE=228
|
||||
RETURN=229
|
||||
TIMESTAMP=230
|
||||
SORT=231
|
||||
ARGSORT=232
|
||||
ARGMIN=233
|
||||
ARGMAX=234
|
||||
SOFTMAX=235
|
||||
SOFTMIN=236
|
||||
UNIQUE=237
|
||||
FLIP=238
|
||||
STARTSWITH=239
|
||||
ENDSWITH=240
|
||||
SQUEEZE=241
|
||||
UNSQUEEZE=242
|
||||
ROLL=243
|
||||
COV=244
|
||||
CORR=245
|
||||
ENTROPY=246
|
||||
CROP=247
|
||||
NONE=248
|
||||
TRUE=249
|
||||
FALSE=250
|
||||
COORDS=251
|
||||
GATHER=252
|
||||
SCATTER=253
|
||||
SCATTER_ADD=254
|
||||
NOISE=255
|
||||
PINK_NOISE=256
|
||||
BROWN_NOISE=257
|
||||
RAND=258
|
||||
CAUCHY=259
|
||||
EXPONENTIAL=260
|
||||
LOGNORMAL=261
|
||||
BERNOULLI=262
|
||||
BINOMIALDIST=263
|
||||
POISSON=264
|
||||
GAMMADIST=265
|
||||
BETADIST=266
|
||||
LAPLACEDIST=267
|
||||
GUMBELDIST=268
|
||||
WEIBULLDIST=269
|
||||
CHI2DIST=270
|
||||
STUDENTTDIST=271
|
||||
PERLIN=272
|
||||
CELLULAR=273
|
||||
PLASMA=274
|
||||
RIDGED=275
|
||||
DOMAIN_WARP=276
|
||||
PLUS=277
|
||||
MINUS=278
|
||||
MULT=279
|
||||
DIV=280
|
||||
MOD=281
|
||||
FLOOR_DIV=282
|
||||
INC=283
|
||||
DEC=284
|
||||
POW=285
|
||||
LSHIFT=286
|
||||
RSHIFT=287
|
||||
GE=288
|
||||
GT=289
|
||||
LE=290
|
||||
LT=291
|
||||
EQ=292
|
||||
EQUEALS=293
|
||||
PLUS_EQ=294
|
||||
MINUS_EQ=295
|
||||
MULT_EQ=296
|
||||
DIV_EQ=297
|
||||
MOD_EQ=298
|
||||
NE=299
|
||||
PIPE=300
|
||||
LPAREN=301
|
||||
RPAREN=302
|
||||
COMMA=303
|
||||
SEMICOLON=304
|
||||
ARROW=305
|
||||
LBRACKET=306
|
||||
RBRACKET=307
|
||||
QUESTION=308
|
||||
COLON=309
|
||||
LBRACE=310
|
||||
RBRACE=311
|
||||
NUMBER=312
|
||||
CONSTANT=313
|
||||
NAN=314
|
||||
INF=315
|
||||
STRING=316
|
||||
VARIABLE=317
|
||||
SL_COMMENT=318
|
||||
ML_COMMENT=319
|
||||
WS=320
|
||||
'sin'=1
|
||||
'cos'=2
|
||||
'tan'=3
|
||||
@@ -490,61 +496,65 @@ WS=314
|
||||
'interpolate_area'=215
|
||||
'text_image'=217
|
||||
'if'=221
|
||||
'else'=222
|
||||
'while'=223
|
||||
'for'=224
|
||||
'in'=225
|
||||
'break'=226
|
||||
'continue'=227
|
||||
'return'=228
|
||||
'sort'=230
|
||||
'argsort'=231
|
||||
'argmin'=232
|
||||
'argmax'=233
|
||||
'softmax'=234
|
||||
'softmin'=235
|
||||
'unique'=236
|
||||
'flip'=237
|
||||
'startswith'=238
|
||||
'endswith'=239
|
||||
'squeeze'=240
|
||||
'unsqueeze'=241
|
||||
'roll'=242
|
||||
'cov'=243
|
||||
'entropy'=245
|
||||
'crop'=246
|
||||
'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
|
||||
'elif'=222
|
||||
'else'=223
|
||||
'while'=224
|
||||
'for'=225
|
||||
'in'=226
|
||||
'break'=227
|
||||
'continue'=228
|
||||
'return'=229
|
||||
'sort'=231
|
||||
'argsort'=232
|
||||
'argmin'=233
|
||||
'argmax'=234
|
||||
'softmax'=235
|
||||
'softmin'=236
|
||||
'unique'=237
|
||||
'flip'=238
|
||||
'startswith'=239
|
||||
'endswith'=240
|
||||
'squeeze'=241
|
||||
'unsqueeze'=242
|
||||
'roll'=243
|
||||
'cov'=244
|
||||
'entropy'=246
|
||||
'crop'=247
|
||||
'gather'=252
|
||||
'scatter'=253
|
||||
'scatter_add'=254
|
||||
'+'=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
|
||||
'?'=308
|
||||
':'=309
|
||||
'{'=310
|
||||
'}'=311
|
||||
|
||||
@@ -35,6 +35,33 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#destructureTarget.
|
||||
def enterDestructureTarget(self, ctx:MathExprParser.DestructureTargetContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#destructureTarget.
|
||||
def exitDestructureTarget(self, ctx:MathExprParser.DestructureTargetContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#variableList.
|
||||
def enterVariableList(self, ctx:MathExprParser.VariableListContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#variableList.
|
||||
def exitVariableList(self, ctx:MathExprParser.VariableListContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#assignmentOperator.
|
||||
def enterAssignmentOperator(self, ctx:MathExprParser.AssignmentOperatorContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#assignmentOperator.
|
||||
def exitAssignmentOperator(self, ctx:MathExprParser.AssignmentOperatorContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#paramList.
|
||||
def enterParamList(self, ctx:MathExprParser.ParamListContext):
|
||||
pass
|
||||
@@ -53,6 +80,15 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#FunctionDefStatement.
|
||||
def enterFunctionDefStatement(self, ctx:MathExprParser.FunctionDefStatementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#FunctionDefStatement.
|
||||
def exitFunctionDefStatement(self, ctx:MathExprParser.FunctionDefStatementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#WhileStatement.
|
||||
def enterWhileStatement(self, ctx:MathExprParser.WhileStatementContext):
|
||||
pass
|
||||
@@ -215,6 +251,15 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#assignmentExpr.
|
||||
def enterAssignmentExpr(self, ctx:MathExprParser.AssignmentExprContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#assignmentExpr.
|
||||
def exitAssignmentExpr(self, ctx:MathExprParser.AssignmentExprContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#LambdaExp.
|
||||
def enterLambdaExp(self, ctx:MathExprParser.LambdaExpContext):
|
||||
pass
|
||||
@@ -350,6 +395,15 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#FloorDivExp.
|
||||
def enterFloorDivExp(self, ctx:MathExprParser.FloorDivExpContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#FloorDivExp.
|
||||
def exitFloorDivExp(self, ctx:MathExprParser.FloorDivExpContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#DivExp.
|
||||
def enterDivExp(self, ctx:MathExprParser.DivExpContext):
|
||||
pass
|
||||
@@ -431,6 +485,24 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#PreIncrement.
|
||||
def enterPreIncrement(self, ctx:MathExprParser.PreIncrementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#PreIncrement.
|
||||
def exitPreIncrement(self, ctx:MathExprParser.PreIncrementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#PreDecrement.
|
||||
def enterPreDecrement(self, ctx:MathExprParser.PreDecrementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#PreDecrement.
|
||||
def exitPreDecrement(self, ctx:MathExprParser.PreDecrementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#ToIndex.
|
||||
def enterToIndex(self, ctx:MathExprParser.ToIndexContext):
|
||||
pass
|
||||
@@ -611,6 +683,24 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#PostIncrement.
|
||||
def enterPostIncrement(self, ctx:MathExprParser.PostIncrementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#PostIncrement.
|
||||
def exitPostIncrement(self, ctx:MathExprParser.PostIncrementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#PostDecrement.
|
||||
def enterPostDecrement(self, ctx:MathExprParser.PostDecrementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#PostDecrement.
|
||||
def exitPostDecrement(self, ctx:MathExprParser.PostDecrementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#VariableExp.
|
||||
def enterVariableExp(self, ctx:MathExprParser.VariableExpContext):
|
||||
pass
|
||||
@@ -638,6 +728,24 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#NanExp.
|
||||
def enterNanExp(self, ctx:MathExprParser.NanExpContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#NanExp.
|
||||
def exitNanExp(self, ctx:MathExprParser.NanExpContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#InfExp.
|
||||
def enterInfExp(self, ctx:MathExprParser.InfExpContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#InfExp.
|
||||
def exitInfExp(self, ctx:MathExprParser.InfExpContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#BooleanExp.
|
||||
def enterBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
pass
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -24,6 +24,21 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#destructureTarget.
|
||||
def visitDestructureTarget(self, ctx:MathExprParser.DestructureTargetContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#variableList.
|
||||
def visitVariableList(self, ctx:MathExprParser.VariableListContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#assignmentOperator.
|
||||
def visitAssignmentOperator(self, ctx:MathExprParser.AssignmentOperatorContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#paramList.
|
||||
def visitParamList(self, ctx:MathExprParser.ParamListContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -34,6 +49,11 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#FunctionDefStatement.
|
||||
def visitFunctionDefStatement(self, ctx:MathExprParser.FunctionDefStatementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#WhileStatement.
|
||||
def visitWhileStatement(self, ctx:MathExprParser.WhileStatementContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -124,6 +144,11 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#assignmentExpr.
|
||||
def visitAssignmentExpr(self, ctx:MathExprParser.AssignmentExprContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#LambdaExp.
|
||||
def visitLambdaExp(self, ctx:MathExprParser.LambdaExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -199,6 +224,11 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#FloorDivExp.
|
||||
def visitFloorDivExp(self, ctx:MathExprParser.FloorDivExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#DivExp.
|
||||
def visitDivExp(self, ctx:MathExprParser.DivExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -244,6 +274,16 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#PreIncrement.
|
||||
def visitPreIncrement(self, ctx:MathExprParser.PreIncrementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#PreDecrement.
|
||||
def visitPreDecrement(self, ctx:MathExprParser.PreDecrementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#ToIndex.
|
||||
def visitToIndex(self, ctx:MathExprParser.ToIndexContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -344,6 +384,16 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#PostIncrement.
|
||||
def visitPostIncrement(self, ctx:MathExprParser.PostIncrementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#PostDecrement.
|
||||
def visitPostDecrement(self, ctx:MathExprParser.PostDecrementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#VariableExp.
|
||||
def visitVariableExp(self, ctx:MathExprParser.VariableExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -359,6 +409,16 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#NanExp.
|
||||
def visitNanExp(self, ctx:MathExprParser.NanExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#InfExp.
|
||||
def visitInfExp(self, ctx:MathExprParser.InfExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#BooleanExp.
|
||||
def visitBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -219,99 +219,105 @@ AS_NESTED=218
|
||||
SVD=219
|
||||
DIAG=220
|
||||
IF=221
|
||||
ELSE=222
|
||||
WHILE=223
|
||||
FOR=224
|
||||
IN=225
|
||||
BREAK=226
|
||||
CONTINUE=227
|
||||
RETURN=228
|
||||
TIMESTAMP=229
|
||||
SORT=230
|
||||
ARGSORT=231
|
||||
ARGMIN=232
|
||||
ARGMAX=233
|
||||
SOFTMAX=234
|
||||
SOFTMIN=235
|
||||
UNIQUE=236
|
||||
FLIP=237
|
||||
STARTSWITH=238
|
||||
ENDSWITH=239
|
||||
SQUEEZE=240
|
||||
UNSQUEEZE=241
|
||||
ROLL=242
|
||||
COV=243
|
||||
CORR=244
|
||||
ENTROPY=245
|
||||
CROP=246
|
||||
NONE=247
|
||||
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
|
||||
ELIF=222
|
||||
ELSE=223
|
||||
WHILE=224
|
||||
FOR=225
|
||||
IN=226
|
||||
BREAK=227
|
||||
CONTINUE=228
|
||||
RETURN=229
|
||||
TIMESTAMP=230
|
||||
SORT=231
|
||||
ARGSORT=232
|
||||
ARGMIN=233
|
||||
ARGMAX=234
|
||||
SOFTMAX=235
|
||||
SOFTMIN=236
|
||||
UNIQUE=237
|
||||
FLIP=238
|
||||
STARTSWITH=239
|
||||
ENDSWITH=240
|
||||
SQUEEZE=241
|
||||
UNSQUEEZE=242
|
||||
ROLL=243
|
||||
COV=244
|
||||
CORR=245
|
||||
ENTROPY=246
|
||||
CROP=247
|
||||
NONE=248
|
||||
TRUE=249
|
||||
FALSE=250
|
||||
COORDS=251
|
||||
GATHER=252
|
||||
SCATTER=253
|
||||
SCATTER_ADD=254
|
||||
NOISE=255
|
||||
PINK_NOISE=256
|
||||
BROWN_NOISE=257
|
||||
RAND=258
|
||||
CAUCHY=259
|
||||
EXPONENTIAL=260
|
||||
LOGNORMAL=261
|
||||
BERNOULLI=262
|
||||
BINOMIALDIST=263
|
||||
POISSON=264
|
||||
GAMMADIST=265
|
||||
BETADIST=266
|
||||
LAPLACEDIST=267
|
||||
GUMBELDIST=268
|
||||
WEIBULLDIST=269
|
||||
CHI2DIST=270
|
||||
STUDENTTDIST=271
|
||||
PERLIN=272
|
||||
CELLULAR=273
|
||||
PLASMA=274
|
||||
RIDGED=275
|
||||
DOMAIN_WARP=276
|
||||
PLUS=277
|
||||
MINUS=278
|
||||
MULT=279
|
||||
DIV=280
|
||||
MOD=281
|
||||
FLOOR_DIV=282
|
||||
INC=283
|
||||
DEC=284
|
||||
POW=285
|
||||
LSHIFT=286
|
||||
RSHIFT=287
|
||||
GE=288
|
||||
GT=289
|
||||
LE=290
|
||||
LT=291
|
||||
EQ=292
|
||||
EQUEALS=293
|
||||
PLUS_EQ=294
|
||||
MINUS_EQ=295
|
||||
MULT_EQ=296
|
||||
DIV_EQ=297
|
||||
MOD_EQ=298
|
||||
NE=299
|
||||
PIPE=300
|
||||
LPAREN=301
|
||||
RPAREN=302
|
||||
COMMA=303
|
||||
SEMICOLON=304
|
||||
ARROW=305
|
||||
LBRACKET=306
|
||||
RBRACKET=307
|
||||
QUESTION=308
|
||||
COLON=309
|
||||
LBRACE=310
|
||||
RBRACE=311
|
||||
NUMBER=312
|
||||
CONSTANT=313
|
||||
NAN=314
|
||||
INF=315
|
||||
STRING=316
|
||||
VARIABLE=317
|
||||
SL_COMMENT=318
|
||||
ML_COMMENT=319
|
||||
WS=320
|
||||
'sin'=1
|
||||
'cos'=2
|
||||
'tan'=3
|
||||
@@ -490,61 +496,65 @@ WS=314
|
||||
'interpolate_area'=215
|
||||
'text_image'=217
|
||||
'if'=221
|
||||
'else'=222
|
||||
'while'=223
|
||||
'for'=224
|
||||
'in'=225
|
||||
'break'=226
|
||||
'continue'=227
|
||||
'return'=228
|
||||
'sort'=230
|
||||
'argsort'=231
|
||||
'argmin'=232
|
||||
'argmax'=233
|
||||
'softmax'=234
|
||||
'softmin'=235
|
||||
'unique'=236
|
||||
'flip'=237
|
||||
'startswith'=238
|
||||
'endswith'=239
|
||||
'squeeze'=240
|
||||
'unsqueeze'=241
|
||||
'roll'=242
|
||||
'cov'=243
|
||||
'entropy'=245
|
||||
'crop'=246
|
||||
'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
|
||||
'elif'=222
|
||||
'else'=223
|
||||
'while'=224
|
||||
'for'=225
|
||||
'in'=226
|
||||
'break'=227
|
||||
'continue'=228
|
||||
'return'=229
|
||||
'sort'=231
|
||||
'argsort'=232
|
||||
'argmin'=233
|
||||
'argmax'=234
|
||||
'softmax'=235
|
||||
'softmin'=236
|
||||
'unique'=237
|
||||
'flip'=238
|
||||
'startswith'=239
|
||||
'endswith'=240
|
||||
'squeeze'=241
|
||||
'unsqueeze'=242
|
||||
'roll'=243
|
||||
'cov'=244
|
||||
'entropy'=246
|
||||
'crop'=247
|
||||
'gather'=252
|
||||
'scatter'=253
|
||||
'scatter_add'=254
|
||||
'+'=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
|
||||
'?'=308
|
||||
':'=309
|
||||
'{'=310
|
||||
'}'=311
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -219,99 +219,105 @@ AS_NESTED=218
|
||||
SVD=219
|
||||
DIAG=220
|
||||
IF=221
|
||||
ELSE=222
|
||||
WHILE=223
|
||||
FOR=224
|
||||
IN=225
|
||||
BREAK=226
|
||||
CONTINUE=227
|
||||
RETURN=228
|
||||
TIMESTAMP=229
|
||||
SORT=230
|
||||
ARGSORT=231
|
||||
ARGMIN=232
|
||||
ARGMAX=233
|
||||
SOFTMAX=234
|
||||
SOFTMIN=235
|
||||
UNIQUE=236
|
||||
FLIP=237
|
||||
STARTSWITH=238
|
||||
ENDSWITH=239
|
||||
SQUEEZE=240
|
||||
UNSQUEEZE=241
|
||||
ROLL=242
|
||||
COV=243
|
||||
CORR=244
|
||||
ENTROPY=245
|
||||
CROP=246
|
||||
NONE=247
|
||||
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
|
||||
ELIF=222
|
||||
ELSE=223
|
||||
WHILE=224
|
||||
FOR=225
|
||||
IN=226
|
||||
BREAK=227
|
||||
CONTINUE=228
|
||||
RETURN=229
|
||||
TIMESTAMP=230
|
||||
SORT=231
|
||||
ARGSORT=232
|
||||
ARGMIN=233
|
||||
ARGMAX=234
|
||||
SOFTMAX=235
|
||||
SOFTMIN=236
|
||||
UNIQUE=237
|
||||
FLIP=238
|
||||
STARTSWITH=239
|
||||
ENDSWITH=240
|
||||
SQUEEZE=241
|
||||
UNSQUEEZE=242
|
||||
ROLL=243
|
||||
COV=244
|
||||
CORR=245
|
||||
ENTROPY=246
|
||||
CROP=247
|
||||
NONE=248
|
||||
TRUE=249
|
||||
FALSE=250
|
||||
COORDS=251
|
||||
GATHER=252
|
||||
SCATTER=253
|
||||
SCATTER_ADD=254
|
||||
NOISE=255
|
||||
PINK_NOISE=256
|
||||
BROWN_NOISE=257
|
||||
RAND=258
|
||||
CAUCHY=259
|
||||
EXPONENTIAL=260
|
||||
LOGNORMAL=261
|
||||
BERNOULLI=262
|
||||
BINOMIALDIST=263
|
||||
POISSON=264
|
||||
GAMMADIST=265
|
||||
BETADIST=266
|
||||
LAPLACEDIST=267
|
||||
GUMBELDIST=268
|
||||
WEIBULLDIST=269
|
||||
CHI2DIST=270
|
||||
STUDENTTDIST=271
|
||||
PERLIN=272
|
||||
CELLULAR=273
|
||||
PLASMA=274
|
||||
RIDGED=275
|
||||
DOMAIN_WARP=276
|
||||
PLUS=277
|
||||
MINUS=278
|
||||
MULT=279
|
||||
DIV=280
|
||||
MOD=281
|
||||
FLOOR_DIV=282
|
||||
INC=283
|
||||
DEC=284
|
||||
POW=285
|
||||
LSHIFT=286
|
||||
RSHIFT=287
|
||||
GE=288
|
||||
GT=289
|
||||
LE=290
|
||||
LT=291
|
||||
EQ=292
|
||||
EQUEALS=293
|
||||
PLUS_EQ=294
|
||||
MINUS_EQ=295
|
||||
MULT_EQ=296
|
||||
DIV_EQ=297
|
||||
MOD_EQ=298
|
||||
NE=299
|
||||
PIPE=300
|
||||
LPAREN=301
|
||||
RPAREN=302
|
||||
COMMA=303
|
||||
SEMICOLON=304
|
||||
ARROW=305
|
||||
LBRACKET=306
|
||||
RBRACKET=307
|
||||
QUESTION=308
|
||||
COLON=309
|
||||
LBRACE=310
|
||||
RBRACE=311
|
||||
NUMBER=312
|
||||
CONSTANT=313
|
||||
NAN=314
|
||||
INF=315
|
||||
STRING=316
|
||||
VARIABLE=317
|
||||
SL_COMMENT=318
|
||||
ML_COMMENT=319
|
||||
WS=320
|
||||
'sin'=1
|
||||
'cos'=2
|
||||
'tan'=3
|
||||
@@ -490,61 +496,65 @@ WS=314
|
||||
'interpolate_area'=215
|
||||
'text_image'=217
|
||||
'if'=221
|
||||
'else'=222
|
||||
'while'=223
|
||||
'for'=224
|
||||
'in'=225
|
||||
'break'=226
|
||||
'continue'=227
|
||||
'return'=228
|
||||
'sort'=230
|
||||
'argsort'=231
|
||||
'argmin'=232
|
||||
'argmax'=233
|
||||
'softmax'=234
|
||||
'softmin'=235
|
||||
'unique'=236
|
||||
'flip'=237
|
||||
'startswith'=238
|
||||
'endswith'=239
|
||||
'squeeze'=240
|
||||
'unsqueeze'=241
|
||||
'roll'=242
|
||||
'cov'=243
|
||||
'entropy'=245
|
||||
'crop'=246
|
||||
'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
|
||||
'elif'=222
|
||||
'else'=223
|
||||
'while'=224
|
||||
'for'=225
|
||||
'in'=226
|
||||
'break'=227
|
||||
'continue'=228
|
||||
'return'=229
|
||||
'sort'=231
|
||||
'argsort'=232
|
||||
'argmin'=233
|
||||
'argmax'=234
|
||||
'softmax'=235
|
||||
'softmin'=236
|
||||
'unique'=237
|
||||
'flip'=238
|
||||
'startswith'=239
|
||||
'endswith'=240
|
||||
'squeeze'=241
|
||||
'unsqueeze'=242
|
||||
'roll'=243
|
||||
'cov'=244
|
||||
'entropy'=246
|
||||
'crop'=247
|
||||
'gather'=252
|
||||
'scatter'=253
|
||||
'scatter_add'=254
|
||||
'+'=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
|
||||
'?'=308
|
||||
':'=309
|
||||
'{'=310
|
||||
'}'=311
|
||||
|
||||
@@ -35,6 +35,33 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#destructureTarget.
|
||||
def enterDestructureTarget(self, ctx:MathExprParser.DestructureTargetContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#destructureTarget.
|
||||
def exitDestructureTarget(self, ctx:MathExprParser.DestructureTargetContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#variableList.
|
||||
def enterVariableList(self, ctx:MathExprParser.VariableListContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#variableList.
|
||||
def exitVariableList(self, ctx:MathExprParser.VariableListContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#assignmentOperator.
|
||||
def enterAssignmentOperator(self, ctx:MathExprParser.AssignmentOperatorContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#assignmentOperator.
|
||||
def exitAssignmentOperator(self, ctx:MathExprParser.AssignmentOperatorContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#paramList.
|
||||
def enterParamList(self, ctx:MathExprParser.ParamListContext):
|
||||
pass
|
||||
@@ -53,6 +80,15 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#FunctionDefStatement.
|
||||
def enterFunctionDefStatement(self, ctx:MathExprParser.FunctionDefStatementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#FunctionDefStatement.
|
||||
def exitFunctionDefStatement(self, ctx:MathExprParser.FunctionDefStatementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#WhileStatement.
|
||||
def enterWhileStatement(self, ctx:MathExprParser.WhileStatementContext):
|
||||
pass
|
||||
@@ -215,6 +251,15 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#assignmentExpr.
|
||||
def enterAssignmentExpr(self, ctx:MathExprParser.AssignmentExprContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#assignmentExpr.
|
||||
def exitAssignmentExpr(self, ctx:MathExprParser.AssignmentExprContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#LambdaExp.
|
||||
def enterLambdaExp(self, ctx:MathExprParser.LambdaExpContext):
|
||||
pass
|
||||
@@ -350,6 +395,15 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#FloorDivExp.
|
||||
def enterFloorDivExp(self, ctx:MathExprParser.FloorDivExpContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#FloorDivExp.
|
||||
def exitFloorDivExp(self, ctx:MathExprParser.FloorDivExpContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#DivExp.
|
||||
def enterDivExp(self, ctx:MathExprParser.DivExpContext):
|
||||
pass
|
||||
@@ -431,6 +485,24 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#PreIncrement.
|
||||
def enterPreIncrement(self, ctx:MathExprParser.PreIncrementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#PreIncrement.
|
||||
def exitPreIncrement(self, ctx:MathExprParser.PreIncrementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#PreDecrement.
|
||||
def enterPreDecrement(self, ctx:MathExprParser.PreDecrementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#PreDecrement.
|
||||
def exitPreDecrement(self, ctx:MathExprParser.PreDecrementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#ToIndex.
|
||||
def enterToIndex(self, ctx:MathExprParser.ToIndexContext):
|
||||
pass
|
||||
@@ -611,6 +683,24 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#PostIncrement.
|
||||
def enterPostIncrement(self, ctx:MathExprParser.PostIncrementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#PostIncrement.
|
||||
def exitPostIncrement(self, ctx:MathExprParser.PostIncrementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#PostDecrement.
|
||||
def enterPostDecrement(self, ctx:MathExprParser.PostDecrementContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#PostDecrement.
|
||||
def exitPostDecrement(self, ctx:MathExprParser.PostDecrementContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#VariableExp.
|
||||
def enterVariableExp(self, ctx:MathExprParser.VariableExpContext):
|
||||
pass
|
||||
@@ -638,6 +728,24 @@ class MathExprListener(ParseTreeListener):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#NanExp.
|
||||
def enterNanExp(self, ctx:MathExprParser.NanExpContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#NanExp.
|
||||
def exitNanExp(self, ctx:MathExprParser.NanExpContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#InfExp.
|
||||
def enterInfExp(self, ctx:MathExprParser.InfExpContext):
|
||||
pass
|
||||
|
||||
# Exit a parse tree produced by MathExprParser#InfExp.
|
||||
def exitInfExp(self, ctx:MathExprParser.InfExpContext):
|
||||
pass
|
||||
|
||||
|
||||
# Enter a parse tree produced by MathExprParser#BooleanExp.
|
||||
def enterBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
pass
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,21 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#destructureTarget.
|
||||
def visitDestructureTarget(self, ctx:MathExprParser.DestructureTargetContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#variableList.
|
||||
def visitVariableList(self, ctx:MathExprParser.VariableListContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#assignmentOperator.
|
||||
def visitAssignmentOperator(self, ctx:MathExprParser.AssignmentOperatorContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#paramList.
|
||||
def visitParamList(self, ctx:MathExprParser.ParamListContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -34,6 +49,11 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#FunctionDefStatement.
|
||||
def visitFunctionDefStatement(self, ctx:MathExprParser.FunctionDefStatementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#WhileStatement.
|
||||
def visitWhileStatement(self, ctx:MathExprParser.WhileStatementContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -124,6 +144,11 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#assignmentExpr.
|
||||
def visitAssignmentExpr(self, ctx:MathExprParser.AssignmentExprContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#LambdaExp.
|
||||
def visitLambdaExp(self, ctx:MathExprParser.LambdaExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -199,6 +224,11 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#FloorDivExp.
|
||||
def visitFloorDivExp(self, ctx:MathExprParser.FloorDivExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#DivExp.
|
||||
def visitDivExp(self, ctx:MathExprParser.DivExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -244,6 +274,16 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#PreIncrement.
|
||||
def visitPreIncrement(self, ctx:MathExprParser.PreIncrementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#PreDecrement.
|
||||
def visitPreDecrement(self, ctx:MathExprParser.PreDecrementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#ToIndex.
|
||||
def visitToIndex(self, ctx:MathExprParser.ToIndexContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -344,6 +384,16 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#PostIncrement.
|
||||
def visitPostIncrement(self, ctx:MathExprParser.PostIncrementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#PostDecrement.
|
||||
def visitPostDecrement(self, ctx:MathExprParser.PostDecrementContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#VariableExp.
|
||||
def visitVariableExp(self, ctx:MathExprParser.VariableExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
@@ -359,6 +409,16 @@ class MathExprVisitor(ParseTreeVisitor):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#NanExp.
|
||||
def visitNanExp(self, ctx:MathExprParser.NanExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#InfExp.
|
||||
def visitInfExp(self, ctx:MathExprParser.InfExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
|
||||
# Visit a parse tree produced by MathExprParser#BooleanExp.
|
||||
def visitBooleanExp(self, ctx:MathExprParser.BooleanExpContext):
|
||||
return self.visitChildren(ctx)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Generated automatically by compile.ps1. Do not edit.
|
||||
INBUILT_KEYWORDS = {
|
||||
'break', 'continue', 'else', 'false', 'False', 'FALSE', 'for', 'if', 'in', 'none', 'None', 'null', 'NULL', 'return', 'true', 'True', 'TRUE', 'while'
|
||||
'_', 'break', 'continue', 'elif', 'else', 'false', 'False', 'FALSE', 'for', 'if', 'in', 'inf', 'Inf', 'INF', 'infinity', 'Infinity', 'INFINITY', 'nan', 'NaN', 'NAN', 'none', 'None', 'null', 'NULL', 'return', 'true', 'True', 'TRUE', 'while'
|
||||
}
|
||||
INBUILT_CONSTANTS = {
|
||||
'e', 'E', 'pi', 'PI'
|
||||
|
||||
@@ -366,10 +366,12 @@ def _collect_vars_from_node( node, needed_vars, assigned_vars, shadowed_vars):
|
||||
return
|
||||
|
||||
# Compound (x += ...) and indexed (x[i] = ...) assignments read their target
|
||||
if node_type == 'VarDefContext' and (node.LBRACKET() or node.EQUEALS() is None):
|
||||
var_name = node.VARIABLE().getText()
|
||||
if var_name not in shadowed_vars and var_name not in assigned_vars:
|
||||
needed_vars.add(var_name)
|
||||
if node_type == 'VarDefContext':
|
||||
assignment = node.assignmentOperator().getText()
|
||||
if node.destructureTarget() is None and (node.LBRACKET() or assignment != '='):
|
||||
var_name = node.VARIABLE().getText()
|
||||
if var_name not in shadowed_vars and var_name not in assigned_vars:
|
||||
needed_vars.add(var_name)
|
||||
|
||||
# Recursively visit children
|
||||
for i in range(node.getChildCount()):
|
||||
@@ -410,9 +412,11 @@ def checkLazyNew(Expression, V, F):
|
||||
|
||||
# Top-level assignments
|
||||
elif rule_name == 'varDef':
|
||||
var_name = child.VARIABLE().getText()
|
||||
_collect_vars_from_node(child, needed_vars, assigned_vars, set())
|
||||
assigned_vars.add(var_name)
|
||||
if child.destructureTarget():
|
||||
assigned_vars.update(node.getText() for node in child.destructureTarget().variableList().VARIABLE())
|
||||
else:
|
||||
assigned_vars.add(child.VARIABLE().getText())
|
||||
|
||||
# Track other top-level statements
|
||||
else:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Generated automatically by compile.ps1. Do not edit.
|
||||
|
||||
export const KEYWORDS = new Set([
|
||||
"break", "continue", "else", "false", "False", "FALSE", "for", "if", "in", "none", "None", "null", "NULL", "return", "true", "True", "TRUE", "while"
|
||||
"_", "break", "continue", "elif", "else", "false", "False", "FALSE", "for", "if", "in", "inf", "Inf", "INF", "infinity", "Infinity", "INFINITY", "nan", "NaN", "NAN", "none", "None", "null", "NULL", "return", "true", "True", "TRUE", "while"
|
||||
]);
|
||||
|
||||
export const CONSTANTS = new Set([
|
||||
|
||||
Reference in New Issue
Block a user