Package nz.org.riskscape.rl.ast
Class FunctionCall
java.lang.Object
nz.org.riskscape.rl.ast.FunctionCall
- All Implemented Interfaces:
Expression
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionFunctionCall
(Token identifier, List<FunctionCall.Argument> arguments) FunctionCall
(Token identifier, List<FunctionCall.Argument> arguments, Optional<Pair<Token, Token>> boundary) FunctionCall
(Token identifier, List<FunctionCall.Argument> arguments, Token closing) -
Method Summary
Modifier and TypeMethodDescription<T,
R> R accept
(ExpressionVisitor<T, R> visitor, T data) protected void
appendSource
(StringBuilder appendTo) Implementers extend this to append their source to the given string builder.protected boolean
boolean
Builds a list of all the arguments that were given before the first keyword argument appearsint
hashCode()
boolean
int
indexOfArgNamed
(String toFind) int
final String
toSource()
final String
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface nz.org.riskscape.rl.ast.Expression
isA
-
Constructor Details
-
FunctionCall
-
FunctionCall
-
FunctionCall
-
-
Method Details
-
appendSource
Implementers extend this to append their source to the given string builder. Done via string builder to encourage a more efficient implementation than is possible with concatenating multiple toString calls that typically contruct a string builder anyway.
-
keywordArgumentsOffset
public int keywordArgumentsOffset() -
hasKeywordArguments
public boolean hasKeywordArguments() -
indexOfArgNamed
- Returns:
- argIndex of argument with name toFind, or -1 if not found
-
accept
-
getPositionalArguments
Builds a list of all the arguments that were given before the first keyword argument appears
Note that the parser is currently allowing (I think) positional elements to occur after keywords, which will break this code. We should probably stop this as I'm 99% sure we never want positional args to be interleaved with keyword args
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getIdentifier
-
getArguments
-
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 expression. Intended for use in problems to trace errors back to their source.
-
toString
-
toSource
- Specified by:
toSource
in interfaceExpression
- Returns:
- a normalized version of the AST that can be parsed to be exactly the same AST as this
-