Generate P.html, a cross-linked representation of P with or without actions
antlr.HTMLCodeGenerator.HTMLCodeGenerator | ( | ) |
Create a Diagnostic code-generator using the given Grammar The caller must still call setTool, setBehavior, and setAnalyzer before generating code.
References antlr.CodeGenerator.charFormatter.
void antlr.HTMLCodeGenerator.gen | ( | ) | [virtual] |
Generate the code for all grammars
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.antlrTool, antlr.CodeGenerator.behavior, antlr.Tool.fatalError(), antlr.Grammar.generate(), antlr.DefineGrammarSymbols.grammars, antlr.Tool.hasError, antlr.Tool.reportException(), and antlr.Grammar.setCodeGenerator().
void antlr.HTMLCodeGenerator.gen | ( | AlternativeBlock | blk | ) | [virtual] |
Generate code for the given grammar element.
blk | The "x|y|z|..." block to generate |
Implements antlr.CodeGenerator.
References antlr.HTMLCodeGenerator.genGenericBlock().
void antlr.HTMLCodeGenerator.gen | ( | LexerGrammar | g | ) | throws IOException [virtual] |
Generate the lexer HTML file
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._println(), antlr.CodeGenerator.antlrTool, antlr.Grammar.comment, antlr.CodeGenerator.currentOutput, antlr.HTMLCodeGenerator.doingLexRules, antlr.collections.impl.Vector.elements(), antlr.HTMLCodeGenerator.genHeader(), antlr.HTMLCodeGenerator.genNextToken(), antlr.HTMLCodeGenerator.genRule(), antlr.Grammar.getClassName(), antlr.Grammar.getSuperClass(), antlr.CodeGenerator.grammar, antlr.HTMLCodeGenerator.HTMLEncode(), antlr.GrammarSymbol.id, antlr.Tool.openOutputFile(), antlr.CodeGenerator.println(), antlr.Tool.reportProgress(), antlr.Grammar.rules, antlr.CodeGenerator.setGrammar(), and antlr.CodeGenerator.tabs.
void antlr.HTMLCodeGenerator.gen | ( | TreeWalkerGrammar | g | ) | throws IOException [virtual] |
Generate the tree-walker TXT file
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._println(), antlr.CodeGenerator.antlrTool, antlr.Grammar.comment, antlr.CodeGenerator.currentOutput, antlr.collections.impl.Vector.elements(), antlr.HTMLCodeGenerator.genHeader(), antlr.HTMLCodeGenerator.genRule(), antlr.Grammar.getClassName(), antlr.Grammar.getSuperClass(), antlr.CodeGenerator.grammar, antlr.HTMLCodeGenerator.HTMLEncode(), antlr.Tool.openOutputFile(), antlr.CodeGenerator.println(), antlr.Tool.reportProgress(), antlr.Grammar.rules, antlr.CodeGenerator.setGrammar(), and antlr.CodeGenerator.tabs.
void antlr.HTMLCodeGenerator.gen | ( | WildcardElement | wc | ) | [virtual] |
Generate a wildcard element
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._print().
void antlr.HTMLCodeGenerator.gen | ( | OneOrMoreBlock | blk | ) | [virtual] |
Generate code for the given grammar element.
blk | The (...)+ block to generate |
Implements antlr.CodeGenerator.
References antlr.HTMLCodeGenerator.genGenericBlock().
void antlr.HTMLCodeGenerator.gen | ( | ZeroOrMoreBlock | blk | ) | [virtual] |
Generate code for the given grammar element.
blk | The (...)* block to generate |
Implements antlr.CodeGenerator.
References antlr.HTMLCodeGenerator.genGenericBlock().
void antlr.HTMLCodeGenerator.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.
void antlr.HTMLCodeGenerator.gen | ( | ParserGrammar | g | ) | throws IOException [virtual] |
Generate the parser HTML file
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._println(), antlr.CodeGenerator.antlrTool, antlr.Grammar.comment, antlr.CodeGenerator.currentOutput, antlr.collections.impl.Vector.elements(), antlr.HTMLCodeGenerator.genHeader(), antlr.HTMLCodeGenerator.genRule(), antlr.HTMLCodeGenerator.genTail(), antlr.Grammar.getClassName(), antlr.Grammar.getSuperClass(), antlr.CodeGenerator.grammar, antlr.HTMLCodeGenerator.HTMLEncode(), antlr.Tool.openOutputFile(), antlr.CodeGenerator.println(), antlr.Tool.reportProgress(), antlr.Grammar.rules, antlr.CodeGenerator.setGrammar(), and antlr.CodeGenerator.tabs.
void antlr.HTMLCodeGenerator.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.Grammar.getClassName(), antlr.Grammar.getSymbol(), antlr.CodeGenerator.grammar, and antlr.RuleRefElement.targetRule.
void antlr.HTMLCodeGenerator.gen | ( | ActionElement | action | ) | [virtual] |
Generate code for the given grammar element.
blk | The {...} action to generate |
Implements antlr.CodeGenerator.
void antlr.HTMLCodeGenerator.gen | ( | CharLiteralElement | atom | ) | [virtual] |
Generate code for the given grammar element.
blk | The character literal reference to generate |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._print(), antlr.GrammarAtom.atomText, antlr.HTMLCodeGenerator.HTMLEncode(), and antlr.GrammarAtom.not.
void antlr.HTMLCodeGenerator.gen | ( | StringLiteralElement | atom | ) | [virtual] |
Generate code for the given grammar element.
blk | The string-literal reference to generate |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._print(), antlr.GrammarAtom.atomText, antlr.HTMLCodeGenerator.HTMLEncode(), and antlr.GrammarAtom.not.
void antlr.HTMLCodeGenerator.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, and antlr.CodeGenerator.print().
void antlr.HTMLCodeGenerator.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, and antlr.CodeGenerator.print().
void antlr.HTMLCodeGenerator.gen | ( | TokenRefElement | atom | ) | [virtual] |
Generate code for the given grammar element.
blk | The token-reference to generate |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator._print(), antlr.GrammarAtom.atomText, and antlr.GrammarAtom.not.
void antlr.HTMLCodeGenerator.gen | ( | TreeElement | t | ) | [virtual] |
Generate code for the given grammar element.
blk | The tree to generate code for. |
Implements antlr.CodeGenerator.
References antlr.CodeGenerator.print().
void antlr.HTMLCodeGenerator.genAlt | ( | Alternative | alt | ) | [protected] |
References antlr.CodeGenerator._print(), antlr.HTMLCodeGenerator.firstElementInAlt, antlr.GrammarElement.generate(), antlr.Token.getText(), antlr.Alternative.getTreeSpecifier(), antlr.Alternative.head, antlr.AlternativeElement.next, and antlr.HTMLCodeGenerator.prevAltElem.
Referenced by antlr.HTMLCodeGenerator.genCommonBlock().
void antlr.HTMLCodeGenerator.genCommonBlock | ( | AlternativeBlock | blk | ) |
Generate the header for a block, which may be a RuleBlock or a plain AlternativeBLock. This generates any variable declarations, init-actions, and syntactic-predicate-testing variables. The block for which the preamble is to be generated.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.
References antlr.CodeGenerator._println(), antlr.AlternativeBlock.alternatives, antlr.HTMLCodeGenerator.firstElementInAlt, antlr.HTMLCodeGenerator.genAlt(), antlr.AlternativeBlock.getAlternativeAt(), antlr.Alternative.head, antlr.CodeGenerator.print(), antlr.collections.impl.Vector.size(), and antlr.CodeGenerator.tabs.
Referenced by antlr.HTMLCodeGenerator.genGenericBlock(), antlr.HTMLCodeGenerator.genNextToken(), and antlr.HTMLCodeGenerator.genRule().
void antlr.HTMLCodeGenerator.genFollowSetForRuleBlock | ( | RuleBlock | blk | ) |
Generate a textual representation of the follow set for a block.
blk | The rule block of interest |
References antlr.RuleBlock.endNode, antlr.LLkGrammarAnalyzer.FOLLOW(), antlr.CodeGenerator.grammar, antlr.Grammar.maxk, antlr.HTMLCodeGenerator.printSet(), and antlr.Grammar.theLLkAnalyzer.
void antlr.HTMLCodeGenerator.genGenericBlock | ( | AlternativeBlock | blk, | |
String | blkOp | |||
) | [protected] |
References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.AlternativeBlock.alternatives, antlr.HTMLCodeGenerator.firstElementInAlt, antlr.HTMLCodeGenerator.genCommonBlock(), antlr.AlternativeElement.next, antlr.HTMLCodeGenerator.prevAltElem, antlr.CodeGenerator.print(), and antlr.collections.impl.Vector.size().
Referenced by antlr.HTMLCodeGenerator.gen(), and antlr.HTMLCodeGenerator.genSynPred().
void antlr.HTMLCodeGenerator.genHeader | ( | ) | [protected] |
Generate a header that is common to all TXT files
References antlr.CodeGenerator.antlrTool, antlr.Grammar.getClassName(), antlr.CodeGenerator.grammar, antlr.Tool.grammarFile, antlr.CodeGenerator.println(), and antlr.Tool.version.
Referenced by antlr.HTMLCodeGenerator.gen(), and antlr.HTMLCodeGenerator.genTokenTypes().
void antlr.HTMLCodeGenerator.genLookaheadSetForAlt | ( | Alternative | alt | ) | [protected] |
Generate the lookahead set for an alternate.
References antlr.Alternative.cache, antlr.Lookahead.containsEpsilon(), antlr.HTMLCodeGenerator.doingLexRules, antlr.CodeGenerator.grammar, antlr.Alternative.lookaheadDepth, antlr.Grammar.maxk, antlr.CodeGenerator.println(), and antlr.HTMLCodeGenerator.printSet().
void antlr.HTMLCodeGenerator.genLookaheadSetForBlock | ( | AlternativeBlock | blk | ) |
Generate a textual representation of the lookahead set for a block.
blk | The block of interest |
References antlr.AlternativeBlock.alternatives, antlr.AlternativeBlock.getAlternativeAt(), antlr.CodeGenerator.grammar, antlr.LLkGrammarAnalyzer.look(), antlr.Alternative.lookaheadDepth, antlr.Grammar.maxk, antlr.HTMLCodeGenerator.printSet(), antlr.collections.impl.Vector.size(), and antlr.Grammar.theLLkAnalyzer.
void antlr.HTMLCodeGenerator.genNextToken | ( | ) |
Generate the nextToken rule. nextToken is a synthetic lexer rule that is the implicit OR of all user-defined lexer rules.
References antlr.RuleSymbol.access, antlr.Grammar.define(), antlr.HTMLCodeGenerator.genCommonBlock(), antlr.CodeGenerator.grammar, antlr.CodeGenerator.println(), antlr.Grammar.rules, antlr.RuleSymbol.setBlock(), and antlr.RuleSymbol.setDefined().
Referenced by antlr.HTMLCodeGenerator.gen().
void antlr.HTMLCodeGenerator.genRule | ( | RuleSymbol | s | ) |
Generate code for a named rule block
s | The RuleSymbol describing the rule to generate |
References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.RuleSymbol.access, antlr.RuleSymbol.comment, antlr.HTMLCodeGenerator.genCommonBlock(), antlr.RuleSymbol.getBlock(), antlr.GrammarSymbol.getId(), antlr.HTMLCodeGenerator.HTMLEncode(), antlr.RuleSymbol.isDefined(), antlr.CodeGenerator.print(), antlr.CodeGenerator.println(), and antlr.CodeGenerator.tabs.
Referenced by antlr.HTMLCodeGenerator.gen().
void antlr.HTMLCodeGenerator.genSynPred | ( | SynPredBlock | blk | ) | [protected] |
Generate the syntactic predicate. This basically generates the alternative block, buts tracks if we are inside a synPred
blk | The syntactic predicate block |
References antlr.HTMLCodeGenerator.genGenericBlock(), and antlr.HTMLCodeGenerator.syntacticPredLevel.
void antlr.HTMLCodeGenerator.genTail | ( | ) |
References antlr.CodeGenerator.println().
Referenced by antlr.HTMLCodeGenerator.gen().
void antlr.HTMLCodeGenerator.genTokenTypes | ( | TokenManager | tm | ) | throws IOException [protected] |
Generate the token types TXT file
References antlr.CodeGenerator.antlrTool, antlr.CodeGenerator.currentOutput, antlr.collections.impl.Vector.elementAt(), antlr.HTMLCodeGenerator.genHeader(), antlr.Tool.openOutputFile(), antlr.CodeGenerator.println(), antlr.Tool.reportProgress(), antlr.collections.impl.Vector.size(), antlr.CodeGenerator.tabs, antlr.CodeGenerator.TokenTypesFileExt, and antlr.CodeGenerator.TokenTypesFileSuffix.
String antlr.HTMLCodeGenerator.getASTCreateString | ( | GrammarAtom | atom, | |
String | str | |||
) | [virtual] |
Get a string for an expression to generate creating of an AST node
str | The arguments to the AST constructor |
Implements antlr.CodeGenerator.
String antlr.HTMLCodeGenerator.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.
static String antlr.HTMLCodeGenerator.HTMLEncode | ( | String | s | ) | [static, package] |
Encode a string for printing in a HTML document.. e.g. encode '<' '>' and similar stuff
s | the string to encode |
Referenced by antlr.HTMLCodeGenerator.gen(), and antlr.HTMLCodeGenerator.genRule().
String antlr.HTMLCodeGenerator.mapTreeId | ( | String | id, | |
ActionTransInfo | tInfo | |||
) | [virtual] |
Map an identifier to it's corresponding tree-node variable. This is context-sensitive, depending on the rule and alternative being generated
id | The identifier name to map | |
forInput | true if the input tree node variable is to be returned, otherwise the output variable is returned. |
Implements antlr.CodeGenerator.
void antlr.HTMLCodeGenerator.printSet | ( | int | depth, | |
int | k, | |||
Lookahead | lookahead | |||
) |
Format a lookahead or follow set.
depth | The depth of the entire lookahead/follow | |
k | The lookahead level to print | |
lookahead | The lookahead/follow set to print |
References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.CodeGenerator.charFormatter, antlr.HTMLCodeGenerator.doingLexRules, antlr.collections.impl.Vector.elementAt(), antlr.Lookahead.fset, antlr.TokenManager.getVocabulary(), antlr.CodeGenerator.grammar, antlr.CharFormatter.literalChar(), antlr.CodeGenerator.print(), antlr.CodeGenerator.tabs, antlr.collections.impl.BitSet.toArray(), and antlr.Grammar.tokenManager.
Referenced by antlr.HTMLCodeGenerator.genFollowSetForRuleBlock(), antlr.HTMLCodeGenerator.genLookaheadSetForAlt(), and antlr.HTMLCodeGenerator.genLookaheadSetForBlock().
String antlr.HTMLCodeGenerator.processActionForSpecialSymbols | ( | String | actionStr, | |
int | line, | |||
RuleBlock | currentRule, | |||
ActionTransInfo | tInfo | |||
) | [protected, virtual] |
unused.
Implements antlr.CodeGenerator.
boolean antlr.HTMLCodeGenerator.doingLexRules = false [protected] |
true during lexer generation, false during parser generation
Referenced by antlr.HTMLCodeGenerator.gen(), antlr.HTMLCodeGenerator.genLookaheadSetForAlt(), and antlr.HTMLCodeGenerator.printSet().
boolean antlr.HTMLCodeGenerator.firstElementInAlt [protected] |
AlternativeElement antlr.HTMLCodeGenerator.prevAltElem = null [protected] |
Referenced by antlr.HTMLCodeGenerator.genAlt(), and antlr.HTMLCodeGenerator.genGenericBlock().
int antlr.HTMLCodeGenerator.syntacticPredLevel = 0 [protected] |
non-zero if inside syntactic predicate generation
Referenced by antlr.HTMLCodeGenerator.genSynPred().