Package nz.org.riskscape.rl.ast
Class GenericArgument<T extends AST>
java.lang.Object
nz.org.riskscape.rl.ast.GenericArgument<T>
- All Implemented Interfaces:
AST
- Direct Known Subclasses:
FunctionCall.Argument,StepDefinition.Argument
-
Constructor Summary
ConstructorsConstructorDescriptionGenericArgument(T value, Optional<Token> nameToken) Creates a newGenericArgumentinstance. -
Method Summary
Modifier and TypeMethodDescriptionvoidappendSource(StringBuilder appendTo) Implementers extend this to append their source to the given string builder.protected static voidappendSource(AST ast, StringBuilder appendTo) Helper method for appending the source of another ast element to a string builder, efficiently if possible.protected voidappendString(StringBuilder appendTo) Append a simplified string representation to the builder.booleangetName()getValue()The value of this argument, e.g.inthashCode()booleanfinal StringtoSource()final StringtoString()Returns a simplified view of the ast in a source-like fashion, but with a lot of details left out for concisenessMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface nz.org.riskscape.rl.ast.AST
isA, switchType
-
Constructor Details
-
GenericArgument
Creates a new
GenericArgumentinstance.- Parameters:
value- The value of this argument, e.g. the non-keyword part of it.nameToken-
-
-
Method Details
-
getName
-
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.
-
isKeywordArgument
public boolean isKeywordArgument()- Returns:
- if this argument has a keyword, e.g.
foo(bar: baz)vsfoo(baz)
-
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.
-
equals
-
hashCode
public int hashCode() -
getValue
The value of this argument, e.g. the non-keyword part of it.
-
getNameToken
-
appendSource
Helper method for appending the source of another ast element to a string builder, efficiently if possible.
-
toString
Returns a simplified view of the ast in a source-like fashion, but with a lot of details left out for conciseness
-
appendString
Append a simplified string representation to the builder. Default implementation uses appendSource. Subclasses can override to provide a more concise representation.
-
toSource
-