Package org.javacc.parser
Class CodeGenerator
java.lang.Object
org.javacc.parser.CodeGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected int
protected StringBuffer
protected StringBuffer
protected StringBuffer
protected StringBuffer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
genAnnotation
(String ann) Generate annotation.void
genClassStart
(String mod, String name, String[] superClasses, String[] superInterfaces) Generate a class with a given name, an array of superclass and another array of super interfaesvoid
void
genCodeLine
(Object... code) void
generateMethodDefHeader
(String modsAndRetType, String className, String nameAndParams) void
generateMethodDefHeader
(String qualifiedModsAndRetType, String className, String nameAndParams, String exceptions) void
genModifier
(String mod) Generate a modifiervoid
genStringLiteralArrayCPP
(String varName, String[] arr) void
static String
protected String
getClassQualifier
(String className) for testingprotected String
protected String
protected String
protected String
protected boolean
protected void
protected void
printToken
(Token t) protected void
printTokenList
(List<Token> list) protected void
protected void
protected void
void
saveOutput
(String fileName) void
saveOutput
(String fileName, StringBuffer sb) void
void
void
protected void
-
Field Details
-
mainBuffer
-
includeBuffer
-
staticsBuffer
-
outputBuffer
-
cline
protected int cline -
ccol
protected int ccol
-
-
Constructor Details
-
CodeGenerator
public CodeGenerator()
-
-
Method Details
-
genStringLiteralArrayCPP
-
genStringLiteralInCPP
-
genCodeLine
-
genCode
-
saveOutput
-
saveOutput
-
printTokenSetup
-
printTokenList
-
printTokenOnly
-
getStringForTokenOnly
-
printToken
-
getStringToPrint
-
printLeadingComments
-
getLeadingComments
-
printTrailingComments
-
getTrailingComments
-
getGeneratedCode
for testing -
genAnnotation
Generate annotation. @XX syntax for java, comments in C++ -
genModifier
Generate a modifier -
genClassStart
Generate a class with a given name, an array of superclass and another array of super interfaes -
isJavaLanguage
protected boolean isJavaLanguage() -
switchToMainFile
public void switchToMainFile() -
switchToStaticsFile
public void switchToStaticsFile() -
switchToIncludeFile
public void switchToIncludeFile() -
generateMethodDefHeader
-
generateMethodDefHeader
-
getClassQualifier
-
getCharStreamName
-
writeTemplate
protected void writeTemplate(String name, Map<String, Object> options, Object... additionalOptions) throws IOException- Throws:
IOException
-