org.antlr.tool
Class LeftRecursiveRuleAnalyzer
java.lang.Object
org.antlr.runtime.BaseRecognizer
org.antlr.runtime.tree.TreeParser
org.antlr.grammar.v3.LeftRecursiveRuleWalker
org.antlr.tool.LeftRecursiveRuleAnalyzer
public class LeftRecursiveRuleAnalyzer
- extends LeftRecursiveRuleWalker
| Fields inherited from class org.antlr.grammar.v3.LeftRecursiveRuleWalker |
ACTION, ACTION_CHAR_LITERAL, ACTION_ESC, ACTION_STRING_LITERAL, ALT, AMPERSAND, ARG, ARG_ACTION, ARGLIST, ASSIGN, BACKTRACK_SEMPRED, BANG, BLOCK, CATCH, CHAR_LITERAL, CHAR_RANGE, CLOSE_ELEMENT_OPTION, CLOSURE, COLON, COMBINED_GRAMMAR, COMMA, COMMENT, dfa31, DIGIT, DOC_COMMENT, DOLLAR, DOT, DOUBLE_ANGLE_STRING_LITERAL, DOUBLE_QUOTE_STRING_LITERAL, EOA, EOB, EOF, EOR, EPSILON, ESC, ETC, FINALLY, FOLLOW_ACTION_in_element1359, FOLLOW_ACTION_in_exceptionHandler1194, FOLLOW_ACTION_in_finallyClause1209, FOLLOW_ACTION_in_rewrite1248, FOLLOW_ACTION_in_ruleScopeSpec282, FOLLOW_ALT_in_binary808, FOLLOW_ALT_in_binaryMultipleOp845, FOLLOW_ALT_in_binaryMultipleOp867, FOLLOW_ALT_in_block407, FOLLOW_ALT_in_outerAlternative754, FOLLOW_ALT_in_prefix943, FOLLOW_ALT_in_rewrite1235, FOLLOW_ALT_in_suffix979, FOLLOW_ALT_in_ternary903, FOLLOW_AMPERSAND_in_rec_rule209, FOLLOW_ARG_ACTION_in_atom1481, FOLLOW_ARG_ACTION_in_atom1491, FOLLOW_ARG_ACTION_in_exceptionHandler1192, FOLLOW_ARG_ACTION_in_rec_rule178, FOLLOW_ARG_ACTION_in_rec_rule188, FOLLOW_ARG_in_rec_rule176, FOLLOW_ASSIGN_in_element1313, FOLLOW_ASSIGN_in_option67, FOLLOW_ASSIGN_in_recurse1012, FOLLOW_ASSIGN_in_token1062, FOLLOW_atom_in_atom1518, FOLLOW_atom_in_element1287, FOLLOW_atom_in_element1304, FOLLOW_atom_in_element1306, FOLLOW_BACKTRACK_SEMPRED_in_binary812, FOLLOW_BACKTRACK_SEMPRED_in_binaryMultipleOp849, FOLLOW_BACKTRACK_SEMPRED_in_element1374, FOLLOW_BACKTRACK_SEMPRED_in_prefix947, FOLLOW_BACKTRACK_SEMPRED_in_suffix983, FOLLOW_BACKTRACK_SEMPRED_in_ternary907, FOLLOW_BANG_in_element1279, FOLLOW_BANG_in_token1105, FOLLOW_binary_in_outerAlternative538, FOLLOW_binary_in_synpred2_LeftRecursiveRuleWalker524, FOLLOW_binaryMultipleOp_in_outerAlternative482, FOLLOW_binaryMultipleOp_in_synpred1_LeftRecursiveRuleWalker478, FOLLOW_BLOCK_in_binaryMultipleOp861, FOLLOW_BLOCK_in_block375, FOLLOW_block_in_ebnf1396, FOLLOW_block_in_ebnf1410, FOLLOW_block_in_ebnf1427, FOLLOW_block_in_ebnf1445, FOLLOW_block_in_element1347, FOLLOW_BLOCK_in_ruleBlock309, FOLLOW_CATCH_in_exceptionHandler1190, FOLLOW_CHAR_LITERAL_in_atom1498, FOLLOW_CHAR_LITERAL_in_charSetElement109, FOLLOW_CHAR_LITERAL_in_charSetElement117, FOLLOW_CHAR_LITERAL_in_charSetElement119, FOLLOW_CHAR_LITERAL_in_charSetElement128, FOLLOW_CHAR_LITERAL_in_charSetElement130, FOLLOW_CHAR_LITERAL_in_token1119, FOLLOW_CLOSURE_in_ebnf1425, FOLLOW_DOT_in_atom1514, FOLLOW_ebnf_in_element1334, FOLLOW_element_in_block409, FOLLOW_element_in_element1272, FOLLOW_element_in_element1281, FOLLOW_element_in_element1295, FOLLOW_element_in_element1317, FOLLOW_element_in_element1328, FOLLOW_element_in_outerAlternative756, FOLLOW_element_in_prefix960, FOLLOW_element_in_suffix995, FOLLOW_element_in_tree_1465, FOLLOW_EOA_in_binary828, FOLLOW_EOA_in_binaryMultipleOp873, FOLLOW_EOA_in_binaryMultipleOp888, FOLLOW_EOA_in_block412, FOLLOW_EOA_in_outerAlternative759, FOLLOW_EOA_in_prefix966, FOLLOW_EOA_in_suffix999, FOLLOW_EOA_in_ternary927, FOLLOW_EOB_in_binaryMultipleOp882, FOLLOW_EOB_in_block433, FOLLOW_EOB_in_ruleBlock352, FOLLOW_EOR_in_rec_rule233, FOLLOW_EPSILON_in_element1384, FOLLOW_ETC_in_rewrite1250, FOLLOW_exceptionGroup_in_rec_rule227, FOLLOW_exceptionHandler_in_exceptionGroup1166, FOLLOW_FINALLY_in_finallyClause1207, FOLLOW_finallyClause_in_exceptionGroup1169, FOLLOW_finallyClause_in_exceptionGroup1175, FOLLOW_FORCED_ACTION_in_element1354, FOLLOW_GATED_SEMPRED_in_element1379, FOLLOW_ID_in_atom1516, FOLLOW_ID_in_element1315, FOLLOW_ID_in_element1326, FOLLOW_ID_in_option69, FOLLOW_ID_in_rec_rule162, FOLLOW_ID_in_recurse1014, FOLLOW_ID_in_recurse1025, FOLLOW_ID_in_ruleScopeSpec285, FOLLOW_ID_in_token1064, FOLLOW_ID_in_token1079, FOLLOW_modifier_in_rec_rule169, FOLLOW_NOT_in_element1293, FOLLOW_option_in_optionsSpec53, FOLLOW_OPTIONAL_in_ebnf1408, FOLLOW_OPTIONS_in_optionsSpec51, FOLLOW_optionsSpec_in_block389, FOLLOW_optionsSpec_in_rec_rule195, FOLLOW_optionsSpec_in_ruleBlock314, FOLLOW_optionValue_in_option71, FOLLOW_OR_in_charSetElement115, FOLLOW_outerAlternative_in_ruleBlock322, FOLLOW_PLUS_ASSIGN_in_element1324, FOLLOW_PLUS_ASSIGN_in_recurse1023, FOLLOW_PLUS_ASSIGN_in_token1077, FOLLOW_POSITIVE_CLOSURE_in_ebnf1443, FOLLOW_prefix_in_outerAlternative656, FOLLOW_prefix_in_synpred4_LeftRecursiveRuleWalker642, FOLLOW_RANGE_in_charSetElement126, FOLLOW_RANGE_in_element1302, FOLLOW_recurse_in_binary826, FOLLOW_recurse_in_binaryMultipleOp886, FOLLOW_recurse_in_prefix964, FOLLOW_recurse_in_ternary921, FOLLOW_recurse_in_ternary925, FOLLOW_recurseNoLabel_in_binary820, FOLLOW_recurseNoLabel_in_binaryMultipleOp857, FOLLOW_recurseNoLabel_in_recurse1016, FOLLOW_recurseNoLabel_in_recurse1027, FOLLOW_recurseNoLabel_in_recurse1033, FOLLOW_recurseNoLabel_in_suffix991, FOLLOW_recurseNoLabel_in_ternary915, FOLLOW_RET_in_rec_rule186, FOLLOW_rewrite_in_block415, FOLLOW_REWRITE_in_rewrite1228, FOLLOW_rewrite_in_ruleBlock334, FOLLOW_REWRITES_in_rewrite1222, FOLLOW_ROOT_in_element1270, FOLLOW_ROOT_in_token1092, FOLLOW_RULE_in_rec_rule158, FOLLOW_RULE_REF_in_atom1479, FOLLOW_RULE_REF_in_recurseNoLabel1045, FOLLOW_ruleBlock_in_rec_rule220, FOLLOW_ruleScopeSpec_in_rec_rule201, FOLLOW_SCOPE_in_ruleScopeSpec280, FOLLOW_SEMPRED_in_element1364, FOLLOW_SEMPRED_in_rewrite1230, FOLLOW_set_in_ast_suffix0, FOLLOW_set_in_modifier0, FOLLOW_set_in_optionValue0, FOLLOW_STRING_LITERAL_in_atom1503, FOLLOW_STRING_LITERAL_in_token1133, FOLLOW_suffix_in_outerAlternative712, FOLLOW_suffix_in_synpred5_LeftRecursiveRuleWalker698, FOLLOW_SYN_SEMPRED_in_element1369, FOLLOW_SYNPRED_in_element1345, FOLLOW_TEMPLATE_in_rewrite1242, FOLLOW_ternary_in_outerAlternative600, FOLLOW_ternary_in_synpred3_LeftRecursiveRuleWalker587, FOLLOW_token_in_binary824, FOLLOW_token_in_binaryMultipleOp871, FOLLOW_token_in_ternary919, FOLLOW_token_in_ternary923, FOLLOW_token_in_token1068, FOLLOW_token_in_token1083, FOLLOW_token_in_token1096, FOLLOW_token_in_token1109, FOLLOW_TOKEN_REF_in_atom1489, FOLLOW_TOKEN_REF_in_token1145, FOLLOW_tree__in_element1339, FOLLOW_TREE_BEGIN_in_tree_1463, FOLLOW_WILDCARD_in_atom1508, FORCED_ACTION, FRAGMENT, GATED_SEMPRED, grammar, GRAMMAR, ID, IMPLIES, IMPORT, INITACTION, INT, LABEL, LEXER, LEXER_GRAMMAR, LPAREN, ML_COMMENT, NESTED_ACTION, NESTED_ARG_ACTION, NOT, numAlts, OPEN_ELEMENT_OPTION, OPTIONAL, OPTIONS, OR, PARSER, PARSER_GRAMMAR, PLUS, PLUS_ASSIGN, POSITIVE_CLOSURE, PREC_RULE, PRIVATE, PROTECTED, PUBLIC, QUESTION, RANGE, RCURLY, RECURSIVE_RULE_REF, RET, RETURNS, REWRITE, REWRITES, ROOT, RPAREN, RULE, RULE_REF, SCOPE, SEMI, SEMPRED, SL_COMMENT, SRC, STAR, STRAY_BRACKET, STRING_LITERAL, SYN_SEMPRED, SYNPRED, TEMPLATE, THROWS, TOKEN_REF, tokenNames, TOKENS, TREE, TREE_BEGIN, TREE_GRAMMAR, WILDCARD, WS, WS_LOOP, WS_OPT, XDIGIT |
|
Method Summary |
void |
binaryAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
|
void |
fillRetValAssignments(org.stringtemplate.v4.ST ruleST,
String srcName)
|
String |
getArtificialOpPrecRule()
|
String |
getArtificialPrecStartRule()
|
String |
getArtificialPrimaryRule()
|
Collection<String> |
getNamesFromArgAction(Token t)
|
static boolean |
hasImmediateRecursiveRuleRefs(GrammarAST t,
String ruleName)
|
void |
loadPrecRuleTemplates()
|
int |
nextPrecedence(int alt)
|
void |
otherAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
|
int |
precedence(int alt)
|
void |
prefixAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
|
GrammarAST |
replaceLastRuleRef(GrammarAST t,
String name)
|
GrammarAST |
replaceRuleRefs(GrammarAST t,
String name)
|
void |
setReturnValues(GrammarAST t)
|
void |
setTokenPrec(GrammarAST t,
int alt)
|
void |
stripLeftRecursion(GrammarAST altAST)
|
void |
stripSynPred(GrammarAST altAST)
|
void |
suffixAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
|
void |
ternaryAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
Convert e ? e : e -> ? e : e_[nextPrec] |
String |
text(GrammarAST t)
|
String |
toString()
|
| Methods inherited from class org.antlr.grammar.v3.LeftRecursiveRuleWalker |
ast_suffix, atom, binary, binaryMultipleOp, block, charSetElement, ebnf, element, exceptionGroup, exceptionHandler, finallyClause, getGrammarFileName, getTokenNames, modifier, option, optionsSpec, optionValue, outerAlternative, prefix, rec_rule, recurse, recurseNoLabel, reportError, rewrite, ruleBlock, ruleScopeSpec, suffix, synpred1_LeftRecursiveRuleWalker_fragment, synpred1_LeftRecursiveRuleWalker, synpred2_LeftRecursiveRuleWalker_fragment, synpred2_LeftRecursiveRuleWalker, synpred3_LeftRecursiveRuleWalker_fragment, synpred3_LeftRecursiveRuleWalker, synpred4_LeftRecursiveRuleWalker_fragment, synpred4_LeftRecursiveRuleWalker, synpred5_LeftRecursiveRuleWalker_fragment, synpred5_LeftRecursiveRuleWalker, ternary, token, tree_ |
| Methods inherited from class org.antlr.runtime.tree.TreeParser |
getAncestor, getCurrentInputSymbol, getErrorHeader, getErrorMessage, getMissingSymbol, getSourceName, getTreeNodeStream, inContext, inContext, matchAny, recoverFromMismatchedToken, reset, setTreeNodeStream, traceIn, traceOut |
| Methods inherited from class org.antlr.runtime.BaseRecognizer |
alreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, emitErrorMessage, endResync, failed, getBacktrackingLevel, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, match, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, setBacktrackingLevel, toStrings, traceIn, traceOut |
g
public Grammar g
generator
public CodeGenerator generator
ruleName
public String ruleName
binaryAlts
public LinkedHashMap<Integer,String> binaryAlts
ternaryAlts
public LinkedHashMap<Integer,String> ternaryAlts
suffixAlts
public LinkedHashMap<Integer,String> suffixAlts
prefixAlts
public List<String> prefixAlts
otherAlts
public List<String> otherAlts
retvals
public GrammarAST retvals
recRuleTemplates
public org.stringtemplate.v4.STGroup recRuleTemplates
language
public String language
altAssociativity
public Map<Integer,LeftRecursiveRuleAnalyzer.ASSOC> altAssociativity
LeftRecursiveRuleAnalyzer
public LeftRecursiveRuleAnalyzer(TreeNodeStream input,
Grammar g,
String ruleName)
loadPrecRuleTemplates
public void loadPrecRuleTemplates()
setReturnValues
public void setReturnValues(GrammarAST t)
- Overrides:
setReturnValues in class LeftRecursiveRuleWalker
setTokenPrec
public void setTokenPrec(GrammarAST t,
int alt)
- Overrides:
setTokenPrec in class LeftRecursiveRuleWalker
binaryAlt
public void binaryAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
- Overrides:
binaryAlt in class LeftRecursiveRuleWalker
ternaryAlt
public void ternaryAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
- Convert e ? e : e -> ? e : e_[nextPrec]
- Overrides:
ternaryAlt in class LeftRecursiveRuleWalker
prefixAlt
public void prefixAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
- Overrides:
prefixAlt in class LeftRecursiveRuleWalker
suffixAlt
public void suffixAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
- Overrides:
suffixAlt in class LeftRecursiveRuleWalker
otherAlt
public void otherAlt(GrammarAST altTree,
GrammarAST rewriteTree,
int alt)
- Overrides:
otherAlt in class LeftRecursiveRuleWalker
getArtificialPrecStartRule
public String getArtificialPrecStartRule()
getArtificialOpPrecRule
public String getArtificialOpPrecRule()
getArtificialPrimaryRule
public String getArtificialPrimaryRule()
replaceRuleRefs
public GrammarAST replaceRuleRefs(GrammarAST t,
String name)
hasImmediateRecursiveRuleRefs
public static boolean hasImmediateRecursiveRuleRefs(GrammarAST t,
String ruleName)
replaceLastRuleRef
public GrammarAST replaceLastRuleRef(GrammarAST t,
String name)
stripSynPred
public void stripSynPred(GrammarAST altAST)
stripLeftRecursion
public void stripLeftRecursion(GrammarAST altAST)
text
public String text(GrammarAST t)
precedence
public int precedence(int alt)
nextPrecedence
public int nextPrecedence(int alt)
fillRetValAssignments
public void fillRetValAssignments(org.stringtemplate.v4.ST ruleST,
String srcName)
getNamesFromArgAction
public Collection<String> getNamesFromArgAction(Token t)
toString
public String toString()
- Overrides:
toString in class Object
Copyright © 2011. All Rights Reserved.