| java.lang.Object antlr.CodeGenerator antlr.DocBookCodeGenerator
DocBookCodeGenerator | public class DocBookCodeGenerator extends CodeGenerator (Code) | | Generate P.sgml, a cross-linked representation of P with or without actions
|
Constructor Summary | |
public | DocBookCodeGenerator() Create a Diagnostic code-generator using the given Grammar
The caller must still call setTool, setBehavior, and setAnalyzer
before generating code. |
Method Summary | |
static String | HTMLEncode(String s) Encode a string for printing in a HTML document..
e.g. | static String | QuoteForId(String s) Encode a string for printing in a HTML document..
e.g. | public void | gen() | public void | gen(ActionElement action, Context context) Generate code for the given grammar element. | public void | gen(AlternativeBlock blk, Context context) Generate code for the given grammar element. | public void | gen(BlockEndElement end, Context context) Generate code for the given grammar element.
Parameters: blk - The block-end element to generate. | public void | gen(CharLiteralElement atom, Context context) Generate code for the given grammar element. | public void | gen(CharRangeElement r, Context context) Generate code for the given grammar element. | public void | gen(LexerGrammar g) | public void | gen(OneOrMoreBlock blk, Context context) Generate code for the given grammar element. | public void | gen(ParserGrammar g) | public void | gen(RuleRefElement rr, Context context) Generate code for the given grammar element. | public void | gen(StringLiteralElement atom, Context context) Generate code for the given grammar element. | public void | gen(TokenRangeElement r, Context context) Generate code for the given grammar element. | public void | gen(TokenRefElement atom, Context context) Generate code for the given grammar element. | public void | gen(TreeElement t, Context context) | public void | gen(TreeWalkerGrammar g) | public void | gen(WildcardElement wc, Context context) | public void | gen(ZeroOrMoreBlock blk, Context context) Generate code for the given grammar element. | protected void | genAlt(Alternative alt) | public void | genCommonBlock(AlternativeBlock blk) Generate common code for a block of alternatives; return a postscript
that needs to be generated at the end of the block. | public void | genFollowSetForRuleBlock(RuleBlock blk) Generate a textual representation of the follow set
for a block. | protected void | genGenericBlock(AlternativeBlock blk, String blkOp) | protected void | genHeader() | protected void | genLookaheadSetForAlt(Alternative alt) Generate the lookahead set for an alternate. | public void | genLookaheadSetForBlock(AlternativeBlock blk) Generate a textual representation of the lookahead set
for a block. | public void | genNextToken() Generate the nextToken rule. | public void | genRule(RuleSymbol s) | protected void | genSynPred(SynPredBlock blk) Generate the syntactic predicate. | public void | genTail() | 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 | mapTreeId(String id, ActionTransInfo tInfo) Map an identifier to it's corresponding tree-node variable. | public void | printSet(int depth, int k, Lookahead lookahead) Format a lookahead or follow set. | protected String | processActionForSpecialSymbols(String actionStr, int line, RuleBlock currentRule, ActionTransInfo tInfo) |
doingLexRules | protected boolean doingLexRules(Code) | | true during lexer generation, false during parser generation
|
firstElementInAlt | protected boolean firstElementInAlt(Code) | | |
syntacticPredLevel | protected int syntacticPredLevel(Code) | | non-zero if inside syntactic predicate generation
|
DocBookCodeGenerator | public DocBookCodeGenerator()(Code) | | Create a Diagnostic code-generator using the given Grammar
The caller must still call setTool, setBehavior, and setAnalyzer
before generating code.
|
HTMLEncode | static String HTMLEncode(String s)(Code) | | Encode a string for printing in a HTML document..
e.g. encode '<' '>' and similar stuff
Parameters: s - the string to encode |
QuoteForId | static String QuoteForId(String s)(Code) | | Encode a string for printing in a HTML document..
e.g. encode '<' '>' and similar stuff
Parameters: s - the string to encode |
gen | public void gen(ActionElement action, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The {...} action to generate |
gen | public void gen(AlternativeBlock blk, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The "x|y|z|..." block to generate |
gen | public void gen(BlockEndElement end, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The block-end element to generate. Block-endelements are synthesized by the grammar parser to representthe end of a block. |
gen | public void gen(CharLiteralElement atom, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The character literal reference to generate |
gen | public void gen(CharRangeElement r, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The character-range reference to generate |
gen | public void gen(OneOrMoreBlock blk, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The (...)+ block to generate |
gen | public void gen(RuleRefElement rr, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The rule-reference to generate |
gen | public void gen(StringLiteralElement atom, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The string-literal reference to generate |
gen | public void gen(TokenRangeElement r, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The token-range reference to generate |
gen | public void gen(TokenRefElement atom, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The token-reference to generate |
gen | public void gen(ZeroOrMoreBlock blk, Context context)(Code) | | Generate code for the given grammar element.
Parameters: blk - The (...)* block to generate |
genCommonBlock | public void genCommonBlock(AlternativeBlock blk)(Code) | | 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.
|
genFollowSetForRuleBlock | public void genFollowSetForRuleBlock(RuleBlock blk)(Code) | | Generate a textual representation of the follow set
for a block.
Parameters: blk - The rule block of interest |
genHeader | protected void genHeader()(Code) | | Generate a header that is common to all TXT files
|
genLookaheadSetForAlt | protected void genLookaheadSetForAlt(Alternative alt)(Code) | | Generate the lookahead set for an alternate.
|
genLookaheadSetForBlock | public void genLookaheadSetForBlock(AlternativeBlock blk)(Code) | | Generate a textual representation of the lookahead set
for a block.
Parameters: blk - The block of interest |
genNextToken | public void genNextToken()(Code) | | Generate the nextToken rule.
nextToken is a synthetic lexer rule that is the implicit OR of all
user-defined lexer rules.
|
genRule | public void genRule(RuleSymbol s)(Code) | | Generate code for a named rule block
Parameters: s - The RuleSymbol describing the rule to generate |
genSynPred | protected void genSynPred(SynPredBlock blk)(Code) | | Generate the syntactic predicate. This basically generates
the alternative block, buts tracks if we are inside a synPred
Parameters: blk - The syntactic predicate block |
genTail | public void genTail()(Code) | | |
getASTCreateString | public String getASTCreateString(Vector v)(Code) | | Get a string for an expression to generate creation of an AST subtree.
Parameters: v - A Vector of String, where each element is an expression in the target language yielding an AST node. |
getASTCreateString | public String getASTCreateString(GrammarAtom atom, String str)(Code) | | Get a string for an expression to generate creating of an AST node
Parameters: str - The arguments to the AST constructor |
mapTreeId | public String mapTreeId(String id, ActionTransInfo tInfo)(Code) | | Map an identifier to it's corresponding tree-node variable.
This is context-sensitive, depending on the rule and alternative
being generated
Parameters: id - The identifier name to map Parameters: forInput - true if the input tree node variable is to be returned, otherwise the output variable is returned. |
printSet | public void printSet(int depth, int k, Lookahead lookahead)(Code) | | Format a lookahead or follow set.
Parameters: depth - The depth of the entire lookahead/follow Parameters: k - The lookahead level to print Parameters: lookahead - The lookahead/follow set to print |
Methods inherited from antlr.CodeGenerator | protected void _print(String s)(Code)(Java Doc) protected void _printAction(String s)(Code)(Java Doc) protected void _println(String s)(Code)(Java Doc) public static String decodeLexerRuleName(String id)(Code)(Java Doc) public static boolean elementsAreRange(int[] elems)(Code)(Java Doc) public static String encodeLexerRuleName(String id)(Code)(Java Doc) protected String extractIdOfAction(Token t)(Code)(Java Doc) protected String extractIdOfAction(String s, int line, int column)(Code)(Java Doc) protected String extractTypeOfAction(Token t)(Code)(Java Doc) protected String extractTypeOfAction(String s, int line, int column)(Code)(Java Doc) abstract public void gen()(Code)(Java Doc) abstract public void gen(ActionElement action, Context context)(Code)(Java Doc) abstract public void gen(AlternativeBlock blk, Context context)(Code)(Java Doc) abstract public void gen(BlockEndElement end, Context context)(Code)(Java Doc) abstract public void gen(CharLiteralElement atom, Context context)(Code)(Java Doc) abstract public void gen(CharRangeElement r, Context context)(Code)(Java Doc) abstract public void gen(LexerGrammar g) throws IOException(Code)(Java Doc) abstract public void gen(OneOrMoreBlock blk, Context context)(Code)(Java Doc) abstract public void gen(ParserGrammar g) throws IOException(Code)(Java Doc) abstract public void gen(RuleRefElement rr, Context context)(Code)(Java Doc) abstract public void gen(StringLiteralElement atom, Context context)(Code)(Java Doc) abstract public void gen(TokenRangeElement r, Context context)(Code)(Java Doc) abstract public void gen(TokenRefElement atom, Context context)(Code)(Java Doc) abstract public void gen(TreeElement t, Context context)(Code)(Java Doc) abstract public void gen(TreeWalkerGrammar g) throws IOException(Code)(Java Doc) abstract public void gen(WildcardElement wc, Context context)(Code)(Java Doc) abstract public void gen(ZeroOrMoreBlock blk, Context context)(Code)(Java Doc) protected void genTokenInterchange(TokenManager tm) throws IOException(Code)(Java Doc) abstract public String getASTCreateString(Vector v)(Code)(Java Doc) abstract public String getASTCreateString(GrammarAtom atom, String str)(Code)(Java Doc) protected String getBitsetName(int index)(Code)(Java Doc) public String getFIRSTBitSet(String ruleName, int k)(Code)(Java Doc) public String getFOLLOWBitSet(String ruleName, int k)(Code)(Java Doc) abstract public String mapTreeId(String id, ActionTransInfo tInfo)(Code)(Java Doc) protected int markBitsetForGen(BitSet p)(Code)(Java Doc) protected void print(String s)(Code)(Java Doc) protected void printAction(String s)(Code)(Java Doc) protected void printTabs()(Code)(Java Doc) protected void println(String s)(Code)(Java Doc) abstract protected String processActionForSpecialSymbols(String actionStr, int line, RuleBlock currentRule, ActionTransInfo tInfo)(Code)(Java Doc) public String processStringForASTConstructor(String str)(Code)(Java Doc) protected String removeAssignmentFromDeclaration(String d)(Code)(Java Doc) public static String reverseLexerRuleName(String id)(Code)(Java Doc) public void setAnalyzer(LLkGrammarAnalyzer analyzer_)(Code)(Java Doc) public void setBehavior(DefineGrammarSymbols behavior_)(Code)(Java Doc) protected void setGrammar(Grammar g)(Code)(Java Doc) public void setTool(Tool tool)(Code)(Java Doc)
|
|
|