Public Member Functions | Protected Member Functions | Protected Attributes

antlr.DiagnosticCodeGenerator Class Reference

Inheritance diagram for antlr.DiagnosticCodeGenerator:
antlr.CodeGenerator

List of all members.

Public Member Functions

 DiagnosticCodeGenerator ()
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 genCommonBlock (AlternativeBlock blk)
void genFollowSetForRuleBlock (RuleBlock blk)
void genLookaheadSetForBlock (AlternativeBlock blk)
void genNextToken ()
void genRule (RuleSymbol s)
String getASTCreateString (Vector v)
String getASTCreateString (GrammarAtom atom, String str)
String mapTreeId (String id, ActionTransInfo tInfo)
void printSet (int depth, int k, Lookahead lookahead)

Protected Member Functions

void genAlt (Alternative alt)
void genBlockPreamble (AlternativeBlock blk)
void genHeader ()
void genLookaheadSetForAlt (Alternative alt)
void genSynPred (SynPredBlock blk)
void genTokenTypes (TokenManager tm) throws IOException
String processActionForSpecialSymbols (String actionStr, int line, RuleBlock currentRule, ActionTransInfo tInfo)
 unused.

Protected Attributes

int syntacticPredLevel = 0
boolean doingLexRules = false

Detailed Description

Generate MyParser.txt, MyLexer.txt and MyParserTokenTypes.txt


Constructor & Destructor Documentation

antlr.DiagnosticCodeGenerator.DiagnosticCodeGenerator (  ) 

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.


Member Function Documentation

void antlr.DiagnosticCodeGenerator.gen ( ActionElement  action  )  [virtual]

Generate code for the given grammar element.

Parameters:
blk The {...} action to generate

Implements antlr.CodeGenerator.

References antlr.CodeGenerator._printAction(), antlr.ActionElement.actionText, antlr.ActionElement.isSemPred, and antlr.CodeGenerator.print().

void antlr.DiagnosticCodeGenerator.gen ( BlockEndElement  end  )  [virtual]

Generate code for the given grammar element.

Parameters:
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.DiagnosticCodeGenerator.gen ( OneOrMoreBlock  blk  )  [virtual]
void antlr.DiagnosticCodeGenerator.gen ( WildcardElement  wc  )  [virtual]
void antlr.DiagnosticCodeGenerator.gen ( ZeroOrMoreBlock  blk  )  [virtual]
void antlr.DiagnosticCodeGenerator.gen ( CharLiteralElement  atom  )  [virtual]

Generate code for the given grammar element.

Parameters:
blk The character literal reference to generate

Implements antlr.CodeGenerator.

References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.GrammarAtom.atomText, antlr.GrammarAtom.label, antlr.GrammarAtom.not, and antlr.CodeGenerator.print().

void antlr.DiagnosticCodeGenerator.gen ( StringLiteralElement  atom  )  [virtual]

Generate code for the given grammar element.

Parameters:
blk The string-literal reference to generate

Implements antlr.CodeGenerator.

References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.GrammarAtom.atomText, antlr.GrammarAtom.label, and antlr.CodeGenerator.print().

void antlr.DiagnosticCodeGenerator.gen ( AlternativeBlock  blk  )  [virtual]
void antlr.DiagnosticCodeGenerator.gen ( CharRangeElement  r  )  [virtual]

Generate code for the given grammar element.

Parameters:
blk The character-range reference to generate

Implements antlr.CodeGenerator.

References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.CharRangeElement.beginText, antlr.CharRangeElement.endText, antlr.CharRangeElement.label, and antlr.CodeGenerator.print().

void antlr.DiagnosticCodeGenerator.gen ( TokenRangeElement  r  )  [virtual]

Generate code for the given grammar element.

Parameters:
blk The token-range reference to generate

Implements antlr.CodeGenerator.

References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.TokenRangeElement.beginText, antlr.TokenRangeElement.endText, antlr.TokenRangeElement.label, and antlr.CodeGenerator.print().

void antlr.DiagnosticCodeGenerator.gen ( TokenRefElement  atom  )  [virtual]

Generate code for the given grammar element.

Parameters:
blk The token-reference to generate

Implements antlr.CodeGenerator.

References antlr.CodeGenerator._print(), antlr.CodeGenerator._println(), antlr.GrammarAtom.atomText, antlr.GrammarAtom.label, antlr.GrammarAtom.not, and antlr.CodeGenerator.print().

void antlr.DiagnosticCodeGenerator.gen ( TreeElement  t  )  [virtual]

Generate code for the given grammar element.

Parameters:
blk The tree to generate code for.

Implements antlr.CodeGenerator.

References antlr.CodeGenerator.print().

void antlr.DiagnosticCodeGenerator.genBlockPreamble ( AlternativeBlock  blk  )  [protected]

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.

References antlr.AlternativeBlock.initAction, and antlr.CodeGenerator.printAction().

Referenced by antlr.DiagnosticCodeGenerator.gen(), and antlr.DiagnosticCodeGenerator.genRule().

void antlr.DiagnosticCodeGenerator.genFollowSetForRuleBlock ( RuleBlock  blk  ) 

Generate a textual representation of the follow set for a block.

Parameters:
blk The rule block of interest

References antlr.RuleBlock.endNode, antlr.LLkGrammarAnalyzer.FOLLOW(), antlr.CodeGenerator.grammar, antlr.Grammar.maxk, antlr.DiagnosticCodeGenerator.printSet(), and antlr.Grammar.theLLkAnalyzer.

Referenced by antlr.DiagnosticCodeGenerator.genRule().

void antlr.DiagnosticCodeGenerator.genNextToken (  ) 
void antlr.DiagnosticCodeGenerator.genSynPred ( SynPredBlock  blk  )  [protected]

Generate the syntactic predicate. This basically generates the alternative block, buts tracks if we are inside a synPred

Parameters:
blk The syntactic predicate block

References antlr.DiagnosticCodeGenerator.gen(), and antlr.DiagnosticCodeGenerator.syntacticPredLevel.

Referenced by antlr.DiagnosticCodeGenerator.genCommonBlock().

String antlr.DiagnosticCodeGenerator.getASTCreateString ( Vector  v  )  [virtual]

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.

Implements antlr.CodeGenerator.

String antlr.DiagnosticCodeGenerator.getASTCreateString ( GrammarAtom  atom,
String  str 
) [virtual]

Get a string for an expression to generate creating of an AST node

Parameters:
str The arguments to the AST constructor

Implements antlr.CodeGenerator.

String antlr.DiagnosticCodeGenerator.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

Parameters:
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.

String antlr.DiagnosticCodeGenerator.processActionForSpecialSymbols ( String  actionStr,
int  line,
RuleBlock  currentRule,
ActionTransInfo  tInfo 
) [protected, virtual]

unused.

Implements antlr.CodeGenerator.


Member Data Documentation

non-zero if inside syntactic predicate generation

Referenced by antlr.DiagnosticCodeGenerator.gen(), and antlr.DiagnosticCodeGenerator.genSynPred().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties