Package org.antlr.v4.codegen
Class OutputModelController
java.lang.Object
org.antlr.v4.codegen.OutputModelController
This receives events from SourceGenTriggers.g and asks factory to do work.
Then runs extensions in order on resulting SrcOps to get final list.
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
Context set by the SourceGenTriggers.gWho does the work? Doesn't have to be CoreOutputModelFactory.Post-processing CodeGeneratorExtension objects; done in order given.int
While walking code in rules, this is set to the tree walker that triggers actions. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
alternative
(Alternative alt, boolean outerMost) buildBaseListenerOutputModel
(boolean header) buildBaseVisitorOutputModel
(boolean header) void
buildLexerOutputModel
(boolean header) void
buildLexerRuleActions
(Lexer lexer, Rule r) buildListenerOutputModel
(boolean header) void
buildNormalRuleFunction
(Rule r, RuleFunction function) buildParserOutputModel
(boolean header) Build a file with a parser containing rule functions.void
buildRuleFunction
(Parser parser, Rule r) Create RuleFunction per rule and update sempreds,actions of parser output object with stuff found in r.buildVisitorOutputModel
(boolean header) epsilon
(Alternative alt, boolean outerMost) finishAlternative
(CodeBlockForAlt blk, List<SrcOp> ops, boolean outerMost) getChoiceBlock
(BlockAST blkAST, List<CodeBlockForAlt> alts, GrammarAST label) int
getEBNFBlock
(GrammarAST ebnfRoot, List<CodeBlockForAlt> alts) getRoot()
boolean
needsImplicitLabel
(GrammarAST ID, LabeledOp op) parser
(ParserFile file) parserFile
(String fileName) void
rulePostamble
(RuleFunction function, Rule r) ruleRef
(GrammarAST ID, GrammarAST label, GrammarAST args) set
(GrammarAST setAST, GrammarAST labelAST, boolean invert) (A|B|C) possibly with ebnfRoot and labelvoid
setCurrentBlock
(CodeBlock blk) void
setCurrentOuterMostAlt
(Alternative currentOuterMostAlt) void
setCurrentOuterMostAlternativeBlock
(CodeBlockForOuterMostAlt currentOuterMostAlternativeBlock) void
setRoot
(OutputModelObject root) stringRef
(GrammarAST ID, GrammarAST label) tokenRef
(GrammarAST ID, GrammarAST label, GrammarAST args) wildcard
(GrammarAST ast, GrammarAST labelAST)
-
Field Details
-
delegate
Who does the work? Doesn't have to be CoreOutputModelFactory. -
extensions
Post-processing CodeGeneratorExtension objects; done in order given. -
walker
While walking code in rules, this is set to the tree walker that triggers actions. -
codeBlockLevel
public int codeBlockLevelContext set by the SourceGenTriggers.g -
treeLevel
public int treeLevel -
root
-
currentRule
-
currentOuterMostAlt
-
currentBlock
-
currentOuterMostAlternativeBlock
-
-
Constructor Details
-
OutputModelController
-
-
Method Details
-
addExtension
-
buildParserOutputModel
Build a file with a parser containing rule functions. Use the controller as factory in SourceGenTriggers so it triggers codegen extensions too, not just the factory functions in this factory. -
buildLexerOutputModel
-
buildListenerOutputModel
-
buildBaseListenerOutputModel
-
buildVisitorOutputModel
-
buildBaseVisitorOutputModel
-
parserFile
-
parser
-
lexerFile
-
lexer
-
buildRuleFunction
Create RuleFunction per rule and update sempreds,actions of parser output object with stuff found in r. -
buildLeftRecursiveRuleFunction
-
buildNormalRuleFunction
-
buildLexerRuleActions
-
rule
-
rulePostamble
-
getGrammar
-
getGenerator
-
alternative
-
finishAlternative
-
ruleRef
-
tokenRef
-
stringRef
-
set
(A|B|C) possibly with ebnfRoot and label -
epsilon
-
wildcard
-
action
-
sempred
-
getChoiceBlock
-
getEBNFBlock
-
needsImplicitLabel
-
getRoot
-
setRoot
-
getCurrentRuleFunction
-
pushCurrentRule
-
popCurrentRule
-
getCurrentOuterMostAlt
-
setCurrentOuterMostAlt
-
setCurrentBlock
-
getCurrentBlock
-
setCurrentOuterMostAlternativeBlock
public void setCurrentOuterMostAlternativeBlock(CodeBlockForOuterMostAlt currentOuterMostAlternativeBlock) -
getCurrentOuterMostAlternativeBlock
-
getCodeBlockLevel
public int getCodeBlockLevel()
-