LA(int i) Return the token type of the ith token of lookahead where i=1
is the current token being examined by the parser (i.e., it
has not been matched yet).
alreadyParsedRule(int ruleIndex) Has this rule already parsed input at the current index in the
input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
getRuleMemoization(int ruleIndex, int ruleStartIndex) Given a rule number and a start token index number, return
MEMO_RULE_UNKNOWN if the rule has not parsed input starting from
start index.
getTokenTypeToASTClassMap() If the user specifies a tokens{} section with heterogeneous
AST node types, then ANTLR generates code to fill
this mapping.
match(int t) Make sure current lookahead symbol matches token type t.
public void
match(BitSet b) Make sure current lookahead symbol matches the given set
Throw an exception upon mismatch, which is catch by either the
error handler or by the syntactic predicate.
setASTNodeType(String nodeType) Specify the type of node to create during tree building; use setASTNodeClass now
to be consistent with Token Object Type accessor.
AST support code; parser delegates to this object.
This is set during parser construction by default
to either "new ASTFactory()" or a ctor that
has a token type to class map for hetero nodes.
An array[size num rules] of Map that tracks
the stop token index for each rule. ruleMemo[ruleIndex] is
the memoization table for ruleIndex. For key ruleStartIndex, you
get back the stop token for associated rule or MEMO_RULE_FAILED.
public boolean alreadyParsedRule(int ruleIndex)(Code)
Has this rule already parsed input at the current index in the
input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
If we attempted but failed to parse properly before, return
MEMO_RULE_FAILED.
This method has a side-effect: if we have seen this input for
this rule and successfully parsed before, then seek ahead to
1 past the stop token matched for this rule last time.
public int getRuleMemoization(int ruleIndex, int ruleStartIndex)(Code)
Given a rule number and a start token index number, return
MEMO_RULE_UNKNOWN if the rule has not parsed input starting from
start index. If this rule has parsed input starting from the
start index before, then return where the rule stopped parsing.
It returns the index of the last token matched by the rule.
For now we use a hashtable and just the slow Object-based one.
Later, we can make a special one for ints and also one that
tosses out data after we commit past input position i.
Make sure current lookahead symbol matches token type t.
Throw an exception upon mismatch, which is catch by either the
error handler or by the syntactic predicate.
Make sure current lookahead symbol matches the given set
Throw an exception upon mismatch, which is catch by either the
error handler or by the syntactic predicate.