Top Description Constructors Methods
org.apache.groovy.parser.antlr4.util

public Class PositionConfigureUtils

extends Object
Class Inheritance
Imports
groovy.lang.Tuple2, org.antlr.v4.runtime.Token, org.antlr.v4.runtime.tree.TerminalNode, org.apache.groovy.parser.antlr4.GroovyParser, org.codehaus.groovy.ast.ASTNode

Utilities for configuring node positions

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <T extends ASTNode> T

Returns:

Modified astNode.
configureAST
(T
Node to be modified.
astNode
,
GroovyParser.GroovyParserRuleContext
Context from which information is obtained.
ctx
)

Sets location(lineNumber, colNumber, lastLineNumber, lastColumnNumber) for node using standard context information.

public static <T extends ASTNode> T
configureAST(T astNode, TerminalNode terminalNode)

public static <T extends ASTNode> T
configureAST(T astNode, Token token)

public static <T extends ASTNode> T
configureAST(T astNode, ASTNode source)

public static <T extends ASTNode> T
public static <T extends ASTNode> T
configureAST(T astNode, ASTNode start, ASTNode stop)

public static <T extends ASTNode> void
configureEndPosition(T astNode, Token token)

public static Tuple2<Integer, Integer>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PositionConfigureUtilsback to summary
public PositionConfigureUtils()

Method Detail

configureASTback to summary
public static <T extends ASTNode> T configureAST(T astNode, GroovyParser.GroovyParserRuleContext ctx)

Sets location(lineNumber, colNumber, lastLineNumber, lastColumnNumber) for node using standard context information.

Note

this method is implemented to be closed over ASTNode. It returns same node as it received in arguments.

Parameters
astNode:T

Node to be modified.

ctx:GroovyParser.GroovyParserRuleContext

Context from which information is obtained.

Returns:T

Modified astNode.

configureASTback to summary
public static <T extends ASTNode> T configureAST(T astNode, TerminalNode terminalNode)
configureASTback to summary
public static <T extends ASTNode> T configureAST(T astNode, Token token)
configureASTback to summary
public static <T extends ASTNode> T configureAST(T astNode, ASTNode source)
configureASTback to summary
public static <T extends ASTNode> T configureAST(T astNode, GroovyParser.GroovyParserRuleContext ctx, ASTNode stop)
configureASTback to summary
public static <T extends ASTNode> T configureAST(T astNode, ASTNode start, ASTNode stop)
configureEndPositionback to summary
public static <T extends ASTNode> void configureEndPosition(T astNode, Token token)
endPositionback to summary
public static Tuple2<Integer, Integer> endPosition(Token token)