Package org.codehaus.janino
Class Unparser
java.lang.Object
org.codehaus.janino.Unparser
- All Implemented Interfaces:
AutoCloseable
Unparses (un-compiles) an AST to a
Writer. See main(String[]) for a usage example.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PrintWriterWhere thevisit...()methods print their text. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Flushes all generated code.voidflush()Flushes all generated code.static voidTesting of parsing/unparsing.static voidUnparses the givenJava.AbstractCompilationUnitto the givenWriter.voidvoidvoidGenerates Java code from aJava.Block.voidvoidGenerates Java code from aJava.AbstractClassDeclaration.voidvoidvoidvoidvoidvoidunparseStatements(List<? extends Java.BlockStatement> statements) Generates Java code from a sequence ofJava.BlockStatements.voidvoid
-
Field Details
-
pw
Where thevisit...()methods print their text. Notice that thisPrintWriterdoes not print to the output directly, but through anAutoIndentWriter.
-
-
Constructor Details
-
Unparser
-
-
Method Details
-
main
Testing of parsing/unparsing.Reads compilation units from the files named on the command line and unparses them to
System.out.- Throws:
Exception
-
unparse
Unparses the givenJava.AbstractCompilationUnitto the givenWriter. -
flush
public void flush()Flushes all generated code. -
close
public void close()Flushes all generated code.- Specified by:
closein interfaceAutoCloseable
-
unparseAbstractCompilationUnit
- Parameters:
cu- The compilation unit to unparse
-
unparseImportDeclaration
-
unparseStatements
Generates Java code from a sequence ofJava.BlockStatements. -
unparseLambdaParameters
-
unparseLambdaBody
-
unparseBlock
Generates Java code from aJava.Block. -
unparseBlockStatement
-
unparseTypeDeclaration
-
unparseType
-
unparseAtom
-
unparseRvalue
-
unparseLvalue
-
unparseClassDeclarationBody
Generates Java code from aJava.AbstractClassDeclaration.
-