Package nz.org.riskscape.rl.ast
Interface AST
- All Known Subinterfaces:
Expression,PipelineAST
- All Known Implementing Classes:
BinaryOperation,BracketedExpression,Constant,FunctionCall,FunctionCall.Argument,GenericArgument,InputChain,Lambda,ListDeclaration,ParameterToken,PipelineDeclaration,PropertyAccess,SelectAllExpression,StepChain,StepDeclaration,StepDefinition,StepDefinition.Argument,StepLink,StepReference,StructDeclaration
public interface AST
Minimal amount that all bits of an abstract syntax tree must return TODO could consider moving this (or at least parts of this) to the DSL package?
-
Method Summary
Modifier and TypeMethodDescriptionFunctional style instanceof methoddefault voidswitchType(Consumer<Expression> ifExpression, Consumer<PipelineAST> ifPipeline) Functional if/else helper that emulates case-classes to run different handlers depending on whether this part of the AST belongs to a pipeline (PipelineAST) or an expression (Expression).toSource()
-
Method Details
-
toSource
String toSource()- Returns:
- a string that can be reparsed and will equal this ast, although the original source may not be identical
-
isA
Functional style instanceof method
-
getBoundary
- Returns:
- a pair of tokens that represent the start and end of this expression, to be used when giving users information about where errors have occurred. If the expression has been rebuilt then the boundary may be empty or it may be from the original AST. Intended for use in problems to trace errors back to their source.
-
switchType
Functional if/else helper that emulates case-classes to run different handlers depending on whether this part of the AST belongs to a pipeline (PipelineAST) or an expression (Expression).
-