Modifier and Type | Method and Description |
---|---|
Grammar |
Tool.createGrammar(GrammarRootAST ast)
Given the raw AST of a grammar, create a grammar object
associated with the AST.
|
Grammar |
Tool.loadGrammar(String fileName)
Convenience method to load and process an ANTLR grammar.
|
Grammar |
Tool.loadImportedGrammar(Grammar g,
GrammarAST nameNode)
Try current dir then dir of g then lib dir
|
Modifier and Type | Method and Description |
---|---|
boolean |
Tool.checkForRuleIssues(Grammar g)
Important enough to avoid multiple definitions that we do very early,
right after AST construction.
|
void |
Tool.generateATNs(Grammar g) |
File |
Tool.getImportedGrammarFile(Grammar g,
String fileName) |
Writer |
Tool.getOutputFileWriter(Grammar g,
String fileName)
This method is used by all code generators to create new output
files.
|
Grammar |
Tool.loadImportedGrammar(Grammar g,
GrammarAST nameNode)
Try current dir then dir of g then lib dir
|
void |
Tool.process(Grammar g,
boolean gencode)
To process a grammar, we load all of its imported grammars into
subordinate grammar objects.
|
void |
Tool.processNonCombinedGrammar(Grammar g,
boolean gencode) |
protected void |
Tool.writeDOTFile(Grammar g,
Rule r,
String dot) |
protected void |
Tool.writeDOTFile(Grammar g,
String name,
String dot) |
Modifier and Type | Field and Description |
---|---|
Grammar |
AnalysisPipeline.g |
Grammar |
LeftRecursiveRuleTransformer.g |
Modifier and Type | Method and Description |
---|---|
RuleAST |
LeftRecursiveRuleTransformer.parseArtificialRule(Grammar g,
String ruleText) |
Constructor and Description |
---|
AnalysisPipeline(Grammar g) |
LeftRecursionDetector(Grammar g,
ATN atn) |
LeftRecursiveRuleTransformer(GrammarRootAST ast,
Collection<Rule> rules,
Grammar g) |
Modifier and Type | Field and Description |
---|---|
Grammar |
ParserATNFactory.g |
Modifier and Type | Method and Description |
---|---|
static void |
ATNOptimizer.optimize(Grammar g,
ATN atn) |
Constructor and Description |
---|
ATNPrinter(Grammar g,
ATNState start) |
ParserATNFactory(Grammar g) |
Modifier and Type | Field and Description |
---|---|
Grammar |
CodeGenerator.g |
Grammar |
DefaultOutputModelFactory.g |
Modifier and Type | Method and Description |
---|---|
Grammar |
OutputModelController.getGrammar() |
Grammar |
DefaultOutputModelFactory.getGrammar() |
Grammar |
OutputModelFactory.getGrammar() |
Modifier and Type | Method and Description |
---|---|
protected void |
Target.genFile(Grammar g,
org.stringtemplate.v4.ST outputFileST,
String fileName) |
String |
Target.getTokenTypeAsTargetLabel(Grammar g,
int ttype)
Get a meaningful name for a token type useful during code generation.
|
String[] |
Target.getTokenTypesAsTargetLabels(Grammar g,
int[] ttypes) |
Constructor and Description |
---|
CodeGenerator(Grammar g) |
CodeGenerator(Tool tool,
Grammar g,
String language) |
CodeGenPipeline(Grammar g) |
Modifier and Type | Method and Description |
---|---|
Map<String,Action> |
OutputFile.buildNamedActions(Grammar g) |
Modifier and Type | Method and Description |
---|---|
protected void |
SwiftTarget.genFile(Grammar g,
org.stringtemplate.v4.ST outputFileST,
String fileName) |
protected void |
GoTarget.genFile(Grammar g,
org.stringtemplate.v4.ST outputFileST,
String fileName) |
Modifier and Type | Field and Description |
---|---|
Grammar |
BlockSetTransformer.g |
protected Grammar |
TokenVocabParser.g |
Grammar |
GrammarToken.g |
Modifier and Type | Method and Description |
---|---|
static Pair<Integer,Integer> |
ScopeParser._parsePostfixDecl(Attribute attr,
String decl,
ActionAST a,
Grammar g) |
static Pair<Integer,Integer> |
ScopeParser._parsePrefixDecl(Attribute attr,
String decl,
ActionAST a,
Grammar g) |
static AttributeDict |
ScopeParser.parse(ActionAST action,
String s,
char separator,
Grammar g) |
static Attribute |
ScopeParser.parseAttributeDef(ActionAST action,
Pair<String,Integer> decl,
Grammar g)
For decls like "String foo" or "char *foo32[]" compute the ID
and type declarations.
|
static AttributeDict |
ScopeParser.parseTypedArgList(ActionAST action,
String s,
Grammar g)
Given an arg or retval scope definition list like
|
Constructor and Description |
---|
BlockSetTransformer(org.antlr.runtime.tree.TreeNodeStream input,
Grammar g) |
GrammarToken(Grammar g,
org.antlr.runtime.Token oldToken) |
TokenVocabParser(Grammar g) |
Modifier and Type | Field and Description |
---|---|
Grammar |
SemanticPipeline.g |
Grammar |
AttributeChecks.g |
Grammar |
ActionSniffer.g |
Grammar |
SymbolCollector.g
which grammar are we checking
|
Grammar |
BasicSemanticChecks.g |
Grammar |
RuleCollector.g
which grammar are we checking
|
Modifier and Type | Method and Description |
---|---|
static void |
AttributeChecks.checkAllAttributeExpressions(Grammar g) |
void |
SymbolChecks.checkForModeConflicts(Grammar g) |
void |
SymbolChecks.checkForQualifiedRuleIssues(Grammar g,
List<GrammarAST> qualifiedRuleRefs) |
void |
SymbolChecks.checkForUnreachableTokens(Grammar g)
Algorithm steps:
1.
|
void |
SymbolChecks.checkRuleArgs(Grammar g,
List<GrammarAST> rulerefs) |
static Map<Rule,Set<Rule>> |
UseDefAnalyzer.getRuleDependencies(Grammar g)
Find all rules reachable from r directly or indirectly for all r in g
|
static Map<Rule,Set<Rule>> |
UseDefAnalyzer.getRuleDependencies(Grammar g,
Collection<Rule> rules) |
static void |
UseDefAnalyzer.trackTokenRuleRefsInActions(Grammar g) |
Constructor and Description |
---|
ActionSniffer(Grammar g,
Rule r,
Alternative alt,
ActionAST node,
org.antlr.runtime.Token actionToken) |
AttributeChecks(Grammar g,
Rule r,
Alternative alt,
ActionAST node,
org.antlr.runtime.Token actionToken) |
BasicSemanticChecks(Grammar g,
RuleCollector ruleCollector) |
RuleCollector(Grammar g) |
SemanticPipeline(Grammar g) |
SymbolChecks(Grammar g,
SymbolCollector collector) |
SymbolCollector(Grammar g) |
Modifier and Type | Class and Description |
---|---|
class |
LexerGrammar |
Modifier and Type | Field and Description |
---|---|
protected Grammar |
BuildDependencyGenerator.g |
Grammar |
Rule.g
In which grammar does this rule live?
|
Grammar |
ANTLRMessage.g |
Grammar |
GrammarTransformPipeline.g |
protected Grammar |
GrammarParserInterpreter.g
The grammar associated with this interpreter.
|
protected Grammar |
DOTGenerator.grammar |
Grammar |
LexerGrammar.implicitLexerOwner
The grammar from which this lexer grammar was derived (if implicit)
|
Grammar |
Grammar.originalGrammar
If this is an extracted/implicit lexer, we point at original grammar
|
Grammar |
Grammar.parent
If we're imported, who imported us? If null, implies grammar is root
|
Modifier and Type | Field and Description |
---|---|
List<Grammar> |
Grammar.importedGrammars |
Modifier and Type | Method and Description |
---|---|
Grammar |
Grammar.getImportedGrammar(String name)
Return grammar directly imported by this grammar
|
Grammar |
Grammar.getOutermostGrammar()
Return the grammar that imported us and our parents.
|
static Grammar |
Grammar.load(String fileName)
convenience method for Tool.loadGrammar()
|
Modifier and Type | Method and Description |
---|---|
List<Grammar> |
Grammar.getAllImportedGrammars()
Get list of all imports from all grammars in the delegate subtree of g.
|
List<Grammar> |
Grammar.getGrammarAncestors()
Return list of imported grammars from root down to our parent.
|
List<Grammar> |
Grammar.getImportedGrammars() |
Modifier and Type | Method and Description |
---|---|
static void |
GrammarTransformPipeline.augmentTokensWithOriginalPosition(Grammar g,
GrammarAST tree) |
static ParserInterpreter |
GrammarParserInterpreter.deriveTempParserInterpreter(Grammar g,
Parser originalParser,
TokenStream tokens)
Derive a new parser from an old one that has knowledge of the grammar.
|
GrammarRootAST |
GrammarTransformPipeline.extractImplicitLexer(Grammar combinedGrammar)
Build lexer grammar from combined grammar that looks like:
(COMBINED_GRAMMAR A
(tokens { X (= Y 'y'))
(OPTIONS (= x 'y'))
(@ members {foo})
(@ lexer header {package jj;})
(RULES (RULE .+)))
Move rules and actions to new tree, don't dup.
|
static List<ParserRuleContext> |
GrammarParserInterpreter.getAllPossibleParseTrees(Grammar g,
Parser originalParser,
TokenStream tokens,
int decision,
BitSet alts,
int startIndex,
int stopIndex,
int startRuleIndex)
Given an ambiguous parse information, return the list of ambiguous parse trees.
|
static List<ParserRuleContext> |
GrammarParserInterpreter.getLookaheadParseTrees(Grammar g,
ParserInterpreter originalParser,
TokenStream tokens,
int startRuleIndex,
int decision,
int startIndex,
int stopIndex)
Return a list of parse trees, one for each alternative in a decision
given the same input.
|
void |
Grammar.importVocab(Grammar importG) |
void |
GrammarTransformPipeline.integrateImportedGrammars(Grammar rootGrammar)
Merge all the rules, token definitions, and named actions from
imported grammars into the root grammar tree.
|
static void |
GrammarTransformPipeline.setGrammarPtr(Grammar g,
GrammarAST tree)
Utility visitor that sets grammar ptr in each node
|
Constructor and Description |
---|
BuildDependencyGenerator(Tool tool,
Grammar g) |
DOTGenerator(Grammar grammar)
This aspect is associated with a grammar
|
Grammar(String fileName,
String grammarText,
Grammar tokenVocabSource,
ANTLRToolListener listener)
For testing; builds trees, does sem anal
|
GrammarParserInterpreter(Grammar g,
ATN atn,
TokenStream input) |
GrammarParserInterpreter(Grammar g,
String grammarFileName,
Vocabulary vocabulary,
Collection<String> ruleNames,
ATN atn,
TokenStream input) |
GrammarTransformPipeline(Grammar g,
Tool tool) |
LabelElementPair(Grammar g,
GrammarAST label,
GrammarAST element,
int labelOp) |
LeftRecursiveRule(Grammar g,
String name,
RuleAST ast) |
Rule(Grammar g,
String name,
RuleAST ast,
int numberOfAlts) |
Modifier and Type | Field and Description |
---|---|
Grammar |
GrammarAST.g
For error msgs, nice to know which grammar this AST lives in
|
Copyright © 1992–2020 ANTLR. All rights reserved.