Package 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
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.antlr.grammar.v3.LeftRecursiveRuleWalker
LeftRecursiveRuleWalker.outerAlternative_return, LeftRecursiveRuleWalker.ruleBlock_return
-
Field Summary
FieldsModifier and TypeFieldDescriptionorg.stringtemplate.v4.STGroup
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, DIGIT, DOC_COMMENT, DOLLAR, DOT, DOUBLE_ANGLE_STRING_LITERAL, DOUBLE_QUOTE_STRING_LITERAL, EOA, EOB, EOF, EOR, EPSILON, ESC, ETC, FINALLY, FOLLOW_ACTION_in_element1365, FOLLOW_ACTION_in_exceptionHandler1200, FOLLOW_ACTION_in_finallyClause1215, FOLLOW_ACTION_in_rewrite1254, FOLLOW_ACTION_in_ruleScopeSpec288, FOLLOW_ALT_in_binary814, FOLLOW_ALT_in_binaryMultipleOp851, FOLLOW_ALT_in_binaryMultipleOp873, FOLLOW_ALT_in_block413, FOLLOW_ALT_in_outerAlternative760, FOLLOW_ALT_in_prefix949, FOLLOW_ALT_in_rewrite1241, FOLLOW_ALT_in_suffix985, FOLLOW_ALT_in_ternary909, FOLLOW_AMPERSAND_in_rec_rule215, FOLLOW_ARG_ACTION_in_atom1487, FOLLOW_ARG_ACTION_in_atom1497, FOLLOW_ARG_ACTION_in_exceptionHandler1198, FOLLOW_ARG_ACTION_in_rec_rule184, FOLLOW_ARG_ACTION_in_rec_rule194, FOLLOW_ARG_in_rec_rule182, FOLLOW_ASSIGN_in_element1319, FOLLOW_ASSIGN_in_option73, FOLLOW_ASSIGN_in_recurse1018, FOLLOW_ASSIGN_in_token1068, FOLLOW_atom_in_atom1524, FOLLOW_atom_in_element1293, FOLLOW_atom_in_element1310, FOLLOW_atom_in_element1312, FOLLOW_BACKTRACK_SEMPRED_in_binary818, FOLLOW_BACKTRACK_SEMPRED_in_binaryMultipleOp855, FOLLOW_BACKTRACK_SEMPRED_in_element1380, FOLLOW_BACKTRACK_SEMPRED_in_prefix953, FOLLOW_BACKTRACK_SEMPRED_in_suffix989, FOLLOW_BACKTRACK_SEMPRED_in_ternary913, FOLLOW_BANG_in_element1285, FOLLOW_BANG_in_token1111, FOLLOW_binary_in_outerAlternative544, FOLLOW_binary_in_synpred2_LeftRecursiveRuleWalker530, FOLLOW_binaryMultipleOp_in_outerAlternative488, FOLLOW_binaryMultipleOp_in_synpred1_LeftRecursiveRuleWalker484, FOLLOW_BLOCK_in_binaryMultipleOp867, FOLLOW_BLOCK_in_block381, FOLLOW_block_in_ebnf1402, FOLLOW_block_in_ebnf1416, FOLLOW_block_in_ebnf1433, FOLLOW_block_in_ebnf1451, FOLLOW_block_in_element1353, FOLLOW_BLOCK_in_ruleBlock315, FOLLOW_CATCH_in_exceptionHandler1196, FOLLOW_CHAR_LITERAL_in_atom1504, FOLLOW_CHAR_LITERAL_in_charSetElement115, FOLLOW_CHAR_LITERAL_in_charSetElement123, FOLLOW_CHAR_LITERAL_in_charSetElement125, FOLLOW_CHAR_LITERAL_in_charSetElement134, FOLLOW_CHAR_LITERAL_in_charSetElement136, FOLLOW_CHAR_LITERAL_in_token1125, FOLLOW_CLOSURE_in_ebnf1431, FOLLOW_DOT_in_atom1520, FOLLOW_ebnf_in_element1340, FOLLOW_element_in_block415, FOLLOW_element_in_element1278, FOLLOW_element_in_element1287, FOLLOW_element_in_element1301, FOLLOW_element_in_element1323, FOLLOW_element_in_element1334, FOLLOW_element_in_outerAlternative762, FOLLOW_element_in_prefix966, FOLLOW_element_in_suffix1001, FOLLOW_element_in_tree_1471, FOLLOW_EOA_in_binary834, FOLLOW_EOA_in_binaryMultipleOp879, FOLLOW_EOA_in_binaryMultipleOp894, FOLLOW_EOA_in_block418, FOLLOW_EOA_in_outerAlternative765, FOLLOW_EOA_in_prefix972, FOLLOW_EOA_in_suffix1005, FOLLOW_EOA_in_ternary933, FOLLOW_EOB_in_binaryMultipleOp888, FOLLOW_EOB_in_block439, FOLLOW_EOB_in_ruleBlock358, FOLLOW_EOR_in_rec_rule239, FOLLOW_EPSILON_in_element1390, FOLLOW_ETC_in_rewrite1256, FOLLOW_exceptionGroup_in_rec_rule233, FOLLOW_exceptionHandler_in_exceptionGroup1172, FOLLOW_FINALLY_in_finallyClause1213, FOLLOW_finallyClause_in_exceptionGroup1175, FOLLOW_finallyClause_in_exceptionGroup1181, FOLLOW_FORCED_ACTION_in_element1360, FOLLOW_GATED_SEMPRED_in_element1385, FOLLOW_ID_in_atom1522, FOLLOW_ID_in_element1321, FOLLOW_ID_in_element1332, FOLLOW_ID_in_option75, FOLLOW_ID_in_rec_rule168, FOLLOW_ID_in_recurse1020, FOLLOW_ID_in_recurse1031, FOLLOW_ID_in_ruleScopeSpec291, FOLLOW_ID_in_token1070, FOLLOW_ID_in_token1085, FOLLOW_modifier_in_rec_rule175, FOLLOW_NOT_in_element1299, FOLLOW_option_in_optionsSpec59, FOLLOW_OPTIONAL_in_ebnf1414, FOLLOW_OPTIONS_in_optionsSpec57, FOLLOW_optionsSpec_in_block395, FOLLOW_optionsSpec_in_rec_rule201, FOLLOW_optionsSpec_in_ruleBlock320, FOLLOW_optionValue_in_option77, FOLLOW_OR_in_charSetElement121, FOLLOW_outerAlternative_in_ruleBlock328, FOLLOW_PLUS_ASSIGN_in_element1330, FOLLOW_PLUS_ASSIGN_in_recurse1029, FOLLOW_PLUS_ASSIGN_in_token1083, FOLLOW_POSITIVE_CLOSURE_in_ebnf1449, FOLLOW_prefix_in_outerAlternative662, FOLLOW_prefix_in_synpred4_LeftRecursiveRuleWalker648, FOLLOW_RANGE_in_charSetElement132, FOLLOW_RANGE_in_element1308, FOLLOW_recurse_in_binary832, FOLLOW_recurse_in_binaryMultipleOp892, FOLLOW_recurse_in_prefix970, FOLLOW_recurse_in_ternary927, FOLLOW_recurse_in_ternary931, FOLLOW_recurseNoLabel_in_binary826, FOLLOW_recurseNoLabel_in_binaryMultipleOp863, FOLLOW_recurseNoLabel_in_recurse1022, FOLLOW_recurseNoLabel_in_recurse1033, FOLLOW_recurseNoLabel_in_recurse1039, FOLLOW_recurseNoLabel_in_suffix997, FOLLOW_recurseNoLabel_in_ternary921, FOLLOW_RET_in_rec_rule192, FOLLOW_rewrite_in_block421, FOLLOW_REWRITE_in_rewrite1234, FOLLOW_rewrite_in_ruleBlock340, FOLLOW_REWRITES_in_rewrite1228, FOLLOW_ROOT_in_element1276, FOLLOW_ROOT_in_token1098, FOLLOW_RULE_in_rec_rule164, FOLLOW_RULE_REF_in_atom1485, FOLLOW_RULE_REF_in_recurseNoLabel1051, FOLLOW_ruleBlock_in_rec_rule226, FOLLOW_ruleScopeSpec_in_rec_rule207, FOLLOW_SCOPE_in_ruleScopeSpec286, FOLLOW_SEMPRED_in_element1370, FOLLOW_SEMPRED_in_rewrite1236, FOLLOW_STRING_LITERAL_in_atom1509, FOLLOW_STRING_LITERAL_in_token1139, FOLLOW_suffix_in_outerAlternative718, FOLLOW_suffix_in_synpred5_LeftRecursiveRuleWalker704, FOLLOW_SYN_SEMPRED_in_element1375, FOLLOW_SYNPRED_in_element1351, FOLLOW_TEMPLATE_in_rewrite1248, FOLLOW_ternary_in_outerAlternative606, FOLLOW_ternary_in_synpred3_LeftRecursiveRuleWalker593, FOLLOW_token_in_binary830, FOLLOW_token_in_binaryMultipleOp877, FOLLOW_token_in_ternary925, FOLLOW_token_in_ternary929, FOLLOW_token_in_token1074, FOLLOW_token_in_token1089, FOLLOW_token_in_token1102, FOLLOW_token_in_token1115, FOLLOW_TOKEN_REF_in_atom1495, FOLLOW_TOKEN_REF_in_token1151, FOLLOW_tree__in_element1345, FOLLOW_TREE_BEGIN_in_tree_1469, FOLLOW_WILDCARD_in_atom1514, 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
Fields inherited from class org.antlr.runtime.tree.TreeParser
DOWN, input, UP
Fields inherited from class org.antlr.runtime.BaseRecognizer
DEFAULT_TOKEN_CHANNEL, HIDDEN, INITIAL_FOLLOW_STACK_SIZE, MEMO_RULE_FAILED, MEMO_RULE_UNKNOWN, NEXT_TOKEN_RULE_NAME, state
-
Constructor Summary
ConstructorsConstructorDescriptionLeftRecursiveRuleAnalyzer
(org.antlr.runtime.tree.TreeNodeStream input, Grammar g, String ruleName) -
Method Summary
Modifier and TypeMethodDescriptionvoid
binaryAlt
(GrammarAST altTree, GrammarAST rewriteTree, int alt) void
fillRetValAssignments
(org.stringtemplate.v4.ST ruleST, String srcName) getNamesFromArgAction
(org.antlr.runtime.Token t) static boolean
hasImmediateRecursiveRuleRefs
(GrammarAST t, String ruleName) void
int
nextPrecedence
(int alt) void
otherAlt
(GrammarAST altTree, GrammarAST rewriteTree, int alt) int
precedence
(int alt) void
prefixAlt
(GrammarAST altTree, GrammarAST rewriteTree, int alt) replaceLastRuleRef
(GrammarAST t, String name) replaceRuleRefs
(GrammarAST t, String name) void
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]text
(GrammarAST t) toString()
Methods inherited from class org.antlr.grammar.v3.LeftRecursiveRuleWalker
ast_suffix, atom, binary, binaryMultipleOp, block, charSetElement, ebnf, element, exceptionGroup, exceptionHandler, finallyClause, getDelegates, getGrammarFileName, getTokenNames, modifier, option, optionsSpec, optionValue, outerAlternative, prefix, rec_rule, recurse, recurseNoLabel, reportError, rewrite, ruleBlock, ruleScopeSpec, suffix, synpred1_LeftRecursiveRuleWalker, synpred1_LeftRecursiveRuleWalker_fragment, synpred2_LeftRecursiveRuleWalker, synpred2_LeftRecursiveRuleWalker_fragment, synpred3_LeftRecursiveRuleWalker, synpred3_LeftRecursiveRuleWalker_fragment, synpred4_LeftRecursiveRuleWalker, synpred4_LeftRecursiveRuleWalker_fragment, synpred5_LeftRecursiveRuleWalker, synpred5_LeftRecursiveRuleWalker_fragment, 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
-
Field Details
-
g
-
generator
-
ruleName
-
tokenToPrec
-
binaryAlts
-
ternaryAlts
-
suffixAlts
-
prefixAlts
-
otherAlts
-
retvals
-
recRuleTemplates
public org.stringtemplate.v4.STGroup recRuleTemplates -
language
-
altAssociativity
-
-
Constructor Details
-
LeftRecursiveRuleAnalyzer
-
-
Method Details
-
loadPrecRuleTemplates
public void loadPrecRuleTemplates() -
setReturnValues
- Overrides:
setReturnValues
in classLeftRecursiveRuleWalker
-
setTokenPrec
- Overrides:
setTokenPrec
in classLeftRecursiveRuleWalker
-
binaryAlt
- Overrides:
binaryAlt
in classLeftRecursiveRuleWalker
-
ternaryAlt
Convert e ? e : e → ? e : e_[nextPrec]- Overrides:
ternaryAlt
in classLeftRecursiveRuleWalker
-
prefixAlt
- Overrides:
prefixAlt
in classLeftRecursiveRuleWalker
-
suffixAlt
- Overrides:
suffixAlt
in classLeftRecursiveRuleWalker
-
otherAlt
- Overrides:
otherAlt
in classLeftRecursiveRuleWalker
-
getArtificialPrecStartRule
-
getArtificialOpPrecRule
-
getArtificialPrimaryRule
-
replaceRuleRefs
-
hasImmediateRecursiveRuleRefs
-
replaceLastRuleRef
-
stripSynPred
-
stripLeftRecursion
-
text
-
precedence
public int precedence(int alt) -
nextPrecedence
public int nextPrecedence(int alt) -
fillRetValAssignments
-
getNamesFromArgAction
-
toString
-