Top Description Fields Constructors Methods
org.codehaus.groovy.syntax

public Class Reduction

extends CSTNode
Class Inheritance
Imports
org.codehaus.groovy.GroovyBugError, java.util.ArrayList, .Collections, .List

A syntax reduction, produced by the Parser.
See Also
antlr.Parser, Token, CSTNode, Types

Field Summary

Modifier and TypeField and Description
private List<E>
public static final Reduction
private boolean

Constructor Summary

AccessConstructor and Description
public
Reduction(Token root)

Initializes the Reduction with the specified root.

private
Reduction()

Initializes the Reduction to empty.

Method Summary

Modifier and TypeMethod and Description
public CSTNode
add(CSTNode element)

Overrides org.codehaus.groovy.syntax.CSTNode.add.

Adds an element to the node.
public Reduction
asReduction()

Implements abstract org.codehaus.groovy.syntax.CSTNode.asReduction.

Creates a Reduction from this node.
public CSTNode
get(int index)

Implements abstract org.codehaus.groovy.syntax.CSTNode.get.

Returns the specified element, or null.
public Token
getRoot()

Implements abstract org.codehaus.groovy.syntax.CSTNode.getRoot.

Returns the root of the node, the Token that indicates its type.
public boolean
isAnExpression()

Overrides org.codehaus.groovy.syntax.CSTNode.isAnExpression.

Returns true if the node is a complete expression.
public boolean
isEmpty()

Overrides org.codehaus.groovy.syntax.CSTNode.isEmpty.

Returns true if the node is completely empty (no root, even).
public void
markAsExpression()

Overrides org.codehaus.groovy.syntax.CSTNode.markAsExpression.

Marks the node a complete expression.
public static Reduction
newContainer()

Creates a new Reduction with Token.NULL as its root.

public CSTNode
remove(int index)

Removes a node from the Reduction.

public CSTNode
set(int index, CSTNode element)

Overrides org.codehaus.groovy.syntax.CSTNode.set.

Sets an element in at the specified index.
public int
size()

Implements abstract org.codehaus.groovy.syntax.CSTNode.size.

Returns the number of elements in the node.
Inherited from org.codehaus.groovy.syntax.CSTNode:
addChildrenOfcanMeanchildrengetgetDescriptiongetMeaninggetMeaningAsgetRootgetRootTextgetStartColumngetStartLinegetTypehasChildrenisAisAllOfisOneOfmatchesmatchesmatchesmatchesmatchessetMeaningtoStringwritewrite

Field Detail

elementsback to summary
private List<E> elements
EMPTYback to summary
public static final Reduction EMPTY
markedback to summary
private boolean marked

Constructor Detail

Reductionback to summary
public Reduction(Token root)

Initializes the Reduction with the specified root.

Reductionback to summary
private Reduction()

Initializes the Reduction to empty.

Method Detail

addback to summary
public CSTNode add(CSTNode element)

Overrides org.codehaus.groovy.syntax.CSTNode.add.

Adds an element to the node.

asReductionback to summary
public Reduction asReduction()

Implements abstract org.codehaus.groovy.syntax.CSTNode.asReduction.

Creates a Reduction from this node. Returns self if the node is already a Reduction.

getback to summary
public CSTNode get(int index)

Implements abstract org.codehaus.groovy.syntax.CSTNode.get.

Returns the specified element, or null.

getRootback to summary
public Token getRoot()

Implements abstract org.codehaus.groovy.syntax.CSTNode.getRoot.

Returns the root of the node, the Token that indicates its type. Returns null if there is no root (usually only if the node is a placeholder of some kind -- see isEmpty()).

isAnExpressionback to summary
public boolean isAnExpression()

Overrides org.codehaus.groovy.syntax.CSTNode.isAnExpression.

Returns true if the node is a complete expression.

isEmptyback to summary
public boolean isEmpty()

Overrides org.codehaus.groovy.syntax.CSTNode.isEmpty.

Returns true if the node is completely empty (no root, even).

markAsExpressionback to summary
public void markAsExpression()

Overrides org.codehaus.groovy.syntax.CSTNode.markAsExpression.

Marks the node a complete expression.

newContainerback to summary
public static Reduction newContainer()

Creates a new Reduction with Token.NULL as its root.

removeback to summary
public CSTNode remove(int index)

Removes a node from the Reduction. You cannot remove the root node (index 0).

setback to summary
public CSTNode set(int index, CSTNode element)

Overrides org.codehaus.groovy.syntax.CSTNode.set.

Sets an element in at the specified index.

sizeback to summary
public int size()

Implements abstract org.codehaus.groovy.syntax.CSTNode.size.

Returns the number of elements in the node.