Logo Search packages:      
Sourcecode: antlr version File versions

antlr::CppCodeGenerator Class Reference

Inheritance diagram for antlr::CppCodeGenerator:


List of all members.

Detailed Description

Generate MyParser.cpp, MyParser.hpp, MyLexer.cpp, MyLexer.hpp and MyParserTokenTypes.hpp

Definition at line 23 of file CppCodeGenerator.java.

Public Member Functions

 CppCodeGenerator ()
void exitIfError ()
void gen (ZeroOrMoreBlock blk)
void gen (WildcardElement wc)
void gen (TreeWalkerGrammar g) throws IOException
void gen (TreeElement t)
void gen (TokenRefElement atom)
void gen (TokenRangeElement r)
void gen (StringLiteralElement atom)
void gen (RuleRefElement rr)
void gen (ParserGrammar g) throws IOException
void gen (OneOrMoreBlock blk)
void gen (LexerGrammar g) throws IOException
void gen (CharRangeElement r)
void gen (CharLiteralElement atom)
void gen (BlockEndElement end)
void gen (AlternativeBlock blk)
void gen (ActionElement action)
void gen ()
void genBody (TreeWalkerGrammar g) throws IOException
void genBody (ParserGrammar g) throws IOException
void genBody (LexerGrammar g) throws IOException
CppBlockFinishingInfo genCommonBlock (AlternativeBlock blk, boolean noTestForSingle)
void genInclude (TreeWalkerGrammar g) throws IOException
void genInclude (ParserGrammar g) throws IOException
void genInclude (LexerGrammar g) throws IOException
void genInitFactory (Grammar g)
void genLineNo (Token t)
void genLineNo (GrammarElement el)
void genLineNo (int line)
void genLineNo2 ()
void genNextToken ()
void genRule (RuleSymbol s, boolean startSymbol, int ruleNum, String prefix)
void genRuleHeader (RuleSymbol s, boolean startSymbol)
void genTokenStrings (String prefix)
String getASTCreateString (String str)
String getASTCreateString (GrammarAtom atom, String str)
String getASTCreateString (Vector v)
String getFIRSTBitSet (String ruleName, int k)
String getFOLLOWBitSet (String ruleName, int k)
String getRangeExpression (int k, int[] elems)
String mapTreeId (String idParam, ActionTransInfo transInfo)
void printAction (Token t)
void printHeaderAction (String name)
String processStringForASTConstructor (String str)
void setAnalyzer (LLkGrammarAnalyzer analyzer_)
void setBehavior (DefineGrammarSymbols behavior_)
void setTool (Tool tool)

Static Public Member Functions

static String decodeLexerRuleName (String id)
static boolean elementsAreRange (int[] elems)
static String encodeLexerRuleName (String id)
static String reverseLexerRuleName (String id)

Static Public Attributes

static final int caseSizeThreshold = 127
static String TokenTypesFileExt = ".txt"
static String TokenTypesFileSuffix = "TokenTypes"

Protected Member Functions

void _print (String s)
void _printAction (String s)
void _println (String s)
int addSemPred (String predicate)
int countLines (String s)
String extractIdOfAction (String s, int line, int column)
String extractIdOfAction (Token t)
String extractTypeOfAction (String s, int line, int column)
String extractTypeOfAction (Token t)
void genAlt (Alternative alt, AlternativeBlock blk)
void genASTDeclaration (AlternativeElement el, String var_name, String node_type)
 Generate (if not already done) a declaration for the AST for el.
void genASTDeclaration (AlternativeElement el, String node_type)
 for convenience
void genASTDeclaration (AlternativeElement el)
 for convenience
void genBitsets (Vector bitsetList, int maxVocabulary, String prefix)
void genBitsetsHeader (Vector bitsetList, int maxVocabulary)
void genBlockInitAction (AlternativeBlock blk)
void genBlockPreamble (AlternativeBlock blk)
void genCases (BitSet p)
void genHeader (String fileName)
void genMatch (GrammarAtom atom)
void genMatch (BitSet b)
void genMatchUsingAtomText (GrammarAtom atom)
void genMatchUsingAtomTokenType (GrammarAtom atom)
void genSemPred (String pred, int line)
void genSemPredMap (String prefix)
void genSynPred (SynPredBlock blk, String lookaheadExpr)
void genTokenInterchange (TokenManager tm) throws IOException
void genTokenTypes (TokenManager tm) throws IOException
String getBitsetName (int index)
String getLookaheadTestExpression (Alternative alt, int maxDepth)
String getLookaheadTestExpression (Lookahead[] look, int k)
String getLookaheadTestTerm (int k, BitSet p)
boolean lookaheadIsEmpty (Alternative alt, int maxDepth)
int markBitsetForGen (BitSet p)
void print (String s)
void printAction (String s)
void println (String s)
void printTabs ()
String processActionForSpecialSymbols (String actionStr, int line, RuleBlock currentRule, ActionTransInfo tInfo)
String removeAssignmentFromDeclaration (String d)
void setGrammar (Grammar g)

Protected Attributes

LLkGrammarAnalyzer analyzer
antlr.Tool antlrTool
DefineGrammarSymbols behavior
Vector bitsetsUsed
CharFormatter charFormatter
transient PrintWriter currentOutput
boolean DEBUG_CODE_GENERATOR = false
boolean genAST = false
boolean genHashLines = true
Grammar grammar = null
boolean noConstructors = false
String outputFile
int outputLine
boolean saveText = false
int syntacticPredLevel = 0
int tabs = 0

Static Protected Attributes

static final String NONUNIQUE = new String()

Package Attributes

int astVarNumber = 1
String commonExtraArgs
String commonExtraParams
String commonLocalVars
String currentASTResult
RuleBlock currentRule
HashSet declaredASTVariables = new HashSet()
String exceptionThrown
String labeledElementASTInit
String labeledElementASTType
String labeledElementInit
String labeledElementType
String lt1Value
String throwNoViable
Hashtable treeVariableMap = new Hashtable()
boolean usingCustomAST = false

Private Member Functions

String fixNameSpaceOption (String ns)
void genBlockFinish (CppBlockFinishingInfo howToFinish, String noViableAction)
void genElementAST (AlternativeElement el)
void genErrorCatchForElement (AlternativeElement el)
void genErrorHandler (ExceptionSpec ex)
void genErrorTryForElement (AlternativeElement el)
void genLiteralsTest ()
void genLiteralsTestForPartialToken ()
void GenRuleInvocation (RuleRefElement rr)
String getValueString (int value)
String lookaheadString (int k)
String mangleLiteral (String s)
void mapTreeVariable (AlternativeElement e, String name)
void setupGrammarParameters (Grammar g)
String textOrChar (String text)

Static Private Member Functions

static boolean suitableForCaseExpression (Alternative a)

Private Attributes

Vector astTypes
Vector semPreds

Static Private Attributes

static NameSpace nameSpace = null
static String namespaceAntlr = "ANTLR_USE_NAMESPACE(antlr)"
static String namespaceStd = "ANTLR_USE_NAMESPACE(std)"
static final String postIncludeCpp = "post_include_cpp"
static final String postIncludeHpp = "post_include_hpp"
static final String preIncludeCpp = "pre_include_cpp"
static final String preIncludeHpp = "pre_include_hpp"

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index