| Modifier and Type | Class and Description |
|---|---|
| public static class | |
| public class |
| Modifier and Type | Field and Description |
|---|---|
| private Map | actions
Map a scope to a map of name:action pairs. |
| protected boolean | |
| public static String[] | ANTLRLiteralCharValueEscape
Given a char, we need to be able to show as an ANTLR literal. |
| public static int[] | ANTLRLiteralEscapedCharValue
When converting ANTLR char and string literals, here is the value set of escape chars. |
| public static final String | |
| public boolean | atLeastOneBacktrackOption
At least one backtrack=true in rule or decision or grammar. |
| public boolean | atLeastOneRuleMemoizes
At least one rule has memoize=true |
| public static final String | |
| public Set | blocksWithSemPreds
Track decisions with syn preds specified for reporting. |
| public Set | blocksWithSynPreds
Track decisions with syn preds specified for reporting. |
| protected boolean | builtFromString
We need a way to detect when a lexer grammar is autogenerated from another grammar or we are just sending in a string representing a grammar. |
| public static final int | |
| protected IntSet | charVocabulary
Todo hook this to the charVocabulary option |
| public static final int | |
| public CompositeGrammar | composite
If this grammar is part of a larger composite grammar via delegate statement, then this points at the composite. |
| public CompositeGrammarTree | compositeTreeNode
A pointer back into grammar tree. |
| protected int | decisionCount
Be able to assign a number to every decision in grammar; decisions in 1..n |
| public Set | decisionsWhoseDFAsUsesSemPreds
Track decisions that actually use the syn preds in the DFA. |
| public Set | decisionsWhoseDFAsUsesSynPreds
Track decisions that actually use the syn preds in the DFA. |
| public static final Map | defaultBlockOptions
What are the default options for a subrule? |
| public static final Map | |
| public static final Map | |
| public static final String | |
| protected Set | delegatedRuleReferences
The list of all rules referenced in this grammar, not defined here, and defined in a delegate grammar. |
| public long | DFACreationWallClockTimeInMS
How long in ms did it take to build DFAs for this grammar? |
| public static final Set | |
| protected boolean | externalAnalysisAbort
An external tool requests that DFA analysis abort prematurely. |
| protected NFAFactory | |
| protected String | fileName
What file name holds this grammar? |
| public static final String | |
| protected CodeGenerator | generator
If non-null, this is the code generator we will use to generate recognizers in the target language. |
| protected int | global_k
Is there a global fixed lookahead set for this grammar? |
| public static final String | |
| protected GrammarAST | grammarTree
An AST that records entire input grammar with all rules. |
| public static final String[] | |
| public static final String[] | |
| public static final String | |
| public boolean | implicitLexer
Was this created from a COMBINED grammar? |
| protected Vector | indexToDecision
Each subrule/rule is a decision point and we must track them so we can go back later and build DFA predictors for them. |
| public static final int | |
| public static final int | |
| public String | label
If this is a delegate of another grammar, this is the label used as an instance var by that grammar to point at this grammar. |
| public static String[] | |
| protected Set | leftRecursiveRules
A list of all rules that are in any left-recursive cycle. |
| public static final Set | |
| public static final Set | |
| public static final Set | |
| public static final Set | legalTokenOptions
Legal options for terminal refs like ID<node=MyVarNode> |
| public static final Set | |
| public static final int | |
| public static final String | LEXER_GRAMMAR_FILE_EXTENSION
used for generating lexer temp files |
| protected ST | |
| protected String | lexerGrammarTemplate
For merged lexer/parsers, we must construct a separate lexer spec. |
| public List | lexerRuleNamesInCombined
The ANTLRParser tracks lexer rules when reading combined grammars so we can build the Tokens rule. |
| pack-priv Map | lineColumnToLookaheadDFAMap
For ANTLRWorks, we want to be able to map a line:col to a specific decision DFA so it can display DFA. |
| public LL1Analyzer | |
| public String | name
What name did the user provide for this grammar? |
| public NameSpaceChecker | |
| protected LinkedHashMap | nameToRuleMap
Map a rule to it's Rule object |
| protected LinkedHashMap | nameToSynpredASTMap
When we read in a grammar, we track the list of syntactic predicates and build faux rules for them later. |
| public NFA | nfa
The NFA that represents the grammar with edges labelled with tokens or epsilon. |
| public int | |
| public int | |
| public int | |
| protected Map | options
A list of options specified at the grammar level such as language=Java. |
| public Set | overriddenRules
If this rule is a delegate, some rules might be overridden; don't want to gen code for them. |
| public static final int | |
| public List | precRuleInitCodeBlocks
Each left-recursive precedence rule must define precedence array for binary operators like: static int[] e_prec = new int[tokenNames.length]; static { e_prec[75] = 1; } Track and we push into parser later; this is computed early when we look for prec rules. |
| public static final int | |
| public static final int | |
| protected Set | ruleRefs
The unique set of all rule references in any rule; set of tree node objects so two refs to same rule can exist but at different line/position. |
| pack-priv GrammarSanity | sanity
Factored out the sanity checking code; delegate to it. |
| protected Set | |
| protected Map | scopes
Track the scopes defined outside of rules and the scopes associated with all rules (even if empty). |
| public Set | |
| public Set | |
| public static final String | |
| public static final String | |
| public Set | synPredNamesUsedInDFA
Track names of preds so we can avoid generating preds that aren't used Computed during NFA to DFA conversion. |
| pack-priv Target | target
Useful for asking questions about target during analysis |
| public static final int | |
| public static final int | |
| public CommonTokenStream | tokenBuffer
This is the buffer of *all* tokens found in the grammar file including whitespace tokens etc... |
| protected Set | tokenIDRefs
The unique set of all token ID references in any rule |
| public Tool | |
| public static final int | |
| public int | type
What type of grammar is this: lexer, parser, tree walker |
| public static MultiMap | validDelegations
Set of valid imports. |
| public static final int | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public GrammarAST | addArtificialMatchTokensRule(GrammarAST grammarAST, List<String> ruleNames, List<String> delegateNames, boolean filterMode)
Parse a rule we add artificially that is a list of the other lexer rules like this: "Tokens : ID | INT | SEMI ;" nextToken() will invoke this to set the current token. |
| protected void | |
| public void | |
| public void | |
| public boolean | |
| public void | altReferencesRule(String enclosingRuleName, GrammarAST refScopeAST, GrammarAST refAST, int outerAltNum)
Track a rule reference within an outermost alt of a rule. |
| public void | altReferencesTokenID(String ruleName, GrammarAST refAST, int outerAltNum)
Track a token reference within an outermost alt of a rule. |
| public int | |
| public boolean | |
| public void | |
| public boolean | |
| public List | |
| public void | checkAllRulesForUselessLabels()
Remove all labels on rule refs whose target rules have no return value. |
| public void | |
| public void | checkRuleReference(GrammarAST scopeAST, GrammarAST refAST, GrammarAST argsAST, String currentRuleName)
|
| public IntSet | |
| public IntSet | |
| public String | computeTokenNameFromLiteral(int tokenType, String literal)
given a token type and the text of the literal, come up with a decent token type label. |
| protected Grammar. | |
| public DFA | |
| public DFA | |
| public void | createLookaheadDFAs()
For each decision in this grammar, compute a single DFA using the NFA states associated with the decision. |
| public void | |
| public AttributeScope | |
| public AttributeScope | |
| public AttributeScope | |
| public void | createRuleStartAndStopNFAStates()
Define all the rule begin/end NFAStates to solve forward reference issues. |
| protected void | |
| public AttributeScope | |
| public void | |
| protected void | defineLabel(Rule r, Token label, GrammarAST element, int type)
Define a label defined in a rule r; check the validity then ask the Rule object to actually define it. |
| public void | defineLexerRuleForAliasedStringLiteral(String tokenID, String literal, int tokenType)
If someone does PLUS='+' in the parser, must make sure we get "PLUS : '+' ;" in lexer not "T73 : '+';" |
| public void | |
| public void | |
| public void | defineNamedAction(GrammarAST ampersandAST, String scope, GrammarAST nameAST, GrammarAST actionAST)
Given @scope::name {action} define it for this grammar. |
| public void | defineRule(Token ruleToken, String modifier, Map<String, Object> options, GrammarAST tree, GrammarAST argActionAST, int numAlts)
Define a new rule. |
| public void | |
| public void | |
| public String | defineSyntacticPredicate(GrammarAST blockAST, String currentRuleName)
Define a new predicate and get back its name for use in building a semantic predicate reference to the syn pred. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| protected void | examineAllExecutableActions()
Before generating code, we examine all actions that can have $x.y and $y stuff in them because some code generation depends on Rule.referencedPredefinedRuleAttributes. |
| public void | |
| protected GrammarAST | |
| public LookaheadSet | |
| public boolean | |
| public Map | |
| public IntSet | getAllCharValues()
If there is a char vocabulary, use it; else return min to max char as defined by the target. |
| public Set | getAllImportedRules()
Get set of all rules imported from all delegate grammars even if indirectly delegated. |
| public static String | |
| protected List | getArtificialRulesForSyntacticPredicates(LinkedHashMap<String, GrammarAST> nameToSynpredASTMap)
for any syntactic predicates, we need to define rules for them; they will get defined automatically like any other rule. |
| public boolean | |
| public Object | |
| public static int | getCharValueFromGrammarCharLiteral(String literal)
Given a literal like (the 3 char sequence with single quotes) 'a', return the int value of 'a'. |
| public CodeGenerator | |
| protected Grammar. | |
| public GrammarAST | |
| public NFAState | |
| public List | |
| public List | |
| public String | getDefaultActionScope(int grammarType)
Given a grammar type, what should be the default action scope? |
| public Set | |
| public Set | getDelegatedRules()
Get the set of Rules that need to have manual delegations like "void rule() { importedGrammar.rule(); }" If this grammar is master, get list of all rule definitions from all delegate grammars. |
| public List | |
| public List | getDelegates()
Get list of all delegates from all grammars directly or indirectly imported into this grammar. |
| public Grammar | |
| public List | |
| public List | |
| public String | |
| public AttributeScope | |
| public Map | |
| public boolean | |
| public int | |
| public GrammarAST | |
| public String | |
| public boolean | |
| public String | |
| public List | |
| public Set | getLabels(Set<GrammarAST> rewriteElements, int labelType)
Given a set of all rewrite elements on right of ->, filter for label types such as Grammar.TOKEN_LABEL, Grammar.TOKEN_LIST_LABEL, ... |
| public Set | getLeftRecursiveRules()
Return a list of left-recursive rules; no analysis can be done successfully on these. |
| public String | getLexerGrammar()
If the grammar is a combined grammar, return the text of the implicit lexer grammar. |
| public Map | |
| public Object | |
| public Rule | |
| public DFA | |
| public List | getLookaheadDFAColumnsForLineInFile(int line)
returns a list of column numbers for all decisions on a particular line so ANTLRWorks choose the decision depending on the location of the cursor (otherwise, ANTLRWorks has to give the *exact* location which is not easy from the user point of view). |
| public DFA | getLookaheadDFAFromPositionInFile(int line, int col)
Useful for ANTLRWorks to map position in file to the DFA for display |
| public int | |
| public int | |
| public int | |
| public NFAState | getNFAStateForAltOfDecision(NFAState decisionState, int alt)
Get the ith alternative (1..n) from a decision; return null when an invalid alt is requested. |
| public int | getNumberOfAltsForDecisionNFA(NFAState decisionState)
Decisions are linked together with transition(1). |
| public int | |
| public int | |
| public Object | |
| public String | getRecognizerName()
Get the name of the generated recognizer; may or may not be same as grammar name. |
| public Rule | |
| public Rule | |
| public int | |
| public int | |
| public String | |
| public String | |
| public Collection | |
| public NFAState | |
| public NFAState | |
| public NFAState | |
| public IntSet | getSetFromRule(TreeToNFAConverter nfabuilder, String ruleName)
Get the set equivalent (if any) of the indicated rule from this grammar. |
| public Set | |
| public GrammarAST | |
| public LinkedHashMap | |
| public String | getTokenDisplayName(int ttype)
Given a token type, get a meaningful name for it such as the ID or string literal. |
| public Set | |
| public Set | |
| public int | |
| public IntSet | |
| public Collection | getTokenTypesWithoutID()
Return an ordered integer list of token types that have no corresponding token ID like INT or KEYWORD_BEGIN; for stuff like 'begin'. |
| public Tool | |
| public static StringBuffer | getUnescapedStringFromGrammarStringLiteral(String literal)
ANTLR does not convert escape sequences during the parse phase because it could not know how to print String/char literals back out when printing grammars etc... |
| public int | |
| public String | |
| public String | |
| public void | importGrammar(GrammarAST grammarNameAST, String label)
Import the rules/tokens of a delegate grammar. |
| public int | importTokenVocabulary(Grammar importFromGr)
Pull your token definitions from an existing grammar in memory. |
| public int | importTokenVocabulary(GrammarAST tokenVocabOptionAST, String vocabName)
Load a vocab file <vocabName>.tokens and return max token type found. |
| public boolean | |
| public boolean | |
| public boolean | isEmptyRule(GrammarAST block)
Rules like "a : ;" and "a : {...} ;" should not generate try/catch blocks for RecognitionException. |
| public boolean | isValidSet(TreeToNFAConverter nfabuilder, GrammarAST t)
Given set tree like ( SET A B ), check that A and B are both valid sets themselves, else we must tree like a BLOCK |
| public boolean | |
| public LookaheadSet | |
| protected List | |
| public boolean | |
| public boolean | |
| public void | |
| public void | |
| public GrammarAST | |
| public void | |
| public void | referenceRuleLabelPredefinedAttribute(String ruleName)
To yield smaller, more readable code, track which rules have their predefined attributes accessed. |
| protected void | removeUselessLabels(Map<String, Grammar.
A label on a rule is useless if the rule has no return value, no tree or template output, and it is not referenced in an action. |
| public boolean | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public String | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public String | |
| public void | |
| private void | |
| public boolean |