Package org.javacc.parser
Class CodeGenerator
java.lang.Object
org.javacc.parser.CodeGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected StringBufferprotected StringBufferprotected StringBufferprotected StringBuffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenAnnotation(String ann) Generate annotation.voidgenClassStart(String mod, String name, String[] superClasses, String[] superInterfaces) Generate a class with a given name, an array of superclass and another array of super interfaesvoidvoidgenCodeLine(Object... code) voidgenerateMethodDefHeader(String modsAndRetType, String className, String nameAndParams) voidgenerateMethodDefHeader(String qualifiedModsAndRetType, String className, String nameAndParams, String exceptions) voidgenModifier(String mod) Generate a modifiervoidgenStringLiteralArrayCPP(String varName, String[] arr) voidstatic Stringprotected StringgetClassQualifier(String className) for testingprotected Stringprotected Stringprotected Stringprotected Stringprotected booleanprotected voidprotected voidprintToken(Token t) protected voidprintTokenList(List<Token> list) protected voidprotected voidprotected voidvoidsaveOutput(String fileName) voidsaveOutput(String fileName, StringBuffer sb) voidvoidvoidprotected 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
-