Public Member Functions | |
CSharpCodeGenerator () | |
void | exitIfError () |
void | gen () |
void | gen (ActionElement action) |
void | gen (AlternativeBlock blk) |
void | gen (BlockEndElement end) |
void | gen (CharLiteralElement atom) |
void | gen (CharRangeElement r) |
void | gen (LexerGrammar g) throws IOException |
void | gen (OneOrMoreBlock blk) |
void | gen (ParserGrammar g) throws IOException |
void | gen (RuleRefElement rr) |
void | gen (StringLiteralElement atom) |
void | gen (TokenRangeElement r) |
void | gen (TokenRefElement atom) |
void | gen (TreeElement t) |
void | gen (TreeWalkerGrammar g) throws IOException |
void | gen (WildcardElement wc) |
void | gen (ZeroOrMoreBlock blk) |
void | genBody (LexerGrammar g) throws IOException |
void | genInitFactory (Grammar g) |
void | genBody (ParserGrammar g) throws IOException |
void | genBody (TreeWalkerGrammar g) throws IOException |
CSharpBlockFinishingInfo | genCommonBlock (AlternativeBlock blk, boolean noTestForSingle) |
void | genNextToken () |
void | genRule (RuleSymbol s, boolean startSymbol, int ruleNum, TokenManager tm) |
void | genTokenStrings () |
String | processStringForASTConstructor (String str) |
String | getASTCreateString (Vector v) |
String | getASTCreateString (GrammarAtom atom, String astCtorArgs) |
String | getASTCreateString (String astCtorArgs) |
String | getRangeExpression (int k, int[] elems) |
String | mapTreeId (String idParam, ActionTransInfo transInfo) |
void | setupOutput (String className) throws IOException |
String | getTokenTypesClassName () |
String[] | split (String str, String sep) |
Static Public Attributes | |
static final int | caseSizeThreshold = 127 |
Protected Member Functions | |
int | addSemPred (String predicate) |
void | genAlt (Alternative alt, AlternativeBlock blk) |
void | genBitsets (Vector bitsetList, int maxVocabulary) |
String | getBitsetName (int index) |
void | genBlockInitAction (AlternativeBlock blk) |
void | genBlockPreamble (AlternativeBlock blk) |
void | genCases (BitSet p) |
void | genASTDeclaration (AlternativeElement el) |
void | genASTDeclaration (AlternativeElement el, String node_type) |
void | genASTDeclaration (AlternativeElement el, String var_name, String node_type) |
void | genHeader () |
void | genMatch (BitSet b) |
void | genMatch (GrammarAtom atom) |
void | genMatchUsingAtomText (GrammarAtom atom) |
void | genMatchUsingAtomTokenType (GrammarAtom atom) |
void | genSemPred (String pred, int line) |
void | genSemPredMap () |
void | genSynPred (SynPredBlock blk, String lookaheadExpr) |
void | genTokenTypes (TokenManager tm) throws IOException |
void | genTokenDefinitions (TokenManager tm) throws IOException |
String | getLookaheadTestExpression (Lookahead[] look, int k) |
String | getLookaheadTestExpression (Alternative alt, int maxDepth) |
String | getLookaheadTestTerm (int k, BitSet p) |
boolean | lookaheadIsEmpty (Alternative alt, int maxDepth) |
String | processActionForSpecialSymbols (String actionStr, int line, RuleBlock currentRule, ActionTransInfo tInfo) |
Protected Attributes | |
int | syntacticPredLevel = 0 |
boolean | genAST = false |
boolean | saveText = false |
Static Protected Attributes | |
static final String | NONUNIQUE = new String() |
Package Attributes | |
boolean | usingCustomAST = false |
String | labeledElementType |
String | labeledElementASTType |
String | labeledElementInit |
String | commonExtraArgs |
String | commonExtraParams |
String | commonLocalVars |
String | lt1Value |
String | exceptionThrown |
String | throwNoViable |
RuleBlock | currentRule |
String | currentASTResult |
Hashtable | treeVariableMap = new Hashtable() |
Hashtable | declaredASTVariables = new Hashtable() |
int | astVarNumber = 1 |
int | saveIndexCreateLevel |
int | blockNestingLevel |
Generates MyParser.cs, MyLexer.cs and MyParserTokenTypes.cs
antlr.CSharpCodeGenerator.CSharpCodeGenerator | ( | ) |
Create a CSharp code-generator using the given Grammar. The caller must still call setTool, setBehavior, and setAnalyzer before generating code.
References antlr.CodeGenerator.charFormatter.
int antlr.CSharpCodeGenerator.addSemPred | ( | String | predicate | ) | [protected] |
Adds a semantic predicate string to the sem pred vector These strings will be used to build an array of sem pred names when building a debugging parser. This method should only be called when the debug option is specified
References antlr.collections.impl.Vector.appendElement(), and antlr.collections.impl.Vector.size().
Referenced by antlr.CSharpCodeGenerator.genCommonBlock(), and antlr.CSharpCodeGenerator.genSemPred().
void antlr.CSharpCodeGenerator.exitIfError | ( | ) |
void antlr.CSharpCodeGenerator.gen | ( | ActionElement | action | ) | [virtual] |
Generate code for the given grammar element.
blk | The {...} action to generate |
Implements antlr.CodeGenerator.
References antlr.ActionElement.actionText, antlr.ActionTransInfo.assignToRoot, antlr.CSharpCodeGenerator.currentRule, antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.CSharpCodeGenerator.genSemPred(), antlr.GrammarElement.getLine(), antlr.CodeGenerator.grammar, antlr.Grammar.hasSyntacticPredicate, antlr.ActionElement.isSemPred, antlr.CSharpCodeGenerator.labeledElementASTType, antlr.GrammarElement.line, antlr.CodeGenerator.printAction(), antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.processActionForSpecialSymbols(), antlr.ActionTransInfo.refRuleRoot, and antlr.CodeGenerator.tabs.
void antlr.CSharpCodeGenerator.gen | ( | CharRangeElement | r | ) | [virtual] |
Generate code for the given grammar element.
blk | The character-range reference to generate |
Implements antlr.CodeGenerator.
References antlr.CharRangeElement.beginText, antlr.CharRangeElement.endText, antlr.AlternativeElement.getAutoGenType(), antlr.CharRangeElement.getLabel(), antlr.CodeGenerator.grammar, antlr.CSharpCodeGenerator.lt1Value, antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.saveText, and antlr.CSharpCodeGenerator.syntacticPredLevel.
void antlr.CSharpCodeGenerator.gen | ( | TreeElement | t | ) | [virtual] |
Generate code for the given grammar element.
blk | The tree to generate code for. |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.antlrTool, antlr.Grammar.buildAST, antlr.Tool.error(), antlr.GrammarElement.generate(), antlr.CSharpCodeGenerator.genMatch(), antlr.AlternativeBlock.getAlternativeAt(), antlr.AlternativeBlock.getAlternatives(), antlr.AlternativeElement.getAutoGenType(), antlr.GrammarElement.getColumn(), antlr.Grammar.getFilename(), antlr.GrammarAtom.getLabel(), antlr.GrammarElement.getLine(), antlr.CodeGenerator.grammar, antlr.Alternative.head, antlr.AlternativeBlock.ID, antlr.CSharpCodeGenerator.labeledElementASTType, antlr.AlternativeElement.next, antlr.CodeGenerator.println(), antlr.TreeElement.root, antlr.AlternativeElement.setAutoGenType(), antlr.collections.impl.Vector.size(), and antlr.Tool.warning().
void antlr.CSharpCodeGenerator.gen | ( | TreeWalkerGrammar | g | ) | throws IOException [virtual] |
Generate the tree-parser CSharp file
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.antlrTool, antlr.CSharpCodeGenerator.genBody(), antlr.CodeGenerator.grammar, antlr.Tool.panic(), and antlr.CodeGenerator.setGrammar().
void antlr.CSharpCodeGenerator.gen | ( | LexerGrammar | g | ) | throws IOException [virtual] |
Generate the lexer CSharp file
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.antlrTool, antlr.CSharpCodeGenerator.genBody(), antlr.CodeGenerator.grammar, antlr.Tool.panic(), and antlr.CodeGenerator.setGrammar().
void antlr.CSharpCodeGenerator.gen | ( | WildcardElement | wc | ) | [virtual] |
Generate code for the given grammar element.
wc | The wildcard element to generate |
Implements antlr.CodeGenerator.
References antlr.AlternativeElement.getAutoGenType(), antlr.WildcardElement.getLabel(), antlr.CodeGenerator.grammar, antlr.CSharpCodeGenerator.lt1Value, antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.saveText, and antlr.CSharpCodeGenerator.syntacticPredLevel.
void antlr.CSharpCodeGenerator.gen | ( | ZeroOrMoreBlock | blk | ) | [virtual] |
Generate code for the given grammar element.
blk | The (...)* block to generate |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._print(), antlr.CSharpCodeGenerator.blockNestingLevel, antlr.Lookahead.containsEpsilon(), antlr.CSharpCodeGenerator.currentASTResult, antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.LLkGrammarAnalyzer.deterministic(), antlr.BlockWithImpliedExitPath.exitCache, antlr.BlockWithImpliedExitPath.exitLookaheadDepth, antlr.CSharpCodeGenerator.genBlockInitAction(), antlr.CSharpCodeGenerator.genBlockPreamble(), antlr.CSharpCodeGenerator.genCommonBlock(), antlr.AlternativeBlock.getLabel(), antlr.CSharpCodeGenerator.getLookaheadTestExpression(), antlr.CodeGenerator.grammar, antlr.AlternativeBlock.greedy, antlr.AlternativeBlock.ID, antlr.Grammar.maxk, antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.saveIndexCreateLevel, antlr.CodeGenerator.tabs, and antlr.Grammar.theLLkAnalyzer.
void antlr.CSharpCodeGenerator.gen | ( | AlternativeBlock | blk | ) | [virtual] |
Generate code for the given grammar element.
blk | The "x|y|z|..." block to generate |
Implements antlr.CodeGenerator.
References antlr.CSharpCodeGenerator.currentASTResult, antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.LLkGrammarAnalyzer.deterministic(), antlr.CSharpCodeGenerator.genBlockInitAction(), antlr.CSharpCodeGenerator.genBlockPreamble(), antlr.CSharpCodeGenerator.genCommonBlock(), antlr.AlternativeBlock.getLabel(), antlr.CodeGenerator.grammar, antlr.CodeGenerator.println(), antlr.CodeGenerator.tabs, antlr.Grammar.theLLkAnalyzer, and antlr.CSharpCodeGenerator.throwNoViable.
void antlr.CSharpCodeGenerator.gen | ( | OneOrMoreBlock | blk | ) | [virtual] |
Generate code for the given grammar element.
blk | The (...)+ block to generate |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._print(), antlr.CSharpCodeGenerator.blockNestingLevel, antlr.Lookahead.containsEpsilon(), antlr.CSharpCodeGenerator.currentASTResult, antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.LLkGrammarAnalyzer.deterministic(), antlr.BlockWithImpliedExitPath.exitCache, antlr.BlockWithImpliedExitPath.exitLookaheadDepth, antlr.CSharpCodeGenerator.genBlockInitAction(), antlr.CSharpCodeGenerator.genBlockPreamble(), antlr.CSharpCodeGenerator.genCommonBlock(), antlr.AlternativeBlock.getLabel(), antlr.CSharpCodeGenerator.getLookaheadTestExpression(), antlr.CodeGenerator.grammar, antlr.AlternativeBlock.greedy, antlr.AlternativeBlock.ID, antlr.Grammar.maxk, antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.saveIndexCreateLevel, antlr.CodeGenerator.tabs, antlr.Grammar.theLLkAnalyzer, and antlr.CSharpCodeGenerator.throwNoViable.
void antlr.CSharpCodeGenerator.gen | ( | ParserGrammar | g | ) | throws IOException [virtual] |
Generate the parser CSharp file
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.antlrTool, antlr.CSharpCodeGenerator.genBody(), antlr.CodeGenerator.grammar, antlr.Tool.panic(), and antlr.CodeGenerator.setGrammar().
void antlr.CSharpCodeGenerator.gen | ( | ) | [virtual] |
Generate the parser, lexer, treeparser, and token types in CSharp
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.analyzer, antlr.CodeGenerator.antlrTool, antlr.CodeGenerator.behavior, antlr.CSharpCodeGenerator.exitIfError(), antlr.Grammar.generate(), antlr.CodeGenerator.genTokenInterchange(), antlr.CSharpCodeGenerator.genTokenTypes(), antlr.DefineGrammarSymbols.grammars, antlr.TokenManager.isReadOnly(), antlr.Tool.reportException(), antlr.Grammar.setCodeGenerator(), antlr.LLkGrammarAnalyzer.setGrammar(), antlr.Grammar.setGrammarAnalyzer(), and antlr.DefineGrammarSymbols.tokenManagers.
Referenced by antlr.CSharpCodeGenerator.genMatch(), and antlr.CSharpCodeGenerator.genSynPred().
void antlr.CSharpCodeGenerator.gen | ( | BlockEndElement | end | ) | [virtual] |
Generate code for the given grammar element.
blk | The block-end element to generate. Block-end elements are synthesized by the grammar parser to represent the end of a block. |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.DEBUG_CODE_GENERATOR.
void antlr.CSharpCodeGenerator.gen | ( | RuleRefElement | rr | ) | [virtual] |
Generate code for the given grammar element.
blk | The rule-reference to generate |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._print(), antlr.CodeGenerator.antlrTool, antlr.RuleSymbol.block, antlr.Grammar.buildAST, antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.Tool.error(), antlr.CSharpCodeGenerator.genAST, antlr.AlternativeElement.getAutoGenType(), antlr.GrammarElement.getColumn(), antlr.Grammar.getFilename(), antlr.RuleRefElement.getLabel(), antlr.GrammarElement.getLine(), antlr.Grammar.getSymbol(), antlr.CodeGenerator.grammar, antlr.Grammar.hasSyntacticPredicate, antlr.RuleRefElement.idAssign, antlr.RuleSymbol.isDefined(), antlr.CSharpCodeGenerator.labeledElementASTType, antlr.CSharpCodeGenerator.lt1Value, antlr.CodeGenerator.println(), antlr.CodeGenerator.printTabs(), antlr.RuleBlock.returnAction, antlr.CSharpCodeGenerator.saveText, antlr.CSharpCodeGenerator.syntacticPredLevel, antlr.CodeGenerator.tabs, antlr.RuleRefElement.targetRule, antlr.CSharpCodeGenerator.usingCustomAST, and antlr.Tool.warning().
void antlr.CSharpCodeGenerator.gen | ( | StringLiteralElement | atom | ) | [virtual] |
Generate code for the given grammar element.
blk | The string-literal reference to generate |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.CSharpCodeGenerator.genMatch(), antlr.AlternativeElement.getAutoGenType(), antlr.GrammarAtom.getLabel(), antlr.CodeGenerator.grammar, antlr.CSharpCodeGenerator.lt1Value, antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.saveText, and antlr.CSharpCodeGenerator.syntacticPredLevel.
void antlr.CSharpCodeGenerator.gen | ( | CharLiteralElement | atom | ) | [virtual] |
Generate code for the given grammar element.
blk | The character literal reference to generate |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.CSharpCodeGenerator.genMatch(), antlr.AlternativeElement.getAutoGenType(), antlr.GrammarAtom.getLabel(), antlr.CSharpCodeGenerator.lt1Value, antlr.CodeGenerator.println(), and antlr.CSharpCodeGenerator.saveText.
void antlr.CSharpCodeGenerator.gen | ( | TokenRangeElement | r | ) | [virtual] |
Generate code for the given grammar element.
blk | The token-range reference to generate |
Implements antlr.CodeGenerator.
References antlr.TokenRangeElement.beginText, antlr.TokenRangeElement.endText, antlr.TokenRangeElement.getLabel(), antlr.CSharpCodeGenerator.lt1Value, antlr.CodeGenerator.println(), and antlr.CSharpCodeGenerator.syntacticPredLevel.
void antlr.CSharpCodeGenerator.gen | ( | TokenRefElement | atom | ) | [virtual] |
Generate code for the given grammar element.
blk | The token-reference to generate |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.antlrTool, antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.CSharpCodeGenerator.genMatch(), antlr.GrammarAtom.getLabel(), antlr.CodeGenerator.grammar, antlr.CSharpCodeGenerator.lt1Value, antlr.Tool.panic(), antlr.CodeGenerator.println(), and antlr.CSharpCodeGenerator.syntacticPredLevel.
void antlr.CSharpCodeGenerator.genAlt | ( | Alternative | alt, | |
AlternativeBlock | blk | |||
) | [protected] |
Generate an alternative.
alt | The alternative to generate | |
blk | The block to which the alternative belongs |
References antlr.CodeGenerator.antlrTool, antlr.Alternative.exceptionSpec, antlr.CSharpCodeGenerator.genAST, antlr.GrammarElement.generate(), antlr.Alternative.getAutoGen(), antlr.GrammarElement.getColumn(), antlr.Grammar.getFilename(), antlr.AlternativeBlock.getLabel(), antlr.GrammarElement.getLine(), antlr.RuleBlock.getRuleName(), antlr.CodeGenerator.grammar, antlr.Alternative.head, antlr.CSharpCodeGenerator.labeledElementASTType, antlr.AlternativeElement.next, antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.saveText, antlr.CodeGenerator.tabs, antlr.CSharpCodeGenerator.treeVariableMap, antlr.CSharpCodeGenerator.usingCustomAST, and antlr.Tool.warning().
Referenced by antlr.CSharpCodeGenerator.genCommonBlock(), and antlr.CSharpCodeGenerator.genRule().
void antlr.CSharpCodeGenerator.genASTDeclaration | ( | AlternativeElement | el, | |
String | node_type | |||
) | [protected] |
void antlr.CSharpCodeGenerator.genASTDeclaration | ( | AlternativeElement | el, | |
String | var_name, | |||
String | node_type | |||
) | [protected] |
void antlr.CSharpCodeGenerator.genASTDeclaration | ( | AlternativeElement | el | ) | [protected] |
References antlr.CSharpCodeGenerator.labeledElementASTType.
Referenced by antlr.CSharpCodeGenerator.genASTDeclaration(), and antlr.CSharpCodeGenerator.genBlockPreamble().
void antlr.CSharpCodeGenerator.genBitsets | ( | Vector | bitsetList, | |
int | maxVocabulary | |||
) | [protected] |
Generate all the bitsets to be used in the parser or lexer Generate the raw bitset data like "long _tokenSet1_data[] = {...};" and the BitSet object declarations like "BitSet _tokenSet1 = new BitSet(_tokenSet1_data);" Note that most languages do not support object initialization inside a class definition, so other code-generators may have to separate the bitset declarations from the initializations (e.g., put the initializations in the generated constructor instead).
bitsetList | The list of bitsets to generate. | |
maxVocabulary | Ensure that each generated bitset can contain at least this value. |
References antlr.collections.impl.Vector.elementAt(), antlr.collections.impl.BitSet.growToInclude(), antlr.CodeGenerator.println(), and antlr.collections.impl.Vector.size().
Referenced by antlr.CSharpCodeGenerator.genBody().
void antlr.CSharpCodeGenerator.genBlockInitAction | ( | AlternativeBlock | blk | ) | [protected] |
Generate the init action for a block, which may be a RuleBlock or a plain AlternativeBLock. The block for which the preamble is to be generated.
References antlr.CSharpCodeGenerator.currentRule, antlr.GrammarElement.getLine(), antlr.AlternativeBlock.initAction, antlr.CodeGenerator.printAction(), and antlr.CSharpCodeGenerator.processActionForSpecialSymbols().
Referenced by antlr.CSharpCodeGenerator.gen(), and antlr.CSharpCodeGenerator.genRule().
void antlr.CSharpCodeGenerator.genBlockPreamble | ( | AlternativeBlock | blk | ) | [protected] |
Generate the header for a block, which may be a RuleBlock or a plain AlternativeBLock. This generates any variable declarations and syntactic-predicate-testing variables. The block for which the preamble is to be generated.
References antlr.CodeGenerator.analyzer, antlr.Grammar.buildAST, antlr.collections.impl.Vector.elementAt(), antlr.CSharpCodeGenerator.genASTDeclaration(), antlr.GrammarAtom.getASTNodeType(), antlr.AlternativeElement.getLabel(), antlr.AlternativeBlock.getLabel(), antlr.CodeGenerator.grammar, antlr.CSharpCodeGenerator.labeledElementInit, antlr.RuleBlock.labeledElements, antlr.CSharpCodeGenerator.labeledElementType, antlr.CodeGenerator.println(), antlr.collections.impl.Vector.size(), and antlr.LLkGrammarAnalyzer.subruleCanBeInverted().
Referenced by antlr.CSharpCodeGenerator.gen(), and antlr.CSharpCodeGenerator.genRule().
void antlr.CSharpCodeGenerator.genBody | ( | LexerGrammar | g | ) | throws IOException |
References antlr.CodeGenerator._println(), antlr.CodeGenerator.behavior, antlr.CodeGenerator.bitsetsUsed, antlr.Grammar.classMemberAction, antlr.Grammar.comment, antlr.CodeGenerator.currentOutput, antlr.CSharpCodeGenerator.currentRule, antlr.Grammar.debuggingOutput, antlr.collections.impl.Vector.elements(), antlr.CSharpNameSpace.emitClosures(), antlr.CSharpNameSpace.emitDeclarations(), antlr.CSharpCodeGenerator.exitIfError(), antlr.CSharpCodeGenerator.genAST, antlr.CSharpCodeGenerator.genBitsets(), antlr.CSharpCodeGenerator.genHeader(), antlr.CSharpCodeGenerator.genNextToken(), antlr.CSharpCodeGenerator.genRule(), antlr.CSharpCodeGenerator.genSemPredMap(), antlr.CSharpCodeGenerator.genTokenDefinitions(), antlr.Grammar.getClassName(), antlr.DefineGrammarSymbols.getHeaderAction(), antlr.GrammarSymbol.getId(), antlr.Token.getLine(), antlr.Grammar.getSuperClass(), antlr.Token.getText(), antlr.TokenManager.getTokenSymbol(), antlr.TokenManager.getTokenSymbolKeys(), antlr.TokenSymbol.getTokenType(), antlr.CodeGenerator.grammar, antlr.Grammar.options, antlr.Grammar.preambleAction, antlr.CodeGenerator.print(), antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.processActionForSpecialSymbols(), antlr.Grammar.rules, antlr.CSharpCodeGenerator.saveText, antlr.CSharpCodeGenerator.setupOutput(), antlr.collections.impl.Vector.size(), antlr.Grammar.superClass, antlr.CodeGenerator.tabs, and antlr.Grammar.tokenManager.
Referenced by antlr.CSharpCodeGenerator.gen().
void antlr.CSharpCodeGenerator.genBody | ( | ParserGrammar | g | ) | throws IOException |
References antlr.CodeGenerator._println(), antlr.CodeGenerator.behavior, antlr.CodeGenerator.bitsetsUsed, antlr.Grammar.buildAST, antlr.Grammar.classMemberAction, antlr.Grammar.comment, antlr.CodeGenerator.currentOutput, antlr.CSharpCodeGenerator.currentRule, antlr.Grammar.debuggingOutput, antlr.collections.impl.Vector.elements(), antlr.CSharpNameSpace.emitClosures(), antlr.CSharpNameSpace.emitDeclarations(), antlr.CSharpCodeGenerator.exitIfError(), antlr.CSharpCodeGenerator.genAST, antlr.CSharpCodeGenerator.genBitsets(), antlr.CSharpCodeGenerator.genHeader(), antlr.CSharpCodeGenerator.genInitFactory(), antlr.CSharpCodeGenerator.genRule(), antlr.CSharpCodeGenerator.genSemPredMap(), antlr.CSharpCodeGenerator.genTokenDefinitions(), antlr.CSharpCodeGenerator.genTokenStrings(), antlr.Grammar.getClassName(), antlr.DefineGrammarSymbols.getHeaderAction(), antlr.Token.getLine(), antlr.Grammar.getSuperClass(), antlr.Token.getText(), antlr.CodeGenerator.grammar, antlr.CSharpCodeGenerator.labeledElementASTType, antlr.Grammar.maxk, antlr.TokenManager.maxTokenType(), antlr.Grammar.options, antlr.Grammar.preambleAction, antlr.CodeGenerator.print(), antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.processActionForSpecialSymbols(), antlr.RuleSymbol.references, antlr.Grammar.rules, antlr.CSharpCodeGenerator.setupOutput(), antlr.collections.impl.Vector.size(), antlr.CSharpCodeGenerator.split(), antlr.Grammar.superClass, antlr.CodeGenerator.tabs, antlr.Grammar.tokenManager, antlr.CSharpCodeGenerator.usingCustomAST, and antlr.collections.impl.Vector.Vector().
void antlr.CSharpCodeGenerator.genBody | ( | TreeWalkerGrammar | g | ) | throws IOException |
References antlr.CodeGenerator._println(), antlr.CodeGenerator.behavior, antlr.CodeGenerator.bitsetsUsed, antlr.Grammar.buildAST, antlr.Grammar.classMemberAction, antlr.Grammar.comment, antlr.CodeGenerator.currentOutput, antlr.CSharpCodeGenerator.currentRule, antlr.collections.impl.Vector.elements(), antlr.CSharpNameSpace.emitClosures(), antlr.CSharpNameSpace.emitDeclarations(), antlr.CSharpCodeGenerator.exitIfError(), antlr.CSharpCodeGenerator.genAST, antlr.CSharpCodeGenerator.genBitsets(), antlr.CSharpCodeGenerator.genHeader(), antlr.CSharpCodeGenerator.genInitFactory(), antlr.CSharpCodeGenerator.genRule(), antlr.CSharpCodeGenerator.genTokenDefinitions(), antlr.CSharpCodeGenerator.genTokenStrings(), antlr.Grammar.getClassName(), antlr.DefineGrammarSymbols.getHeaderAction(), antlr.Token.getLine(), antlr.Grammar.getSuperClass(), antlr.Token.getText(), antlr.CodeGenerator.grammar, antlr.CSharpCodeGenerator.labeledElementASTType, antlr.TokenManager.maxTokenType(), antlr.Grammar.options, antlr.Grammar.preambleAction, antlr.CodeGenerator.print(), antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.processActionForSpecialSymbols(), antlr.RuleSymbol.references, antlr.Grammar.rules, antlr.CSharpCodeGenerator.setupOutput(), antlr.collections.impl.Vector.size(), antlr.Grammar.superClass, antlr.CodeGenerator.tabs, antlr.Grammar.tokenManager, antlr.CSharpCodeGenerator.usingCustomAST, and antlr.collections.impl.Vector.Vector().
void antlr.CSharpCodeGenerator.genCases | ( | BitSet | p | ) | [protected] |
Generate a series of case statements that implement a BitSet test.
p | The Bitset for which cases are to be generated |
References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.CodeGenerator.grammar, antlr.CodeGenerator.print(), and antlr.collections.impl.BitSet.toArray().
Referenced by antlr.CSharpCodeGenerator.genCommonBlock().
CSharpBlockFinishingInfo antlr.CSharpCodeGenerator.genCommonBlock | ( | AlternativeBlock | blk, | |
boolean | noTestForSingle | |||
) |
Generate common code for a block of alternatives; return a postscript that needs to be generated at the end of the block. Other routines may append else-clauses and such for error checking before the postfix is generated. If the grammar is a lexer, then generate alternatives in an order where alternatives requiring deeper lookahead are generated first, and EOF in the lookahead set reduces the depth of the lookahead.
blk | The block to generate | |
noTestForSingle | If true, then it does not generate a test for a single alternative. |
References antlr.CSharpCodeGenerator.addSemPred(), antlr.AlternativeBlock.alternatives, antlr.CodeGenerator.analyzer, antlr.CodeGenerator.antlrTool, antlr.CSharpCodeGenerator.blockNestingLevel, antlr.Alternative.cache, antlr.CSharpCodeGenerator.caseSizeThreshold, antlr.CodeGenerator.charFormatter, antlr.Lookahead.containsEpsilon(), antlr.CSharpCodeGenerator.currentRule, antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.Grammar.debuggingOutput, antlr.collections.impl.BitSet.degree(), antlr.CharFormatter.escapeString(), antlr.Lookahead.fset, antlr.CSharpCodeGenerator.genAlt(), antlr.CSharpCodeGenerator.genAST, antlr.CSharpCodeGenerator.genCases(), antlr.CSharpBlockFinishingInfo.generatedAnIf, antlr.CSharpBlockFinishingInfo.generatedSwitch, antlr.CSharpCodeGenerator.genSemPred(), antlr.CSharpCodeGenerator.genSynPred(), antlr.AlternativeBlock.getAlternativeAt(), antlr.AlternativeBlock.getAlternatives(), antlr.AlternativeBlock.getAutoGen(), antlr.CSharpCodeGenerator.getBitsetName(), antlr.GrammarElement.getColumn(), antlr.Grammar.getFilename(), antlr.AlternativeBlock.getLabel(), antlr.GrammarElement.getLine(), antlr.CSharpCodeGenerator.getLookaheadTestExpression(), antlr.CodeGenerator.grammar, antlr.Alternative.head, antlr.GrammarElement.line, antlr.LLkGrammarAnalyzer.look(), antlr.Alternative.lookaheadDepth, antlr.CSharpCodeGenerator.lookaheadIsEmpty(), antlr.CSharpCodeGenerator.lt1Value, antlr.CodeGenerator.makeSwitchThreshold, antlr.CodeGenerator.markBitsetForGen(), antlr.Grammar.maxk, antlr.CSharpBlockFinishingInfo.needAnErrorClause, antlr.AlternativeBlock.not, antlr.CSharpBlockFinishingInfo.postscript, antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.processActionForSpecialSymbols(), antlr.CSharpCodeGenerator.saveIndexCreateLevel, antlr.CSharpCodeGenerator.saveText, antlr.Alternative.semPred, antlr.collections.impl.Vector.size(), antlr.LLkGrammarAnalyzer.subruleCanBeInverted(), antlr.Alternative.synPred, antlr.CSharpCodeGenerator.syntacticPredLevel, antlr.CodeGenerator.tabs, antlr.CSharpCodeGenerator.usingCustomAST, and antlr.Tool.warning().
Referenced by antlr.CSharpCodeGenerator.gen(), antlr.CSharpCodeGenerator.genNextToken(), and antlr.CSharpCodeGenerator.genRule().
void antlr.CSharpCodeGenerator.genHeader | ( | ) | [protected] |
Generate a header that is common to all CSharp files
References antlr.CodeGenerator.antlrTool, antlr.Tool.fileMinusPath(), antlr.Grammar.getClassName(), antlr.CodeGenerator.grammar, antlr.Tool.grammarFile, and antlr.CodeGenerator.println().
Referenced by antlr.CSharpCodeGenerator.genBody(), and antlr.CSharpCodeGenerator.genTokenTypes().
void antlr.CSharpCodeGenerator.genInitFactory | ( | Grammar | g | ) |
References antlr.Grammar.buildAST, antlr.collections.impl.Vector.elementAt(), antlr.TokenSymbol.getASTNodeType(), antlr.TokenManager.getTokenSymbol(), antlr.TokenManager.getVocabulary(), antlr.TokenManager.maxTokenType(), antlr.CodeGenerator.println(), antlr.CodeGenerator.tabs, and antlr.Grammar.tokenManager.
Referenced by antlr.CSharpCodeGenerator.genBody().
void antlr.CSharpCodeGenerator.genMatch | ( | BitSet | b | ) | [protected] |
Referenced by antlr.CSharpCodeGenerator.gen().
void antlr.CSharpCodeGenerator.genMatch | ( | GrammarAtom | atom | ) | [protected] |
void antlr.CSharpCodeGenerator.genMatchUsingAtomText | ( | GrammarAtom | atom | ) | [protected] |
References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.GrammarAtom.atomText, antlr.AlternativeElement.getAutoGenType(), antlr.CodeGenerator.grammar, antlr.GrammarAtom.not, antlr.CodeGenerator.print(), antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.saveText, and antlr.CSharpCodeGenerator.usingCustomAST.
Referenced by antlr.CSharpCodeGenerator.genMatch().
void antlr.CSharpCodeGenerator.genMatchUsingAtomTokenType | ( | GrammarAtom | atom | ) | [protected] |
void antlr.CSharpCodeGenerator.genNextToken | ( | ) |
Generate the nextToken() rule. nextToken() is a synthetic lexer rule that is the implicit OR of all user-defined lexer rules.
References antlr.CodeGenerator._println(), antlr.RuleSymbol.access, antlr.CodeGenerator.antlrTool, antlr.Grammar.antlrTool, antlr.CSharpCodeGenerator.blockNestingLevel, antlr.Alternative.cache, antlr.Lookahead.containsEpsilon(), antlr.Grammar.define(), antlr.LLkGrammarAnalyzer.deterministic(), antlr.collections.impl.Vector.elementAt(), antlr.Tool.error(), antlr.CSharpCodeGenerator.genCommonBlock(), antlr.AlternativeBlock.getAlternativeAt(), antlr.AlternativeBlock.getAlternatives(), antlr.RuleBlock.getDefaultErrorHandler(), antlr.Grammar.getSymbol(), antlr.CodeGenerator.grammar, antlr.Alternative.head, antlr.Grammar.isDefined(), antlr.RuleSymbol.isDefined(), antlr.CodeGenerator.println(), antlr.Grammar.rules, antlr.CSharpCodeGenerator.saveIndexCreateLevel, antlr.RuleSymbol.setBlock(), antlr.RuleSymbol.setDefined(), antlr.collections.impl.Vector.size(), antlr.CodeGenerator.tabs, antlr.RuleRefElement.targetRule, antlr.Grammar.theLLkAnalyzer, antlr.CSharpCodeGenerator.throwNoViable, and antlr.Tool.warning().
Referenced by antlr.CSharpCodeGenerator.genBody().
void antlr.CSharpCodeGenerator.genRule | ( | RuleSymbol | s, | |
boolean | startSymbol, | |||
int | ruleNum, | |||
TokenManager | tm | |||
) |
Gen a named rule block. ASTs are generated for each element of an alternative unless the rule or the alternative have a '!' modifier.
If an alternative defeats the default tree construction, it must set <rule>_AST to the root of the returned AST.
Each alternative that does automatic tree construction, builds up root and child list pointers in an ASTPair structure.
A rule finishes by setting the returnAST variable from the ASTPair.
rule | The name of the rule to generate | |
startSymbol | true if the rule is a start symbol (i.e., not referenced elsewhere) |
References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.RuleSymbol.access, antlr.AlternativeBlock.alternatives, antlr.CodeGenerator.antlrTool, antlr.RuleBlock.argAction, antlr.CSharpCodeGenerator.blockNestingLevel, antlr.Grammar.buildAST, antlr.RuleSymbol.comment, antlr.CSharpCodeGenerator.commonExtraParams, antlr.CSharpCodeGenerator.commonLocalVars, antlr.CSharpCodeGenerator.currentASTResult, antlr.CSharpCodeGenerator.currentRule, antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.Grammar.debuggingOutput, antlr.CSharpCodeGenerator.declaredASTVariables, antlr.LLkGrammarAnalyzer.deterministic(), antlr.RuleBlock.endNode, antlr.Tool.error(), antlr.CSharpCodeGenerator.exceptionThrown, antlr.CodeGenerator.extractIdOfAction(), antlr.CodeGenerator.extractTypeOfAction(), antlr.RuleBlock.findExceptionSpec(), antlr.LLkGrammarAnalyzer.FOLLOW(), antlr.Lookahead.fset, antlr.CSharpCodeGenerator.genAlt(), antlr.CSharpCodeGenerator.genAST, antlr.CSharpCodeGenerator.genBlockInitAction(), antlr.CSharpCodeGenerator.genBlockPreamble(), antlr.CSharpCodeGenerator.genCommonBlock(), antlr.CSharpCodeGenerator.genSemPred(), antlr.AlternativeBlock.getAlternativeAt(), antlr.AlternativeBlock.getAutoGen(), antlr.CSharpCodeGenerator.getBitsetName(), antlr.RuleSymbol.getBlock(), antlr.GrammarElement.getColumn(), antlr.RuleBlock.getDefaultErrorHandler(), antlr.Grammar.getFilename(), antlr.GrammarSymbol.getId(), antlr.GrammarElement.getLine(), antlr.RuleBlock.getTestLiterals(), antlr.CodeGenerator.grammar, antlr.Grammar.hasSyntacticPredicate, antlr.RuleSymbol.isDefined(), antlr.CSharpCodeGenerator.labeledElementASTType, antlr.GrammarElement.line, antlr.CodeGenerator.markBitsetForGen(), antlr.CodeGenerator.print(), antlr.CodeGenerator.println(), antlr.RuleBlock.returnAction, antlr.RuleBlock.ruleName, antlr.CSharpCodeGenerator.saveIndexCreateLevel, antlr.CSharpCodeGenerator.saveText, antlr.Alternative.semPred, antlr.collections.impl.Vector.size(), antlr.Alternative.synPred, antlr.CodeGenerator.tabs, antlr.Grammar.theLLkAnalyzer, antlr.CSharpCodeGenerator.throwNoViable, antlr.RuleBlock.throwsSpec, antlr.Grammar.traceRules, antlr.CSharpCodeGenerator.usingCustomAST, and antlr.Tool.warning().
Referenced by antlr.CSharpCodeGenerator.genBody().
void antlr.CSharpCodeGenerator.genSemPred | ( | String | pred, | |
int | line | |||
) | [protected] |
References antlr.CSharpCodeGenerator.addSemPred(), antlr.CodeGenerator.charFormatter, antlr.CSharpCodeGenerator.currentRule, antlr.Grammar.debuggingOutput, antlr.CharFormatter.escapeString(), antlr.CodeGenerator.grammar, antlr.CodeGenerator.println(), and antlr.CSharpCodeGenerator.processActionForSpecialSymbols().
Referenced by antlr.CSharpCodeGenerator.gen(), antlr.CSharpCodeGenerator.genCommonBlock(), and antlr.CSharpCodeGenerator.genRule().
void antlr.CSharpCodeGenerator.genSemPredMap | ( | ) | [protected] |
Write an array of Strings which are the semantic predicate expressions. The debugger will reference them by number only
References antlr.collections.impl.Vector.elements(), antlr.CodeGenerator.println(), and antlr.CodeGenerator.tabs.
Referenced by antlr.CSharpCodeGenerator.genBody().
void antlr.CSharpCodeGenerator.genSynPred | ( | SynPredBlock | blk, | |
String | lookaheadExpr | |||
) | [protected] |
References antlr.CodeGenerator.DEBUG_CODE_GENERATOR, antlr.Grammar.debuggingOutput, antlr.CSharpCodeGenerator.exceptionThrown, antlr.CSharpCodeGenerator.gen(), antlr.CodeGenerator.grammar, antlr.AlternativeBlock.ID, antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.syntacticPredLevel, and antlr.CodeGenerator.tabs.
Referenced by antlr.CSharpCodeGenerator.genCommonBlock().
void antlr.CSharpCodeGenerator.genTokenDefinitions | ( | TokenManager | tm | ) | throws IOException [protected] |
References antlr.CodeGenerator.antlrTool, antlr.collections.impl.Vector.elementAt(), antlr.StringLiteralSymbol.label, antlr.Tool.panic(), antlr.CodeGenerator.println(), and antlr.collections.impl.Vector.size().
Referenced by antlr.CSharpCodeGenerator.genBody(), and antlr.CSharpCodeGenerator.genTokenTypes().
void antlr.CSharpCodeGenerator.genTokenStrings | ( | ) |
Generate a static array containing the names of the tokens, indexed by the token type values. This static array is used to format error messages so that the token identifers or literal strings are displayed instead of the token numbers.
If a lexical rule has a paraphrase, use it rather than the token label.
References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.CodeGenerator.charFormatter, antlr.collections.impl.Vector.elementAt(), antlr.TokenSymbol.getParaphrase(), antlr.TokenManager.getTokenSymbol(), antlr.TokenManager.getVocabulary(), antlr.CodeGenerator.grammar, antlr.CharFormatter.literalString(), antlr.CodeGenerator.print(), antlr.CodeGenerator.println(), antlr.collections.impl.Vector.size(), antlr.CodeGenerator.tabs, and antlr.Grammar.tokenManager.
Referenced by antlr.CSharpCodeGenerator.genBody().
void antlr.CSharpCodeGenerator.genTokenTypes | ( | TokenManager | tm | ) | throws IOException [protected] |
Generate the token types CSharp file
References antlr.CodeGenerator.behavior, antlr.CodeGenerator.currentOutput, antlr.CSharpNameSpace.emitClosures(), antlr.CSharpNameSpace.emitDeclarations(), antlr.CSharpCodeGenerator.exitIfError(), antlr.CSharpCodeGenerator.genHeader(), antlr.CSharpCodeGenerator.genTokenDefinitions(), antlr.DefineGrammarSymbols.getHeaderAction(), antlr.CodeGenerator.println(), antlr.CSharpCodeGenerator.setupOutput(), antlr.CodeGenerator.tabs, and antlr.CodeGenerator.TokenTypesFileSuffix.
Referenced by antlr.CSharpCodeGenerator.gen().
String antlr.CSharpCodeGenerator.getASTCreateString | ( | String | astCtorArgs | ) |
Returns a string expression that creates an AST node using the specified AST constructor argument string. Parses the first (possibly only) argument in the supplied AST ctor argument string to obtain the token type -- ctorID.
IF the token type is a valid token symbol AND it has an associated AST node type AND this is not a #[ID, "T", "ASTType"] constructor THEN generate a call to factory.create(ID, Text, token.ASTNodeType())
#[ID, "T", "ASTType"] constructors are mapped to astFactory.create(ID, "T", "ASTType")
The supported AST constructor forms are: #[ID] #[ID, "text"] #[ID, "text", ASTclassname] -- introduced in 2.7.2
astCtorArgs | The arguments to the AST constructor |
References antlr.TokenSymbol.getASTNodeType(), antlr.TokenManager.getTokenSymbol(), antlr.CodeGenerator.grammar, antlr.CSharpCodeGenerator.labeledElementASTType, antlr.Grammar.tokenManager, and antlr.CSharpCodeGenerator.usingCustomAST.
String antlr.CSharpCodeGenerator.getASTCreateString | ( | GrammarAtom | atom, | |
String | astCtorArgs | |||
) | [virtual] |
Get a string for an expression to generate creating of an AST node
atom | The grammar node for which you are creating the node | |
str | The arguments to the AST constructor |
Implements antlr.CodeGenerator.
References antlr.CSharpCodeGenerator.getASTCreateString(), antlr.TokenSymbol.getASTNodeType(), antlr.GrammarAtom.getASTNodeType(), antlr.GrammarAtom.getText(), antlr.TokenManager.getTokenSymbol(), antlr.CodeGenerator.grammar, antlr.CSharpCodeGenerator.labeledElementASTType, antlr.Grammar.tokenManager, and antlr.CSharpCodeGenerator.usingCustomAST.
String antlr.CSharpCodeGenerator.getASTCreateString | ( | Vector | v | ) | [virtual] |
Get a string for an expression to generate creation of an AST subtree.
v | A Vector of String, where each element is an expression in the target language yielding an AST node. |
Implements antlr.CodeGenerator.
References antlr.collections.impl.Vector.elementAt(), antlr.CSharpCodeGenerator.labeledElementASTType, and antlr.collections.impl.Vector.size().
Referenced by antlr.CSharpCodeGenerator.getASTCreateString().
String antlr.CSharpCodeGenerator.getBitsetName | ( | int | index | ) | [protected] |
Given the index of a bitset in the bitset list, generate a unique name. Specific code-generators may want to override this if the language does not allow '_' or numerals in identifiers.
index | The index of the bitset in the bitset list. |
Reimplemented from antlr.CodeGenerator.
Referenced by antlr.CSharpCodeGenerator.genCommonBlock(), antlr.CSharpCodeGenerator.genRule(), and antlr.CSharpCodeGenerator.getLookaheadTestTerm().
String antlr.CSharpCodeGenerator.getLookaheadTestExpression | ( | Lookahead[] | look, | |
int | k | |||
) | [protected] |
String antlr.CSharpCodeGenerator.getLookaheadTestExpression | ( | Alternative | alt, | |
int | maxDepth | |||
) | [protected] |
Generate a lookahead test expression for an alternate. This will be a series of tests joined by '&&' and enclosed by '()', the number of such tests being determined by the depth of the lookahead.
References antlr.Alternative.cache, antlr.CSharpCodeGenerator.getLookaheadTestExpression(), antlr.CodeGenerator.grammar, antlr.Alternative.lookaheadDepth, and antlr.Grammar.maxk.
String antlr.CSharpCodeGenerator.getLookaheadTestTerm | ( | int | k, | |
BitSet | p | |||
) | [protected] |
Generate a depth==1 lookahead test expression given the BitSet. This may be one of: 1) a series of 'x==X||' tests 2) a range test using >= && <= where possible, 3) a bitset membership test for complex comparisons
k | The lookahead level | |
p | The lookahead set for level k |
References antlr.CodeGenerator.bitsetTestThreshold, antlr.collections.impl.BitSet.degree(), antlr.CodeGenerator.elementsAreRange(), antlr.CSharpCodeGenerator.getBitsetName(), antlr.CSharpCodeGenerator.getRangeExpression(), antlr.CodeGenerator.markBitsetForGen(), and antlr.collections.impl.BitSet.toArray().
Referenced by antlr.CSharpCodeGenerator.getLookaheadTestExpression().
String antlr.CSharpCodeGenerator.getRangeExpression | ( | int | k, | |
int[] | elems | |||
) |
Return an expression for testing a contiguous renage of elements
k | The lookahead level | |
elems | The elements representing the set, usually from BitSet.toArray(). |
References antlr.CodeGenerator.antlrTool, antlr.CodeGenerator.elementsAreRange(), and antlr.Tool.panic().
Referenced by antlr.CSharpCodeGenerator.getLookaheadTestTerm().
String antlr.CSharpCodeGenerator.getTokenTypesClassName | ( | ) |
Helper method that returns the name of the interface/class/enum type for token type constants.
References antlr.TokenManager.getName(), antlr.CodeGenerator.grammar, antlr.Grammar.tokenManager, and antlr.CodeGenerator.TokenTypesFileSuffix.
boolean antlr.CSharpCodeGenerator.lookaheadIsEmpty | ( | Alternative | alt, | |
int | maxDepth | |||
) | [protected] |
Is the lookahead for this alt empty?
References antlr.Alternative.cache, antlr.collections.impl.BitSet.degree(), antlr.Lookahead.fset, antlr.CodeGenerator.grammar, antlr.Alternative.lookaheadDepth, and antlr.Grammar.maxk.
Referenced by antlr.CSharpCodeGenerator.genCommonBlock().
String antlr.CSharpCodeGenerator.mapTreeId | ( | String | idParam, | |
ActionTransInfo | transInfo | |||
) | [virtual] |
Map an identifier to it's corresponding tree-node variable. This is context-sensitive, depending on the rule and alternative being generated
idParam | The identifier name to map |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.antlrTool, antlr.Grammar.buildAST, antlr.CSharpCodeGenerator.currentRule, antlr.collections.impl.Vector.elementAt(), antlr.Tool.error(), antlr.AlternativeElement.getLabel(), antlr.RuleBlock.getRuleName(), antlr.CodeGenerator.grammar, antlr.RuleBlock.labeledElements, antlr.CSharpCodeGenerator.NONUNIQUE, antlr.ActionTransInfo.refRuleRoot, antlr.collections.impl.Vector.size(), and antlr.CSharpCodeGenerator.treeVariableMap.
String antlr.CSharpCodeGenerator.processActionForSpecialSymbols | ( | String | actionStr, | |
int | line, | |||
RuleBlock | currentRule, | |||
ActionTransInfo | tInfo | |||
) | [protected, virtual] |
Lexically process tree-specifiers in the action. This will replace id and #(...) with the appropriate function calls and/or variables.
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.antlrTool, antlr.Grammar.buildAST, antlr.Grammar.getFilename(), antlr.CodeGenerator.grammar, and antlr.Tool.panic().
Referenced by antlr.CSharpCodeGenerator.gen(), antlr.CSharpCodeGenerator.genBlockInitAction(), antlr.CSharpCodeGenerator.genBody(), antlr.CSharpCodeGenerator.genCommonBlock(), and antlr.CSharpCodeGenerator.genSemPred().
String antlr.CSharpCodeGenerator.processStringForASTConstructor | ( | String | str | ) |
Process a string for an simple expression for use in xx/action.g it is used to cast simple tokens/references to the right type for the generated language. Basically called for every element in the vector to getASTCreateString(vector V)
str | A String. |
Reimplemented from antlr.CodeGenerator.
References antlr.CodeGenerator.grammar, antlr.TokenManager.tokenDefined(), antlr.Grammar.tokenManager, and antlr.CSharpCodeGenerator.usingCustomAST.
void antlr.CSharpCodeGenerator.setupOutput | ( | String | className | ) | throws IOException |
This method exists so a subclass, namely VAJCodeGenerator, can open the file in its own evil way. JavaCodeGenerator simply opens a text file...
References antlr.CodeGenerator.antlrTool, antlr.CodeGenerator.currentOutput, and antlr.Tool.openOutputFile().
Referenced by antlr.CSharpCodeGenerator.genBody(), and antlr.CSharpCodeGenerator.genTokenTypes().
String [] antlr.CSharpCodeGenerator.split | ( | String | str, | |
String | sep | |||
) |
Referenced by antlr.CSharpCodeGenerator.genBody().
int antlr.CSharpCodeGenerator.astVarNumber = 1 [package] |
int antlr.CSharpCodeGenerator.blockNestingLevel [package] |
final int antlr.CSharpCodeGenerator.caseSizeThreshold = 127 [static] |
Referenced by antlr.CSharpCodeGenerator.genCommonBlock().
String antlr.CSharpCodeGenerator.commonExtraArgs [package] |
String antlr.CSharpCodeGenerator.commonExtraParams [package] |
Referenced by antlr.CSharpCodeGenerator.genRule().
String antlr.CSharpCodeGenerator.commonLocalVars [package] |
Referenced by antlr.CSharpCodeGenerator.genRule().
String antlr.CSharpCodeGenerator.currentASTResult [package] |
Referenced by antlr.CSharpCodeGenerator.gen(), and antlr.CSharpCodeGenerator.genRule().
Hashtable antlr.CSharpCodeGenerator.declaredASTVariables = new Hashtable() [package] |
Used to keep track of which AST variables have been defined in a rule (except for the rule_name and rule_name_in var's
Referenced by antlr.CSharpCodeGenerator.genASTDeclaration(), and antlr.CSharpCodeGenerator.genRule().
String antlr.CSharpCodeGenerator.exceptionThrown [package] |
Referenced by antlr.CSharpCodeGenerator.genRule(), and antlr.CSharpCodeGenerator.genSynPred().
boolean antlr.CSharpCodeGenerator.genAST = false [protected] |
String antlr.CSharpCodeGenerator.labeledElementASTType [package] |
String antlr.CSharpCodeGenerator.labeledElementInit [package] |
Referenced by antlr.CSharpCodeGenerator.genBlockPreamble().
String antlr.CSharpCodeGenerator.labeledElementType [package] |
Referenced by antlr.CSharpCodeGenerator.genBlockPreamble().
String antlr.CSharpCodeGenerator.lt1Value [package] |
Referenced by antlr.CSharpCodeGenerator.gen(), and antlr.CSharpCodeGenerator.genCommonBlock().
final String antlr.CSharpCodeGenerator.NONUNIQUE = new String() [static, protected] |
Special value used to mark duplicate in treeVariableMap
Referenced by antlr.CSharpCodeGenerator.mapTreeId().
int antlr.CSharpCodeGenerator.saveIndexCreateLevel [package] |
boolean antlr.CSharpCodeGenerator.saveText = false [protected] |
int antlr.CSharpCodeGenerator.syntacticPredLevel = 0 [protected] |
String antlr.CSharpCodeGenerator.throwNoViable [package] |
Hashtable antlr.CSharpCodeGenerator.treeVariableMap = new Hashtable() [package] |
Mapping between the ids used in the current alt, and the names of variables used to represent their AST values.
Referenced by antlr.CSharpCodeGenerator.genAlt(), and antlr.CSharpCodeGenerator.mapTreeId().
boolean antlr.CSharpCodeGenerator.usingCustomAST = false [package] |
Referenced by antlr.CSharpCodeGenerator.gen(), antlr.CSharpCodeGenerator.genAlt(), antlr.CSharpCodeGenerator.genBody(), antlr.CSharpCodeGenerator.genCommonBlock(), antlr.CSharpCodeGenerator.genMatchUsingAtomText(), antlr.CSharpCodeGenerator.genMatchUsingAtomTokenType(), antlr.CSharpCodeGenerator.genRule(), antlr.CSharpCodeGenerator.getASTCreateString(), and antlr.CSharpCodeGenerator.processStringForASTConstructor().