|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.antlr.tool.Grammar
public class Grammar
Represents a grammar in memory.
Nested Class Summary | |
---|---|
static class |
Grammar.Decision
|
class |
Grammar.LabelElementPair
|
Field Summary | |
---|---|
protected java.util.Map |
actions
Map a scope to a map of name:action pairs. |
protected boolean |
allDecisionDFACreated
|
static java.lang.String[] |
ANTLRLiteralCharValueEscape
Given a char, we need to be able to show as an ANTLR literal. |
static int[] |
ANTLRLiteralEscapedCharValue
When converting ANTLR char and string literals, here is the value set of escape chars. |
static java.lang.String |
ARTIFICIAL_TOKENS_RULENAME
|
java.util.Set<GrammarAST> |
blocksWithSemPreds
Track decisions with syn preds specified for reporting. |
java.util.Set<GrammarAST> |
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. |
static int |
CHAR_LABEL
|
protected IntSet |
charVocabulary
TODO: hook this to the charVocabulary option |
static int |
COMBINED
|
protected int |
decisionNumber
Be able to assign a number to every decision in grammar; decisions in 1..n |
java.util.Set |
decisionsWhoseDFAsUsesSemPreds
Track decisions that actually use the syn preds in the DFA. |
java.util.Set<DFA> |
decisionsWhoseDFAsUsesSynPreds
Track decisions that actually use the syn preds in the DFA. |
static java.util.Map |
defaultOptions
|
long |
DFACreationWallClockTimeInMS
How long in ms did it take to build DFAs for this grammar? If this grammar is a combined grammar, it only records time for the parser grammar component. |
static java.util.Set |
doNotCopyOptionsToLexer
|
protected boolean |
externalAnalysisAbort
An external tool requests that DFA analysis abort prematurely. |
protected java.lang.String |
fileName
What file name holds this grammar? |
static java.lang.String |
FRAGMENT_RULE_MODIFIER
|
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? If 0, nothing specified. |
static java.lang.String |
GRAMMAR_FILE_EXTENSION
|
protected GrammarAST |
grammarTree
An AST that records entire input grammar with all rules. |
static java.lang.String[] |
grammarTypeToFileNameSuffix
|
static java.lang.String[] |
grammarTypeToString
|
static java.lang.String |
IGNORE_STRING_IN_GRAMMAR_FILE_NAME
|
protected Grammar |
importTokenVocabularyFromGrammar
For interpreting and testing, you sometimes want to import token definitions from another grammar (instead of reading token defs from a file). |
protected java.util.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. |
static int |
INITIAL_DECISION_LIST_SIZE
|
static int |
INVALID_RULE_INDEX
|
static java.lang.String[] |
LabelTypeToString
|
protected java.util.Set |
leftRecursiveRules
A list of all rules that are in any left-recursive cycle. |
static java.util.Set |
legalOptions
|
static int |
LEXER
|
static java.lang.String |
LEXER_GRAMMAR_FILE_EXTENSION
used for generating lexer temp files |
protected StringTemplate |
lexerGrammarST
For merged lexer/parsers, we must construct a separate lexer spec. |
protected java.util.Set<java.lang.String> |
lexerRules
If combined or lexer grammar, track the rules; Set |
protected java.util.Set |
lookBusy
Used during LOOK to detect computation cycles |
protected int |
maxTokenType
Token names and literal tokens like "void" are uniquely indexed. |
java.lang.String |
name
What name did the user provide for this grammar? |
protected java.util.LinkedHashMap |
nameToRuleMap
Map a rule to it's Rule object |
protected java.util.LinkedHashMap |
nameToSynpredASTMap
When we read in a grammar, we track the list of syntactic predicates and build faux rules for them later. |
protected NFA |
nfa
The NFA that represents the grammar with edges labelled with tokens or epsilon. |
int |
numberOfManualLookaheadOptions
|
int |
numberOfSemanticPredicates
|
protected java.util.Map |
options
A list of options specified at the grammar level such as language=Java. |
static int |
PARSER
|
static int |
RULE_LABEL
|
static int |
RULE_LIST_LABEL
|
protected int |
ruleIndex
Rules are uniquely labeled from 1..n |
protected java.util.Vector |
ruleIndexToRuleList
Map a rule index to its name; use a Vector on purpose as new collections stuff won't let me setSize and make it grow. |
protected java.util.Set<antlr.Token> |
ruleRefs
The unique set of all rule references in any rule; set of Token objects so two refs to same rule can exist but at different line/position. |
protected java.util.Map |
scopes
Track the scopes defined outside of rules and the scopes associated with all rules (even if empty). |
java.util.Set |
setOfDFAWhoseConversionTerminatedEarly
|
java.util.Set |
setOfNondeterministicDecisionNumbers
|
java.util.Set |
setOfNondeterministicDecisionNumbersResolvedWithPredicates
|
protected java.util.Map |
stringLiteralToTypeMap
Map token literals like "while" to its token type. |
static java.lang.String |
SYNPRED_RULE_PREFIX
|
static java.lang.String |
SYNPREDGATE_ACTION_NAME
|
java.util.Set<java.lang.String> |
synPredNamesUsedInDFA
Track names of preds so we can avoid generating preds that aren't used Computed during NFA to DFA conversion. |
static int |
TOKEN_LABEL
|
static int |
TOKEN_LIST_LABEL
|
protected antlr.TokenStreamRewriteEngine |
tokenBuffer
This is the buffer of *all* tokens found in the grammar file including whitespace tokens etc... |
protected java.util.Set<antlr.Token> |
tokenIDRefs
The unique set of all token ID references in any rule |
protected java.util.Map |
tokenIDToTypeMap
Map token like ID (but not literals like "while") to its token type |
Tool |
tool
|
static int |
TREE_PARSER
|
int |
type
What type of grammar is this: lexer, parser, tree walker |
protected java.util.Vector |
typeToTokenList
Map a token type to its token name. |
protected java.util.Set |
visitedDuringRecursionCheck
The checkForLeftRecursion method needs to track what rules it has visited to track infinite recursion. |
protected boolean |
watchNFAConversion
|
Constructor Summary | |
---|---|
Grammar()
|
|
Grammar(java.lang.String grammarString)
|
|
Grammar(java.lang.String fileName,
java.lang.String grammarString)
|
|
Grammar(Tool tool,
java.lang.String fileName,
java.io.Reader r)
Create a grammar from a Reader. |
Method Summary | |
---|---|
protected LookaheadSet |
_LOOK(NFAState s)
|
GrammarAST |
addArtificialMatchTokensRule(GrammarAST grammarAST,
java.util.List ruleNames,
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. |
boolean |
allDecisionDFAHaveBeenCreated()
|
void |
altReferencesRule(java.lang.String ruleName,
GrammarAST refAST,
int outerAltNum)
Track a rule reference within an outermost alt of a rule. |
void |
altReferencesTokenID(java.lang.String ruleName,
GrammarAST refAST,
int outerAltNum)
Track a token reference within an outermost alt of a rule. |
int |
assignDecisionNumber(NFAState state)
|
boolean |
buildAST()
|
boolean |
buildTemplate()
|
java.util.List |
checkAllRulesForLeftRecursion()
|
void |
checkAllRulesForUselessLabels()
Remove all labels on rule refs whose target rules have no return value. |
void |
checkRuleReference(GrammarAST refAST,
GrammarAST argsAST,
java.lang.String currentRuleName)
|
IntSet |
complement(int atom)
|
IntSet |
complement(IntSet set)
For lexer grammars, return everything in unicode not in set. |
java.lang.String |
computeTokenNameFromLiteral(int tokenType,
java.lang.String literal)
given a token type and the text of the literal, come up with a decent token type label. |
protected Grammar.Decision |
createDecision(int decision)
|
void |
createLookaheadDFA(int decision)
|
void |
createLookaheadDFAs()
For each decision in this grammar, compute a single DFA using the NFA states associated with the decision. |
void |
createNFAs()
Walk the list of options, altering this Grammar object according to any I recognize. |
AttributeScope |
createParameterScope(java.lang.String ruleName,
antlr.Token argAction)
|
AttributeScope |
createReturnScope(java.lang.String ruleName,
antlr.Token retAction)
|
AttributeScope |
createRuleScope(java.lang.String ruleName,
antlr.Token scopeAction)
|
AttributeScope |
defineGlobalScope(java.lang.String name,
antlr.Token scopeAction)
|
protected void |
defineLabel(Rule r,
antlr.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. |
void |
defineLexerRuleForAliasedStringLiteral(java.lang.String tokenID,
java.lang.String literal,
int tokenType)
If someone does PLUS='+' in the parser, must make sure we get "PLUS : '+' ;" in lexer not "T73 : '+';" |
void |
defineLexerRuleForStringLiteral(java.lang.String literal,
int tokenType)
|
void |
defineLexerRuleFoundInParser(antlr.Token ruleToken,
GrammarAST ruleAST)
|
void |
defineNamedAction(GrammarAST ampersandAST,
java.lang.String scope,
GrammarAST nameAST,
GrammarAST actionAST)
Given @scope::name {action} define it for this grammar. |
void |
defineRule(antlr.Token ruleToken,
java.lang.String modifier,
java.util.Map options,
GrammarAST tree,
GrammarAST argActionAST,
int numAlts)
Define a new rule. |
void |
defineRuleListLabel(java.lang.String ruleName,
antlr.Token label,
GrammarAST element)
|
void |
defineRuleRefLabel(java.lang.String ruleName,
antlr.Token label,
GrammarAST ruleRef)
|
java.lang.String |
defineSyntacticPredicate(GrammarAST blockAST,
java.lang.String currentRuleName)
Define a new predicate and get back its name for use in building a semantic predicate reference to the syn pred. |
void |
defineToken(java.lang.String text,
int tokenType)
Define a token at a particular token type value. |
void |
defineTokenListLabel(java.lang.String ruleName,
antlr.Token label,
GrammarAST element)
|
void |
defineTokenRefLabel(java.lang.String ruleName,
antlr.Token label,
GrammarAST tokenRef)
|
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. |
void |
externallyAbortNFAToDFAConversion()
Terminate DFA creation (grammar analysis). |
java.util.Map |
getActions()
|
IntSet |
getAllCharValues()
If there is a char vocabulary, use it; else return min to max char as defined by the target. |
static java.lang.String |
getANTLRCharLiteralForChar(int c)
Return a string representing the escaped char for code c. |
protected java.util.List |
getArtificialRulesForSyntacticPredicates(ANTLRParser parser,
java.util.LinkedHashMap nameToSynpredASTMap)
for any syntactic predicates, we need to define rules for them; they will get defined automatically like any other rule. |
static int |
getCharValueFromGrammarCharLiteral(java.lang.String literal)
Given a literal like (the 3 char sequence with single quotes) 'a', return the int value of 'a'. |
CodeGenerator |
getCodeGenerator()
|
protected Grammar.Decision |
getDecision(int decision)
|
GrammarAST |
getDecisionBlockAST(int decision)
|
NFAState |
getDecisionNFAStartState(int decision)
|
java.util.List |
getDecisionNFAStartStateList()
|
java.lang.String |
getDefaultActionScope(int grammarType)
Given a grammar type, what should be the default action scope? If I say @members in a COMBINED grammar, for example, the default scope should be "parser". |
java.lang.String |
getFileName()
|
AttributeScope |
getGlobalScope(java.lang.String name)
Get a global scope |
java.util.Map |
getGlobalScopes()
|
int |
getGrammarMaxLookahead()
|
GrammarAST |
getGrammarTree()
|
java.lang.String |
getImplicitlyGeneratedLexerFileName()
|
java.io.File |
getImportedVocabFileName(java.lang.String vocabName)
|
java.util.Set<java.lang.String> |
getLabels(java.util.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, ... |
java.util.Set |
getLeftRecursiveRules()
Return a list of left-recursive rules; no analysis can be done successfully on these. |
java.lang.String |
getLexerGrammar()
If the grammar is a merged grammar, return the text of the implicit lexer grammar. |
java.util.Map |
getLineColumnToLookaheadDFAMap()
|
DFA |
getLookaheadDFA(int decision)
|
java.util.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). |
DFA |
getLookaheadDFAFromPositionInFile(int line,
int col)
Useful for ANTLRWorks to map position in file to the DFA for display |
int |
getMaxCharValue()
What is the max char value possible for this grammar's target? Use unicode max if no target defined. |
int |
getMaxTokenType()
How many token types have been allocated so far? |
int |
getNewTokenType()
Return a new unique integer in the token type space |
NFAState |
getNFAStateForAltOfDecision(NFAState decisionState,
int alt)
Get the ith alternative (1..n) from a decision; return null when an invalid alt is requested. |
int |
getNumberOfAltsForDecisionNFA(NFAState decisionState)
Decisions are linked together with transition(1). |
int |
getNumberOfCyclicDecisions()
|
int |
getNumberOfDecisions()
|
java.lang.Object |
getOption(java.lang.String key)
|
Rule |
getRule(java.lang.String ruleName)
|
int |
getRuleIndex(java.lang.String ruleName)
|
java.lang.String |
getRuleModifier(java.lang.String ruleName)
|
java.lang.String |
getRuleName(int ruleIndex)
|
java.util.Collection |
getRules()
|
NFAState |
getRuleStartState(java.lang.String ruleName)
|
NFAState |
getRuleStopState(java.lang.String ruleName)
|
IntSet |
getSetFromRule(TreeToNFAConverter nfabuilder,
java.lang.String ruleName)
Get the set equivalent (if any) of the indicated rule from this grammar. |
java.util.Set |
getStringLiterals()
Get the list of ANTLR String literals |
GrammarAST |
getSyntacticPredicate(java.lang.String name)
|
java.util.LinkedHashMap |
getSyntacticPredicates()
|
java.lang.String |
getTokenDisplayName(int ttype)
Given a token type, get a meaningful name for it such as the ID or string literal. |
java.util.Set |
getTokenDisplayNames()
Get a list of all token IDs and literals that have an associated token type. |
java.util.Set |
getTokenIDs()
Get the list of tokens that are IDs like BLOCK and LPAREN |
int |
getTokenType(java.lang.String tokenName)
|
IntSet |
getTokenTypes()
Return a set of all possible token or char types for this grammar |
java.util.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'. |
Tool |
getTool()
|
static java.lang.StringBuffer |
getUnescapedStringFromGrammarStringLiteral(java.lang.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... |
boolean |
getWatchNFAConversion()
|
java.lang.String |
grammarTreeToString(GrammarAST t)
|
java.lang.String |
grammarTreeToString(GrammarAST t,
boolean showActions)
|
int |
importTokenVocabulary(Grammar importFromGr)
Pull your token definitions from an existing grammar in memory. |
int |
importTokenVocabulary(java.lang.String vocabName)
Load a vocab file |
protected void |
initTokenSymbolTables()
|
boolean |
isBuiltFromString()
|
boolean |
isEmptyRule(GrammarAST block)
Rules like "a : ;" and "a : {...} ;" should not generate try/catch blocks for RecognitionException. |
boolean |
isValidSet(TreeToNFAConverter nfabuilder,
GrammarAST t)
Given set tree like ( SET A B ) in lexer, check that A and B are both valid sets themselves, else we must tree like a BLOCK |
LookaheadSet |
LOOK(NFAState s)
From an NFA state, s, find the set of all labels reachable from s. |
boolean |
NFAToDFAConversionExternallyAborted()
|
boolean |
optionIsValid(java.lang.String key,
java.lang.Object value)
|
void |
printGrammar(java.io.PrintStream output)
|
void |
referenceRuleLabelPredefinedAttribute(java.lang.String ruleName)
To yield smaller, more readable code, track which rules have their predefined attributes accessed. |
protected void |
removeUselessLabels(java.util.Map ruleToElementLabelPairMap)
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. |
void |
setCodeGenerator(CodeGenerator generator)
|
void |
setDecisionBlockAST(int decision,
GrammarAST blockAST)
|
void |
setDecisionNFA(int decision,
NFAState state)
|
void |
setFileName(java.lang.String fileName)
|
void |
setGrammarContent(java.io.Reader r)
|
void |
setGrammarContent(java.lang.String grammarString)
|
void |
setLookaheadDFA(int decision,
DFA lookaheadDFA)
Set the lookahead DFA for a particular decision. |
void |
setName(java.lang.String name)
|
java.lang.String |
setOption(java.lang.String key,
java.lang.Object value,
antlr.Token optionsStartToken)
Save the option key/value pair and process it; return the key or null if invalid option. |
void |
setOptions(java.util.Map options,
antlr.Token optionsStartToken)
|
void |
setRuleAST(java.lang.String ruleName,
GrammarAST t)
|
void |
setRuleStartState(java.lang.String ruleName,
NFAState startState)
|
void |
setRuleStopState(java.lang.String ruleName,
NFAState stopState)
|
void |
setTool(Tool tool)
|
void |
setWatchNFAConversion(boolean watchNFAConversion)
|
void |
synPredUsedInDFA(DFA dfa,
SemanticContext semCtx)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SYNPRED_RULE_PREFIX
public static final java.lang.String GRAMMAR_FILE_EXTENSION
public static final java.lang.String LEXER_GRAMMAR_FILE_EXTENSION
public static final int INITIAL_DECISION_LIST_SIZE
public static final int INVALID_RULE_INDEX
public static final int RULE_LABEL
public static final int TOKEN_LABEL
public static final int RULE_LIST_LABEL
public static final int TOKEN_LIST_LABEL
public static final int CHAR_LABEL
public static java.lang.String[] LabelTypeToString
public static final java.lang.String ARTIFICIAL_TOKENS_RULENAME
public static final java.lang.String FRAGMENT_RULE_MODIFIER
public static final java.lang.String SYNPREDGATE_ACTION_NAME
public static int[] ANTLRLiteralEscapedCharValue
public static java.lang.String[] ANTLRLiteralCharValueEscape
public static final int LEXER
public static final int PARSER
public static final int TREE_PARSER
public static final int COMBINED
public static final java.lang.String[] grammarTypeToString
public static final java.lang.String[] grammarTypeToFileNameSuffix
protected antlr.TokenStreamRewriteEngine tokenBuffer
public static final java.lang.String IGNORE_STRING_IN_GRAMMAR_FILE_NAME
public java.lang.String name
public int type
protected java.util.Map options
public static final java.util.Set legalOptions
public static final java.util.Set doNotCopyOptionsToLexer
public static final java.util.Map defaultOptions
protected int global_k
protected java.util.Map actions
protected NFA nfa
protected int maxTokenType
protected IntSet charVocabulary
protected java.util.Map tokenIDToTypeMap
protected java.util.Map stringLiteralToTypeMap
protected java.util.Vector typeToTokenList
protected Grammar importTokenVocabularyFromGrammar
public Tool tool
protected java.util.Set<antlr.Token> ruleRefs
protected java.util.Set<antlr.Token> tokenIDRefs
protected java.util.Set<java.lang.String> lexerRules
protected int decisionNumber
protected int ruleIndex
protected java.util.Set leftRecursiveRules
protected boolean externalAnalysisAbort
protected java.util.LinkedHashMap nameToSynpredASTMap
protected java.util.LinkedHashMap nameToRuleMap
protected java.util.Map scopes
protected java.util.Vector ruleIndexToRuleList
protected GrammarAST grammarTree
protected java.util.Vector indexToDecision
protected CodeGenerator generator
protected java.util.Set lookBusy
protected java.util.Set visitedDuringRecursionCheck
protected boolean watchNFAConversion
protected StringTemplate lexerGrammarST
protected java.lang.String fileName
public long DFACreationWallClockTimeInMS
public int numberOfSemanticPredicates
public int numberOfManualLookaheadOptions
public java.util.Set setOfNondeterministicDecisionNumbers
public java.util.Set setOfNondeterministicDecisionNumbersResolvedWithPredicates
public java.util.Set setOfDFAWhoseConversionTerminatedEarly
public java.util.Set<GrammarAST> blocksWithSynPreds
public java.util.Set<DFA> decisionsWhoseDFAsUsesSynPreds
public java.util.Set<java.lang.String> synPredNamesUsedInDFA
public java.util.Set<GrammarAST> blocksWithSemPreds
public java.util.Set decisionsWhoseDFAsUsesSemPreds
protected boolean allDecisionDFACreated
protected boolean builtFromString
Constructor Detail |
---|
public Grammar()
public Grammar(java.lang.String grammarString) throws antlr.RecognitionException, antlr.TokenStreamException
antlr.RecognitionException
antlr.TokenStreamException
public Grammar(java.lang.String fileName, java.lang.String grammarString) throws antlr.RecognitionException, antlr.TokenStreamException
antlr.RecognitionException
antlr.TokenStreamException
public Grammar(Tool tool, java.lang.String fileName, java.io.Reader r) throws antlr.RecognitionException, antlr.TokenStreamException
antlr.RecognitionException
antlr.TokenStreamException
Method Detail |
---|
public void setFileName(java.lang.String fileName)
public java.lang.String getFileName()
public void setName(java.lang.String name)
public void setGrammarContent(java.lang.String grammarString) throws antlr.RecognitionException, antlr.TokenStreamException
antlr.RecognitionException
antlr.TokenStreamException
public void setGrammarContent(java.io.Reader r) throws antlr.RecognitionException, antlr.TokenStreamException
antlr.RecognitionException
antlr.TokenStreamException
public java.lang.String getLexerGrammar()
public java.lang.String getImplicitlyGeneratedLexerFileName()
public java.io.File getImportedVocabFileName(java.lang.String vocabName)
public GrammarAST addArtificialMatchTokensRule(GrammarAST grammarAST, java.util.List ruleNames, boolean filterMode)
protected java.util.List getArtificialRulesForSyntacticPredicates(ANTLRParser parser, java.util.LinkedHashMap nameToSynpredASTMap)
protected void initTokenSymbolTables()
public void createNFAs()
public void createLookaheadDFAs()
public void createLookaheadDFA(int decision)
public void externallyAbortNFAToDFAConversion()
public boolean NFAToDFAConversionExternallyAborted()
public int getNewTokenType()
public void defineToken(java.lang.String text, int tokenType)
public void defineRule(antlr.Token ruleToken, java.lang.String modifier, java.util.Map options, GrammarAST tree, GrammarAST argActionAST, int numAlts)
public java.lang.String defineSyntacticPredicate(GrammarAST blockAST, java.lang.String currentRuleName)
public java.util.LinkedHashMap getSyntacticPredicates()
public GrammarAST getSyntacticPredicate(java.lang.String name)
public void synPredUsedInDFA(DFA dfa, SemanticContext semCtx)
public void defineNamedAction(GrammarAST ampersandAST, java.lang.String scope, GrammarAST nameAST, GrammarAST actionAST)
public java.util.Map getActions()
public java.lang.String getDefaultActionScope(int grammarType)
public void defineLexerRuleFoundInParser(antlr.Token ruleToken, GrammarAST ruleAST)
public void defineLexerRuleForAliasedStringLiteral(java.lang.String tokenID, java.lang.String literal, int tokenType)
public void defineLexerRuleForStringLiteral(java.lang.String literal, int tokenType)
public Rule getRule(java.lang.String ruleName)
public int getRuleIndex(java.lang.String ruleName)
public java.lang.String getRuleName(int ruleIndex)
public AttributeScope defineGlobalScope(java.lang.String name, antlr.Token scopeAction)
public AttributeScope createReturnScope(java.lang.String ruleName, antlr.Token retAction)
public AttributeScope createRuleScope(java.lang.String ruleName, antlr.Token scopeAction)
public AttributeScope createParameterScope(java.lang.String ruleName, antlr.Token argAction)
public AttributeScope getGlobalScope(java.lang.String name)
public java.util.Map getGlobalScopes()
protected void defineLabel(Rule r, antlr.Token label, GrammarAST element, int type)
public void defineTokenRefLabel(java.lang.String ruleName, antlr.Token label, GrammarAST tokenRef)
public void defineRuleRefLabel(java.lang.String ruleName, antlr.Token label, GrammarAST ruleRef)
public void defineTokenListLabel(java.lang.String ruleName, antlr.Token label, GrammarAST element)
public void defineRuleListLabel(java.lang.String ruleName, antlr.Token label, GrammarAST element)
public java.util.Set<java.lang.String> getLabels(java.util.Set<GrammarAST> rewriteElements, int labelType)
protected void examineAllExecutableActions()
public void checkAllRulesForUselessLabels()
protected void removeUselessLabels(java.util.Map ruleToElementLabelPairMap)
public void altReferencesRule(java.lang.String ruleName, GrammarAST refAST, int outerAltNum)
public void altReferencesTokenID(java.lang.String ruleName, GrammarAST refAST, int outerAltNum)
public void referenceRuleLabelPredefinedAttribute(java.lang.String ruleName)
public java.util.List checkAllRulesForLeftRecursion()
public java.util.Set getLeftRecursiveRules()
public void checkRuleReference(GrammarAST refAST, GrammarAST argsAST, java.lang.String currentRuleName)
public boolean isEmptyRule(GrammarAST block)
public int getTokenType(java.lang.String tokenName)
public java.util.Set getTokenIDs()
public java.util.Collection getTokenTypesWithoutID()
public java.util.Set getTokenDisplayNames()
public static int getCharValueFromGrammarCharLiteral(java.lang.String literal)
public static java.lang.StringBuffer getUnescapedStringFromGrammarStringLiteral(java.lang.String literal)
public int importTokenVocabulary(Grammar importFromGr)
public int importTokenVocabulary(java.lang.String vocabName)
public java.lang.String getTokenDisplayName(int ttype)
public java.util.Set getStringLiterals()
public int getGrammarMaxLookahead()
public java.lang.String setOption(java.lang.String key, java.lang.Object value, antlr.Token optionsStartToken)
public void setOptions(java.util.Map options, antlr.Token optionsStartToken)
public java.lang.Object getOption(java.lang.String key)
public boolean optionIsValid(java.lang.String key, java.lang.Object value)
public boolean buildAST()
public boolean isBuiltFromString()
public boolean buildTemplate()
public java.util.Collection getRules()
public void setRuleAST(java.lang.String ruleName, GrammarAST t)
public void setRuleStartState(java.lang.String ruleName, NFAState startState)
public void setRuleStopState(java.lang.String ruleName, NFAState stopState)
public NFAState getRuleStartState(java.lang.String ruleName)
public java.lang.String getRuleModifier(java.lang.String ruleName)
public NFAState getRuleStopState(java.lang.String ruleName)
public int assignDecisionNumber(NFAState state)
protected Grammar.Decision getDecision(int decision)
protected Grammar.Decision createDecision(int decision)
public java.util.List getDecisionNFAStartStateList()
public NFAState getDecisionNFAStartState(int decision)
public DFA getLookaheadDFA(int decision)
public GrammarAST getDecisionBlockAST(int decision)
public java.util.List getLookaheadDFAColumnsForLineInFile(int line)
public DFA getLookaheadDFAFromPositionInFile(int line, int col)
public java.util.Map getLineColumnToLookaheadDFAMap()
public int getNumberOfDecisions()
public int getNumberOfCyclicDecisions()
public void setLookaheadDFA(int decision, DFA lookaheadDFA)
public void setDecisionNFA(int decision, NFAState state)
public void setDecisionBlockAST(int decision, GrammarAST blockAST)
public boolean allDecisionDFAHaveBeenCreated()
public int getMaxTokenType()
public int getMaxCharValue()
public IntSet getTokenTypes()
public IntSet getAllCharValues()
public static java.lang.String getANTLRCharLiteralForChar(int c)
public IntSet complement(IntSet set)
public IntSet complement(int atom)
public boolean isValidSet(TreeToNFAConverter nfabuilder, GrammarAST t)
public IntSet getSetFromRule(TreeToNFAConverter nfabuilder, java.lang.String ruleName) throws antlr.RecognitionException
antlr.RecognitionException
public int getNumberOfAltsForDecisionNFA(NFAState decisionState)
public NFAState getNFAStateForAltOfDecision(NFAState decisionState, int alt)
public LookaheadSet LOOK(NFAState s)
protected LookaheadSet _LOOK(NFAState s)
public void setCodeGenerator(CodeGenerator generator)
public CodeGenerator getCodeGenerator()
public GrammarAST getGrammarTree()
public Tool getTool()
public void setTool(Tool tool)
public java.lang.String computeTokenNameFromLiteral(int tokenType, java.lang.String literal)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String grammarTreeToString(GrammarAST t)
public java.lang.String grammarTreeToString(GrammarAST t, boolean showActions)
public void setWatchNFAConversion(boolean watchNFAConversion)
public boolean getWatchNFAConversion()
public void printGrammar(java.io.PrintStream output)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |