Method Summary |
|
protected void | _print(String s) Output a String to the currentOutput stream. |
protected void | _printAction(String s) Print an action without leading tabs, attempting to
preserve the current indentation level for multi-line actions
Ignored if string is null. |
protected void | _println(String s) Output a String followed by newline, to the currentOutput stream. |
protected int | addSemPred(String predicate) 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. |
protected int | countLines(String s) |
public void | exitIfError() |
public void | gen() |
public void | gen(ActionElement action) Generate code for the given grammar element. |
public void | gen(AlternativeBlock blk) Generate code for the given grammar element. |
public void | gen(BlockEndElement end) Generate code for the given grammar element.
Parameters: blk - The block-end element to generate. |
public void | gen(CharLiteralElement atom) Generate code for the given grammar element. |
public void | gen(CharRangeElement r) Generate code for the given grammar element. |
public void | gen(LexerGrammar g) |
public void | gen(OneOrMoreBlock blk) Generate code for the given grammar element. |
public void | gen(ParserGrammar g) |
public void | gen(RuleRefElement rr) Generate code for the given grammar element. |
public void | gen(StringLiteralElement atom) Generate code for the given grammar element. |
public void | gen(TokenRangeElement r) Generate code for the given grammar element. |
public void | gen(TokenRefElement atom) Generate code for the given grammar element. |
public void | gen(TreeElement t) |
public void | gen(TreeWalkerGrammar g) |
public void | gen(WildcardElement wc) Generate code for the given grammar element. |
public void | gen(ZeroOrMoreBlock blk) Generate code for the given grammar element. |
protected void | genASTDeclaration(AlternativeElement el) |
protected void | genASTDeclaration(AlternativeElement el, String node_type) |
protected void | genASTDeclaration(AlternativeElement el, String var_name, String node_type) |
protected void | genAlt(Alternative alt, AlternativeBlock blk) Generate an alternative. |
protected void | genBitsets(Vector bitsetList, int maxVocabulary, String prefix) 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). |
protected void | genBitsetsHeader(Vector bitsetList, int maxVocabulary) |
protected void | genBlockInitAction(AlternativeBlock blk) Generate the initaction for a block, which may be a RuleBlock or a
plain AlternativeBLock. |
protected void | genBlockPreamble(AlternativeBlock blk) Generate the header for a block, which may be a RuleBlock or a
plain AlternativeBLock. |
public void | genBody(LexerGrammar g) |
public void | genBody(ParserGrammar g) |
public void | genBody(TreeWalkerGrammar g) |
protected void | genCases(BitSet p) Generate a series of case statements that implement a BitSet test. |
public CppBlockFinishingInfo | 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. |
protected void | genHeader(String fileName) |
public void | genInclude(LexerGrammar g) |
public void | genInclude(ParserGrammar g) |
public void | genInclude(TreeWalkerGrammar g) |
public void | genInitFactory(Grammar g) |
public void | genLineNo(int line) |
public void | genLineNo(GrammarElement el) |
public void | genLineNo(Token t) |
public void | genLineNo2() |
protected void | genMatch(BitSet b) |
protected void | genMatch(GrammarAtom atom) |
protected void | genMatchUsingAtomText(GrammarAtom atom) |
protected void | genMatchUsingAtomTokenType(GrammarAtom atom) |
public void | genNextToken() Generate the nextToken() rule. |
public void | genRule(RuleSymbol s, boolean startSymbol, int ruleNum, String prefix) Gen a named rule block. |
public void | genRuleHeader(RuleSymbol s, boolean startSymbol) |
protected void | genSemPred(String pred, int line) |
protected void | genSemPredMap(String prefix) Write an array of Strings which are the semantic predicate
expressions. |
protected void | genSynPred(SynPredBlock blk, String lookaheadExpr) |
public void | genTokenStrings(String prefix) Generate a static array containing the names of the tokens,
indexed by the token type values. |
protected void | genTokenTypes(TokenManager tm) |
public String | getASTCreateString(Vector v) Get a string for an expression to generate creation of an AST subtree. |
public String | getASTCreateString(GrammarAtom atom, String str) |
public String | getASTCreateString(String str) |
protected String | getLookaheadTestExpression(Lookahead[] look, int k) |
protected String | getLookaheadTestExpression(Alternative alt, int maxDepth) Generate a lookahead test expression for an alternate. |
protected String | getLookaheadTestTerm(int k, BitSet p) Generate a depth==1 lookahead test expression given the BitSet. |
public String | getRangeExpression(int k, int[] elems) Return an expression for testing a contiguous renage of elements
Parameters: k - The lookahead level Parameters: elems - The elements representing the set, usually from BitSet.toArray(). |
protected boolean | lookaheadIsEmpty(Alternative alt, int maxDepth) |
public String | mapTreeId(String idParam, ActionTransInfo transInfo) Map an identifier to it's corresponding tree-node variable. |
public void | printAction(Token t) |
public void | printHeaderAction(String name) |
protected void | println(String s) Output tab indent followed by a String followed by newline,
to the currentOutput stream. |
protected String | processActionForSpecialSymbols(String actionStr, int line, RuleBlock currentRule, ActionTransInfo tInfo) Lexically process tree-specifiers in the action. |
public String | 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. |