public class GrammarAST
extends antlr.BaseAST
Modifier and Type | Field and Description |
---|---|
protected Map<String,Object> |
blockOptions
If this is a BLOCK node, track options here
|
org.antlr.stringtemplate.StringTemplate |
code
if this is a TOKEN_REF or RULE_REF node, this is the code StringTemplate
generated for this node.
|
String |
enclosingRuleName |
NFAState |
followingNFAState
Rule ref nodes, token refs, set, and NOT set refs need to track their
location in the generated NFA so that local FOLLOW sets can be
computed during code gen for automatic error recovery.
|
int |
ID |
DFA |
lookaheadDFA
If this is a decision node, what is the lookahead DFA?
|
NFAState |
NFAStartState
What NFA start state was built from this node?
|
NFAState |
NFATreeDownState
This is used for TREE_BEGIN nodes to point into
the NFA.
|
int |
outerAltNum
if this is an ACTION node, this is the outermost enclosing
alt num in rule.
|
Set<GrammarAST> |
rewriteRefsDeep |
Set<GrammarAST> |
rewriteRefsShallow
If this is a BLOCK node for a rewrite rule, track referenced
elements here.
|
int |
ruleStartTokenIndex
If this is a RULE node then track rule's start, stop tokens' index.
|
int |
ruleStopTokenIndex |
protected IntSet |
setValue
If this is a SET node, what are the elements?
|
Map<String,Object> |
terminalOptions |
antlr.Token |
token
This AST node was created from what token?
|
Constructor and Description |
---|
GrammarAST() |
GrammarAST(int t,
String txt) |
Modifier and Type | Method and Description |
---|---|
static GrammarAST |
dup(antlr.collections.AST t) |
static GrammarAST |
dupListNoActions(GrammarAST t,
GrammarAST parent)
Duplicate tree including siblings of root.
|
static GrammarAST |
dupTreeNoActions(GrammarAST t,
GrammarAST parent)
Duplicate a tree, assuming this is a root node of a tree--
duplicate that node and what's below; ignore siblings of root node.
|
boolean |
equals(Object ast)
Make nodes unique based upon Token so we can add them to a Set; if
not a GrammarAST, check type.
|
GrammarAST |
findFirstType(int ttype)
Return a reference to the first node (depth-first) that has
token type ttype.
|
Object |
getBlockOption(String key) |
Map<String,Object> |
getBlockOptions() |
GrammarAST |
getChild(int i)
Get the ith child from 0
|
GrammarAST[] |
getChildrenAsArray() |
int |
getColumn() |
GrammarAST |
getFirstChildWithType(int ttype) |
GrammarAST |
getLastChild() |
GrammarAST |
getLastSibling() |
int |
getLine() |
DFA |
getLookaheadDFA() |
NFAState |
getNFAStartState() |
int |
getNumberOfChildrenWithType(int ttype) |
IntSet |
getSetValue() |
String |
getText() |
antlr.Token |
getToken() |
int |
getType() |
boolean |
hasSameListStructure(antlr.collections.AST t) |
boolean |
hasSameTreeStructure(antlr.collections.AST t)
See if tree has exact token types and structure; no text
|
void |
initialize(antlr.collections.AST ast) |
void |
initialize(int i,
String s) |
void |
initialize(antlr.Token token) |
String |
setBlockOption(Grammar grammar,
String key,
Object value)
Save the option key/value pair and process it; return the key
or null if invalid option.
|
void |
setBlockOptions(Map<String,Object> blockOptions) |
void |
setColumn(int col) |
void |
setLine(int line) |
void |
setLookaheadDFA(DFA lookaheadDFA) |
void |
setNFAStartState(NFAState nfaStartState) |
String |
setOption(Map options,
Set legalOptions,
Grammar grammar,
String key,
Object value) |
void |
setOptions(Grammar grammar,
Map options) |
void |
setSetValue(IntSet setValue) |
String |
setTerminalOption(Grammar grammar,
String key,
Object value) |
void |
setText(String text) |
void |
setTreeEnclosingRuleNameDeeply(String rname) |
void |
setType(int type) |
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toString, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
public int ID
public antlr.Token token
public String enclosingRuleName
public int ruleStartTokenIndex
public int ruleStopTokenIndex
public DFA lookaheadDFA
public NFAState NFAStartState
public NFAState NFATreeDownState
public NFAState followingNFAState
protected IntSet setValue
public Set<GrammarAST> rewriteRefsShallow
public Set<GrammarAST> rewriteRefsDeep
public int outerAltNum
public org.antlr.stringtemplate.StringTemplate code
public GrammarAST()
public GrammarAST(int t, String txt)
public void setBlockOptions(Map<String,Object> blockOptions)
blockOptions
- public void initialize(int i, String s)
initialize
in interface antlr.collections.AST
initialize
in class antlr.BaseAST
public void initialize(antlr.collections.AST ast)
initialize
in interface antlr.collections.AST
initialize
in class antlr.BaseAST
public void initialize(antlr.Token token)
initialize
in interface antlr.collections.AST
initialize
in class antlr.BaseAST
public DFA getLookaheadDFA()
public void setLookaheadDFA(DFA lookaheadDFA)
public antlr.Token getToken()
public NFAState getNFAStartState()
public void setNFAStartState(NFAState nfaStartState)
public String setBlockOption(Grammar grammar, String key, Object value)
public String setOption(Map options, Set legalOptions, Grammar grammar, String key, Object value)
public String getText()
getText
in interface antlr.collections.AST
getText
in class antlr.BaseAST
public void setType(int type)
setType
in interface antlr.collections.AST
setType
in class antlr.BaseAST
public void setText(String text)
setText
in interface antlr.collections.AST
setText
in class antlr.BaseAST
public int getType()
getType
in interface antlr.collections.AST
getType
in class antlr.BaseAST
public int getLine()
getLine
in interface antlr.collections.AST
getLine
in class antlr.BaseAST
public int getColumn()
getColumn
in interface antlr.collections.AST
getColumn
in class antlr.BaseAST
public void setLine(int line)
public void setColumn(int col)
public IntSet getSetValue()
public void setSetValue(IntSet setValue)
public GrammarAST getLastChild()
public GrammarAST getLastSibling()
public GrammarAST getChild(int i)
public GrammarAST getFirstChildWithType(int ttype)
public GrammarAST[] getChildrenAsArray()
public GrammarAST findFirstType(int ttype)
public int getNumberOfChildrenWithType(int ttype)
public boolean equals(Object ast)
public boolean hasSameTreeStructure(antlr.collections.AST t)
public boolean hasSameListStructure(antlr.collections.AST t)
public static GrammarAST dup(antlr.collections.AST t)
public static GrammarAST dupListNoActions(GrammarAST t, GrammarAST parent)
public static GrammarAST dupTreeNoActions(GrammarAST t, GrammarAST parent)
public void setTreeEnclosingRuleNameDeeply(String rname)
Copyright © 2020. All rights reserved.