Top Fields Constructors Methods
org.antlr.v4.parse

public Class GrammarASTAdaptor

extends CommonTreeAdaptor
Class Inheritance
Imports
org.antlr.runtime.CommonToken, .Token, org.antlr.runtime.tree.CommonTreeAdaptor, org.antlr.v4.tool.ast.GrammarAST, .GrammarASTErrorNode, .RuleAST, .TerminalAST

Field Summary

Modifier and TypeField and Description
pack-priv CharStream

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public Object
create(Token token)

Overrides org.antlr.runtime.tree.CommonTreeAdaptor.create.

Implements org.antlr.runtime.tree.TreeAdaptor.create.

Create a tree node from Token object; for CommonTree type trees, then the token just becomes the payload.
public Object
create(int tokenType, String text)

Overrides org.antlr.runtime.tree.BaseTreeAdaptor.create.

Implements org.antlr.runtime.tree.TreeAdaptor.create.

Create a new node derived from a token, with a new token type.
public Object
public Object
errorNode(TokenStream input, Token start, Token stop, RecognitionException e)

Overrides org.antlr.runtime.tree.BaseTreeAdaptor.errorNode.

Implements org.antlr.runtime.tree.TreeAdaptor.errorNode.

create tree node that holds the start and stop tokens associated with an error.
Inherited from org.antlr.runtime.tree.CommonTreeAdaptor:
createTokencreateTokengetChildgetChildCountgetChildIndexgetParentgetTextgetTokengetTokenStartIndexgetTokenStopIndexgetTypereplaceChildrensetChildIndexsetParentsetTokenBoundaries

Field Detail

inputback to summary
pack-priv CharStream input

Constructor Detail

GrammarASTAdaptorback to summary
public GrammarASTAdaptor()
GrammarASTAdaptorback to summary
public GrammarASTAdaptor(CharStream input)

Method Detail

createback to summary
public Object create(Token token)

Overrides org.antlr.runtime.tree.CommonTreeAdaptor.create.

Implements org.antlr.runtime.tree.TreeAdaptor.create.

Doc from org.antlr.runtime.tree.TreeAdaptor.create.

Create a tree node from Token object; for CommonTree type trees, then the token just becomes the payload. This is the most common create call. Override if you want another kind of node to be built.

Annotations
@Override
createback to summary
public Object create(int tokenType, String text)

Overrides org.antlr.runtime.tree.BaseTreeAdaptor.create.

Implements org.antlr.runtime.tree.TreeAdaptor.create.

Doc from org.antlr.runtime.tree.TreeAdaptor.create.

Create a new node derived from a token, with a new token type. This is invoked from an imaginary node ref on right side of a rewrite rule as IMAG["IMAG"]. This should invoke createToken(int,String).

Annotations
@Override
dupNodeback to summary
public Object dupNode(Object t)

Overrides org.antlr.runtime.tree.CommonTreeAdaptor.dupNode.

Implements org.antlr.runtime.tree.TreeAdaptor.dupNode.

Doc from org.antlr.runtime.tree.CommonTreeAdaptor.dupNode.

Duplicate a node. This is part of the factory; override if you want another kind of node to be built. I could use reflection to prevent having to override this but reflection is slow.

Annotations
@Override
errorNodeback to summary
public Object errorNode(TokenStream input, Token start, Token stop, RecognitionException e)

Overrides org.antlr.runtime.tree.BaseTreeAdaptor.errorNode.

Implements org.antlr.runtime.tree.TreeAdaptor.errorNode.

Doc from org.antlr.runtime.tree.BaseTreeAdaptor.errorNode.

create tree node that holds the start and stop tokens associated with an error. If you specify your own kind of tree nodes, you will likely have to override this method. CommonTree returns Token.INVALID_TOKEN_TYPE if no token payload but you might have to set token type for diff node type. You don't have to subclass CommonErrorNode; you will likely need to subclass your own tree node class to avoid class cast exception.

Annotations
@Override