public class LeftRecursiveRuleAnalyzer extends LeftRecursiveRuleWalker
| Modifier and Type | Class and Description |
|---|---|
static class |
LeftRecursiveRuleAnalyzer.ASSOC |
LeftRecursiveRuleWalker.DFA11, LeftRecursiveRuleWalker.DFA14, LeftRecursiveRuleWalker.outerAlternative_return, LeftRecursiveRuleWalker.ruleBlock_return| Modifier and Type | Field and Description |
|---|---|
java.util.Map<java.lang.Integer,LeftRecursiveRuleAnalyzer.ASSOC> |
altAssociativity |
java.util.LinkedHashMap<java.lang.Integer,LeftRecursiveRuleAltInfo> |
binaryAlts |
org.stringtemplate.v4.STGroup |
codegenTemplates |
java.lang.String |
language |
java.util.List<Pair<GrammarAST,java.lang.String>> |
leftRecursiveRuleRefLabels
Pointer to ID node of ^(= ID element)
|
java.util.List<LeftRecursiveRuleAltInfo> |
otherAlts |
java.util.List<LeftRecursiveRuleAltInfo> |
prefixAlts |
org.stringtemplate.v4.STGroup |
recRuleTemplates |
GrammarAST |
retvals |
java.lang.String |
ruleName |
java.util.LinkedHashMap<java.lang.Integer,LeftRecursiveRuleAltInfo> |
suffixAlts |
java.util.LinkedHashMap<java.lang.Integer,LeftRecursiveRuleAltInfo> |
ternaryAlts |
org.antlr.runtime.TokenStream |
tokenStream
Tokens from which rule AST comes from
|
Tool |
tool |
ACTION, ACTION_CHAR_LITERAL, ACTION_ESC, ACTION_STRING_LITERAL, ALT, ALTLIST, ARG, ARG_ACTION, ARG_OR_CHARSET, ARGLIST, ASSIGN, AT, BLOCK, CATCH, CHANNELS, CHAR_RANGE, CLOSURE, COLON, COLONCOLON, COMBINED, COMMA, COMMENT, dfa11, dfa14, DOC_COMMENT, DOLLAR, DOT, ELEMENT_OPTIONS, EOF, EPSILON, ERRCHAR, ESC_SEQ, FINALLY, FOLLOW_ACTION_in_block1183, FOLLOW_ACTION_in_elementOption925, FOLLOW_ACTION_in_epsilonElement1042, FOLLOW_ACTION_in_epsilonElement1058, FOLLOW_ACTION_in_exceptionHandler220, FOLLOW_ACTION_in_finallyClause235, FOLLOW_ACTION_in_rec_rule156, FOLLOW_ALT_in_alternative1203, FOLLOW_ALT_in_binary541, FOLLOW_ALT_in_nonLeftRecur675, FOLLOW_ALT_in_prefix579, FOLLOW_ALT_in_suffix634, FOLLOW_alternative_in_block1186, FOLLOW_ARG_ACTION_in_atom1227, FOLLOW_ARG_ACTION_in_exceptionHandler218, FOLLOW_ARG_ACTION_in_rec_rule117, FOLLOW_ARG_ACTION_in_rec_rule96, FOLLOW_ASSIGN_in_element982, FOLLOW_ASSIGN_in_elementOption889, FOLLOW_ASSIGN_in_elementOption905, FOLLOW_ASSIGN_in_elementOption921, FOLLOW_ASSIGN_in_elementOption937, FOLLOW_ASSIGN_in_recurse697, FOLLOW_ASSIGN_in_token744, FOLLOW_AT_in_rec_rule152, FOLLOW_atom_in_element956, FOLLOW_atom_in_element973, FOLLOW_atom_in_element975, FOLLOW_binary_in_outerAlternative362, FOLLOW_binary_in_synpred1_LeftRecursiveRuleWalker348, FOLLOW_BLOCK_in_block1181, FOLLOW_block_in_ebnf1115, FOLLOW_block_in_ebnf1129, FOLLOW_block_in_ebnf1145, FOLLOW_block_in_ebnf1161, FOLLOW_BLOCK_in_ruleBlock290, FOLLOW_CATCH_in_exceptionHandler216, FOLLOW_CLOSURE_in_ebnf1143, FOLLOW_DOT_in_atom1290, FOLLOW_ebnf_in_element1026, FOLLOW_element_in_alternative1208, FOLLOW_element_in_atom1294, FOLLOW_element_in_binary548, FOLLOW_element_in_element964, FOLLOW_element_in_element986, FOLLOW_element_in_element997, FOLLOW_element_in_nonLeftRecur680, FOLLOW_element_in_prefix590, FOLLOW_element_in_suffix641, FOLLOW_ELEMENT_OPTIONS_in_elementOptions857, FOLLOW_elementOption_in_elementOptions859, FOLLOW_elementOptions_in_alternative1205, FOLLOW_elementOptions_in_atom1230, FOLLOW_elementOptions_in_atom1244, FOLLOW_elementOptions_in_atom1261, FOLLOW_elementOptions_in_atom1278, FOLLOW_elementOptions_in_binary543, FOLLOW_elementOptions_in_epsilonElement1060, FOLLOW_elementOptions_in_epsilonElement1069, FOLLOW_elementOptions_in_nonLeftRecur677, FOLLOW_elementOptions_in_prefix581, FOLLOW_elementOptions_in_setElement1084, FOLLOW_elementOptions_in_setElement1093, FOLLOW_elementOptions_in_suffix636, FOLLOW_elementOptions_in_token798, FOLLOW_elementOptions_in_token815, FOLLOW_EPSILON_in_epsilonElement1052, FOLLOW_epsilonElement_in_binary553, FOLLOW_epsilonElement_in_element1031, FOLLOW_epsilonElement_in_prefix599, FOLLOW_exceptionGroup_in_rec_rule179, FOLLOW_exceptionHandler_in_exceptionGroup197, FOLLOW_FINALLY_in_finallyClause233, FOLLOW_finallyClause_in_exceptionGroup200, FOLLOW_ID_in_atom1292, FOLLOW_ID_in_element984, FOLLOW_ID_in_element995, FOLLOW_ID_in_elementOption878, FOLLOW_ID_in_elementOption891, FOLLOW_ID_in_elementOption893, FOLLOW_ID_in_elementOption907, FOLLOW_ID_in_elementOption923, FOLLOW_ID_in_elementOption939, FOLLOW_ID_in_rec_rule154, FOLLOW_ID_in_recurse699, FOLLOW_ID_in_recurse710, FOLLOW_ID_in_token746, FOLLOW_ID_in_token761, FOLLOW_INT_in_elementOption941, FOLLOW_LOCALS_in_rec_rule115, FOLLOW_nonLeftRecur_in_outerAlternative515, FOLLOW_NOT_in_element962, FOLLOW_OPTIONAL_in_ebnf1127, FOLLOW_OPTIONS_in_rec_rule135, FOLLOW_outerAlternative_in_ruleBlock303, FOLLOW_PLUS_ASSIGN_in_element993, FOLLOW_PLUS_ASSIGN_in_recurse708, FOLLOW_PLUS_ASSIGN_in_token759, FOLLOW_POSITIVE_CLOSURE_in_ebnf1159, FOLLOW_prefix_in_outerAlternative418, FOLLOW_prefix_in_synpred2_LeftRecursiveRuleWalker404, FOLLOW_RANGE_in_element971, FOLLOW_recurse_in_binary546, FOLLOW_recurse_in_binary551, FOLLOW_recurse_in_prefix597, FOLLOW_recurse_in_suffix639, FOLLOW_recurseNoLabel_in_recurse701, FOLLOW_recurseNoLabel_in_recurse712, FOLLOW_recurseNoLabel_in_recurse718, FOLLOW_RETURNS_in_rec_rule92, FOLLOW_RULE_in_rec_rule72, FOLLOW_RULE_REF_in_atom1225, FOLLOW_RULE_REF_in_element1021, FOLLOW_RULE_REF_in_rec_rule76, FOLLOW_RULE_REF_in_recurseNoLabel730, FOLLOW_ruleBlock_in_rec_rule172, FOLLOW_ruleModifier_in_rec_rule83, FOLLOW_SEMPRED_in_epsilonElement1047, FOLLOW_SEMPRED_in_epsilonElement1067, FOLLOW_SET_in_element1007, FOLLOW_setElement_in_element1009, FOLLOW_STRING_LITERAL_in_atom1242, FOLLOW_STRING_LITERAL_in_atom1250, FOLLOW_STRING_LITERAL_in_elementOption909, FOLLOW_STRING_LITERAL_in_setElement1082, FOLLOW_STRING_LITERAL_in_setElement1099, FOLLOW_STRING_LITERAL_in_token775, FOLLOW_STRING_LITERAL_in_token796, FOLLOW_suffix_in_outerAlternative474, FOLLOW_suffix_in_synpred3_LeftRecursiveRuleWalker460, FOLLOW_token_in_token750, FOLLOW_token_in_token765, FOLLOW_TOKEN_REF_in_atom1259, FOLLOW_TOKEN_REF_in_atom1267, FOLLOW_TOKEN_REF_in_setElement1091, FOLLOW_TOKEN_REF_in_setElement1104, FOLLOW_TOKEN_REF_in_token813, FOLLOW_TOKEN_REF_in_token827, FOLLOW_WILDCARD_in_atom1276, FOLLOW_WILDCARD_in_atom1284, FRAGMENT, GRAMMAR, GT, HEX_DIGIT, ID, IMPORT, INITACTION, INT, LABEL, LEXER, LEXER_ACTION_CALL, LEXER_ALT_ACTION, LEXER_CHAR_SET, LIST, LOCALS, LPAREN, LT, MODE, NameChar, NameStartChar, NESTED_ACTION, NLCHARS, NOT, numAlts, OPTIONAL, OPTIONS, OR, PARSER, PLUS, PLUS_ASSIGN, POSITIVE_CLOSURE, POUND, PREC_RULE, PRIVATE, PROTECTED, PUBLIC, QUESTION, RANGE, RARROW, RBRACE, RESULT, RET, RETURNS, RPAREN, RULE, RULE_REF, RULEACTIONS, RULEMODIFIERS, RULES, SEMI, SEMPRED, SET, SRC, STAR, STRING_LITERAL, SYNPRED, TEMPLATE, THROWS, TOKEN_REF, tokenNames, TOKENS_SPEC, TREE_GRAMMAR, UNICODE_ESC, UnicodeBOM, WILDCARD, WS, WSCHARS, WSNLCHARS| Constructor and Description |
|---|
LeftRecursiveRuleAnalyzer(GrammarAST ruleAST,
Tool tool,
java.lang.String ruleName,
java.lang.String language) |
| Modifier and Type | Method and Description |
|---|---|
AltAST |
addPrecedenceArgToRules(AltAST t,
int prec) |
void |
binaryAlt(AltAST originalAltTree,
int alt) |
java.lang.String |
getArtificialOpPrecRule() |
static boolean |
hasImmediateRecursiveRuleRefs(GrammarAST t,
java.lang.String ruleName)
Match (RULE RULE_REF (BLOCK (ALT .*) (ALT RULE_REF[self] .*) (ALT .*)))
Match (RULE RULE_REF (BLOCK (ALT .*) (ALT (ASSIGN ID RULE_REF[self]) .*) (ALT .*)))
|
void |
loadPrecRuleTemplates() |
int |
nextPrecedence(int alt) |
void |
otherAlt(AltAST originalAltTree,
int alt) |
int |
precedence(int alt) |
void |
prefixAlt(AltAST originalAltTree,
int alt) |
void |
setAltAssoc(AltAST t,
int alt) |
void |
setReturnValues(GrammarAST t) |
void |
stripAltLabel(GrammarAST altAST)
Strip last 2 tokens if -> label; alter indexes in altAST
|
GrammarAST |
stripLeftRecursion(GrammarAST altAST) |
void |
suffixAlt(AltAST originalAltTree,
int alt) |
java.lang.String |
text(GrammarAST t) |
java.lang.String |
toString() |
alternative, atom, binary, block, ebnf, element, elementOption, elementOptions, epsilonElement, exceptionGroup, exceptionHandler, finallyClause, getDelegates, getGrammarFileName, getTokenNames, nonLeftRecur, outerAlternative, prefix, rec_rule, recurse, recurseNoLabel, ruleBlock, ruleModifier, setElement, suffix, synpred1_LeftRecursiveRuleWalker_fragment, synpred1_LeftRecursiveRuleWalker, synpred2_LeftRecursiveRuleWalker_fragment, synpred2_LeftRecursiveRuleWalker, synpred3_LeftRecursiveRuleWalker_fragment, synpred3_LeftRecursiveRuleWalker, tokengetAncestor, getCurrentInputSymbol, getErrorHeader, getErrorMessage, getMissingSymbol, getSourceName, getTreeNodeStream, inContext, inContext, matchAny, recoverFromMismatchedToken, reset, setTreeNodeStream, traceIn, traceOutalreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, emitErrorMessage, endResync, failed, getBacktrackingLevel, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, match, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, reportError, setBacktrackingLevel, toStrings, traceIn, traceOutpublic Tool tool
public java.lang.String ruleName
public java.util.LinkedHashMap<java.lang.Integer,LeftRecursiveRuleAltInfo> binaryAlts
public java.util.LinkedHashMap<java.lang.Integer,LeftRecursiveRuleAltInfo> ternaryAlts
public java.util.LinkedHashMap<java.lang.Integer,LeftRecursiveRuleAltInfo> suffixAlts
public java.util.List<LeftRecursiveRuleAltInfo> prefixAlts
public java.util.List<LeftRecursiveRuleAltInfo> otherAlts
public java.util.List<Pair<GrammarAST,java.lang.String>> leftRecursiveRuleRefLabels
public final org.antlr.runtime.TokenStream tokenStream
public GrammarAST retvals
public org.stringtemplate.v4.STGroup recRuleTemplates
public org.stringtemplate.v4.STGroup codegenTemplates
public java.lang.String language
public java.util.Map<java.lang.Integer,LeftRecursiveRuleAnalyzer.ASSOC> altAssociativity
public LeftRecursiveRuleAnalyzer(GrammarAST ruleAST, Tool tool, java.lang.String ruleName, java.lang.String language)
public void loadPrecRuleTemplates()
public void setReturnValues(GrammarAST t)
setReturnValues in class LeftRecursiveRuleWalkerpublic void setAltAssoc(AltAST t, int alt)
setAltAssoc in class LeftRecursiveRuleWalkerpublic void binaryAlt(AltAST originalAltTree, int alt)
binaryAlt in class LeftRecursiveRuleWalkerpublic void prefixAlt(AltAST originalAltTree, int alt)
prefixAlt in class LeftRecursiveRuleWalkerpublic void suffixAlt(AltAST originalAltTree, int alt)
suffixAlt in class LeftRecursiveRuleWalkerpublic void otherAlt(AltAST originalAltTree, int alt)
otherAlt in class LeftRecursiveRuleWalkerpublic java.lang.String getArtificialOpPrecRule()
public static boolean hasImmediateRecursiveRuleRefs(GrammarAST t, java.lang.String ruleName)
public GrammarAST stripLeftRecursion(GrammarAST altAST)
public void stripAltLabel(GrammarAST altAST)
public java.lang.String text(GrammarAST t)
public int precedence(int alt)
public int nextPrecedence(int alt)
public java.lang.String toString()
toString in class java.lang.Object