Class DefaultExpressionVisitor
java.lang.Object
org.antlr.v4.runtime.tree.AbstractParseTreeVisitor<Object>
rocks.palaiologos.maja.expression.DefaultExpressionVisitor
- All Implemented Interfaces:
org.antlr.v4.runtime.tree.ParseTreeVisitor<Object>,ExpressionVisitor<Object>
class DefaultExpressionVisitor
extends org.antlr.v4.runtime.tree.AbstractParseTreeVisitor<Object>
implements ExpressionVisitor<Object>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static Objectprivate static booleanprivate static booleananyComplex(Object... objs) private static doublecoerceDouble(Object obj) private static ObjectdetermineStep(Object begin, Object end) private static Complexprivate EnvironmentgetEnv()private static booleanisPathologic(double d) private static boolean(package private) static <E> List<E>of(E e1) (package private) static <E> List<E>of(E e1, E e2) private voidsetEnv(Environment env) private static Objectprivate booleanvisit(org.antlr.v4.runtime.tree.ParseTree tree) Visit a parse tree produced byExpressionParser.block().Visit a parse tree produced by theExprAddlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprAndlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprDivlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprEqlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprFunctionCalllabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprGcdlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprGelabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprGtlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprIndexlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprIntlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprLambdalabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprLcmlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprLelabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprLtlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprMatrixlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprModlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprMullabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprNeglabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprNeqlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprNotlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprOrlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprParenlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprPoslabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprPowlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprReallabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprRemlabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprSublabeled alternative inExpressionParser.expression().Visit a parse tree produced by theExprVariablelabeled alternative inExpressionParser.expression().Visit a parse tree produced by theForlabeled alternative inExpressionParser.declaration().Visit a parse tree produced by theFunctionDeclarationlabeled alternative inExpressionParser.declaration().Visit a parse tree produced by theIflabeled alternative inExpressionParser.declaration().Visit a parse tree produced by theLocalFunctionDeclarationlabeled alternative inExpressionParser.declaration().Visit a parse tree produced byExpressionParser.main().Visit a parse tree produced byExpressionParser.matrix().Visit a parse tree produced by theMatrixAssignmentlabeled alternative inExpressionParser.declaration().Visit a parse tree produced by theReturnlabeled alternative inExpressionParser.declaration().Visit a parse tree produced by theSimpleAssignmentlabeled alternative inExpressionParser.declaration().Visit a parse tree produced by theSimpleFunctionDeclarationlabeled alternative inExpressionParser.declaration().Visit a parse tree produced by theSimpleIflabeled alternative inExpressionParser.expression().Visit a parse tree produced by theSimpleLocalAssignmentlabeled alternative inExpressionParser.declaration().Visit a parse tree produced by theSimpleLocalFunctionDeclarationlabeled alternative inExpressionParser.declaration().Visit a parse tree produced byExpressionParser.toplevel().Visit a parse tree produced by theWhilelabeled alternative inExpressionParser.declaration().Methods inherited from class org.antlr.v4.runtime.tree.AbstractParseTreeVisitor
aggregateResult, defaultResult, shouldVisitNextChild, visitChildren, visitErrorNode, visitTerminalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.antlr.v4.runtime.tree.ParseTreeVisitor
visitChildren, visitErrorNode, visitTerminal
-
Field Details
-
env
-
-
Constructor Details
-
DefaultExpressionVisitor
-
-
Method Details
-
of
-
of
-
of
-
getEnv
-
setEnv
-
forceComplex
-
isPathologic
private static boolean isPathologic(double d) -
anyComplex
-
allDouble
-
coerceDouble
-
visitMain
Description copied from interface:ExpressionVisitorVisit a parse tree produced byExpressionParser.main().- Specified by:
visitMainin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitToplevel
Description copied from interface:ExpressionVisitorVisit a parse tree produced byExpressionParser.toplevel().- Specified by:
visitToplevelin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitBlock
Description copied from interface:ExpressionVisitorVisit a parse tree produced byExpressionParser.block().- Specified by:
visitBlockin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitSimpleAssignment
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theSimpleAssignmentlabeled alternative inExpressionParser.declaration().- Specified by:
visitSimpleAssignmentin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitSimpleLocalAssignment
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theSimpleLocalAssignmentlabeled alternative inExpressionParser.declaration().- Specified by:
visitSimpleLocalAssignmentin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitMatrixAssignment
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theMatrixAssignmentlabeled alternative inExpressionParser.declaration().- Specified by:
visitMatrixAssignmentin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitSimpleFunctionDeclaration
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theSimpleFunctionDeclarationlabeled alternative inExpressionParser.declaration().- Specified by:
visitSimpleFunctionDeclarationin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitFunctionDeclaration
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theFunctionDeclarationlabeled alternative inExpressionParser.declaration().- Specified by:
visitFunctionDeclarationin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitSimpleLocalFunctionDeclaration
public Object visitSimpleLocalFunctionDeclaration(ExpressionParser.SimpleLocalFunctionDeclarationContext ctx) Description copied from interface:ExpressionVisitorVisit a parse tree produced by theSimpleLocalFunctionDeclarationlabeled alternative inExpressionParser.declaration().- Specified by:
visitSimpleLocalFunctionDeclarationin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitLocalFunctionDeclaration
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theLocalFunctionDeclarationlabeled alternative inExpressionParser.declaration().- Specified by:
visitLocalFunctionDeclarationin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
truthy
-
visitIf
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theIflabeled alternative inExpressionParser.declaration().- Specified by:
visitIfin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitSimpleIf
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theSimpleIflabeled alternative inExpressionParser.expression().- Specified by:
visitSimpleIfin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitWhile
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theWhilelabeled alternative inExpressionParser.declaration().- Specified by:
visitWhilein interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
determineStep
-
mayFor
-
addFor
-
visitFor
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theForlabeled alternative inExpressionParser.declaration().- Specified by:
visitForin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitReturn
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theReturnlabeled alternative inExpressionParser.declaration().- Specified by:
visitReturnin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprGcd
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprGcdlabeled alternative inExpressionParser.expression().- Specified by:
visitExprGcdin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprIndex
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprIndexlabeled alternative inExpressionParser.expression().- Specified by:
visitExprIndexin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprNeg
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprNeglabeled alternative inExpressionParser.expression().- Specified by:
visitExprNegin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprNot
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprNotlabeled alternative inExpressionParser.expression().- Specified by:
visitExprNotin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprPos
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprPoslabeled alternative inExpressionParser.expression().- Specified by:
visitExprPosin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprDiv
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprDivlabeled alternative inExpressionParser.expression().- Specified by:
visitExprDivin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprOr
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprOrlabeled alternative inExpressionParser.expression().- Specified by:
visitExprOrin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprSub
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprSublabeled alternative inExpressionParser.expression().- Specified by:
visitExprSubin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprMul
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprMullabeled alternative inExpressionParser.expression().- Specified by:
visitExprMulin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprGe
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprGelabeled alternative inExpressionParser.expression().- Specified by:
visitExprGein interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprLambda
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprLambdalabeled alternative inExpressionParser.expression().- Specified by:
visitExprLambdain interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprMod
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprModlabeled alternative inExpressionParser.expression().- Specified by:
visitExprModin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprLe
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprLelabeled alternative inExpressionParser.expression().- Specified by:
visitExprLein interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprParen
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprParenlabeled alternative inExpressionParser.expression().- Specified by:
visitExprParenin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprInt
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprIntlabeled alternative inExpressionParser.expression().- Specified by:
visitExprIntin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitMatrix
Description copied from interface:ExpressionVisitorVisit a parse tree produced byExpressionParser.matrix().- Specified by:
visitMatrixin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprMatrix
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprMatrixlabeled alternative inExpressionParser.expression().- Specified by:
visitExprMatrixin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprGt
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprGtlabeled alternative inExpressionParser.expression().- Specified by:
visitExprGtin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprEq
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprEqlabeled alternative inExpressionParser.expression().- Specified by:
visitExprEqin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprAnd
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprAndlabeled alternative inExpressionParser.expression().- Specified by:
visitExprAndin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprPow
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprPowlabeled alternative inExpressionParser.expression().- Specified by:
visitExprPowin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprFunctionCall
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprFunctionCalllabeled alternative inExpressionParser.expression().- Specified by:
visitExprFunctionCallin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprLcm
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprLcmlabeled alternative inExpressionParser.expression().- Specified by:
visitExprLcmin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprLt
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprLtlabeled alternative inExpressionParser.expression().- Specified by:
visitExprLtin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprRem
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprRemlabeled alternative inExpressionParser.expression().- Specified by:
visitExprRemin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprNeq
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprNeqlabeled alternative inExpressionParser.expression().- Specified by:
visitExprNeqin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprReal
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprReallabeled alternative inExpressionParser.expression().- Specified by:
visitExprRealin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprVariable
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprVariablelabeled alternative inExpressionParser.expression().- Specified by:
visitExprVariablein interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
visitExprAdd
Description copied from interface:ExpressionVisitorVisit a parse tree produced by theExprAddlabeled alternative inExpressionParser.expression().- Specified by:
visitExprAddin interfaceExpressionVisitor<Object>- Parameters:
ctx- the parse tree- Returns:
- the visitor result
-
simplify
-
visit
-