| Type Params | Return Type | Name and description |
|---|---|---|
|
public CSTNode |
add(CSTNode element)Adds an element to the end of this reduction. |
|
public Reduction |
asReduction()Creates a Reduction from this node. |
|
public CSTNode |
get(int index)Returns the element at the specified index, or null if the index is out of bounds. |
|
public Token |
getRoot()Returns the root token of this reduction. |
|
public boolean |
isAnExpression()Returns true if this node represents a complete expression.
|
|
public boolean |
isEmpty()Returns true if this reduction is completely empty (no elements, not even a root). |
|
public void |
markAsExpression()Marks this reduction as a complete expression. |
|
public static Reduction |
newContainer()Creates a new Reduction with Token.NULL as its root. |
|
public CSTNode |
remove(int index)Removes the element at the specified index. |
|
public CSTNode |
set(int index, CSTNode element)Sets the element at the specified index. |
|
public int |
size()Returns the number of elements in this reduction (including the root token). |
| Methods inherited from class | Name |
|---|---|
class CSTNode |
add, addChildrenOf, asReduction, canMean, children, get, get, getDescription, getMeaning, getMeaningAs, getRoot, getRoot, getRootText, getStartColumn, getStartLine, getType, hasChildren, isA, isAllOf, isAnExpression, isEmpty, isOneOf, markAsExpression, set, setMeaning, size, toString, write, write |
Singleton empty reduction (read-only).
Adds an element to the end of this reduction.
element - the element to add Creates a Reduction from this node. Returns self if the
node is already a Reduction.
Returns the element at the specified index, or null if the index is out of bounds.
index - the element index (0 for root)null if not foundReturns the root token of this reduction. The root is always at index 0 and indicates the syntactic type.
null if this reduction is empty Returns true if this node represents a complete expression.
A reduction is considered an expression if it has the Types.COMPLEX_EXPRESSION
meaning or has been explicitly marked as an expression.
true if this is an expression Returns true if this reduction is completely empty (no elements, not even a root).
true if emptyMarks this reduction as a complete expression. This flag is used by the parser to distinguish complete expressions from partial constructs.
Creates a new Reduction with Token.NULL as its root. Useful for creating container nodes with no specific type.
Removes the element at the specified index. Cannot remove the root element (index 0).
index - the element index (must be > 0) Sets the element at the specified index.
If the index is beyond the current size, intermediate positions are filled with null.
The root element (index 0) must be a Token.
index - the element indexelement - the element to setReturns the number of elements in this reduction (including the root token).
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.