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 PrintWriter
Where thevisit...()
methods print their text. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Flushes all generated code.void
flush()
Flushes all generated code.static void
Testing of parsing/unparsing.static void
Unparses the givenJava.AbstractCompilationUnit
to the givenWriter
.void
void
void
Generates Java code from aJava.Block
.void
void
Generates Java code from aJava.AbstractClassDeclaration
.void
void
void
void
void
void
unparseStatements
(List<? extends Java.BlockStatement> statements) Generates Java code from a sequence ofJava.BlockStatement
s.void
void
-
Field Details
-
pw
Where thevisit...()
methods print their text. Notice that thisPrintWriter
does 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.AbstractCompilationUnit
to the givenWriter
. -
flush
public void flush()Flushes all generated code. -
close
public void close()Flushes all generated code.- Specified by:
close
in interfaceAutoCloseable
-
unparseAbstractCompilationUnit
- Parameters:
cu
- The compilation unit to unparse
-
unparseImportDeclaration
-
unparseStatements
Generates Java code from a sequence ofJava.BlockStatement
s. -
unparseLambdaParameters
-
unparseLambdaBody
-
unparseBlock
Generates Java code from aJava.Block
. -
unparseBlockStatement
-
unparseTypeDeclaration
-
unparseType
-
unparseAtom
-
unparseRvalue
-
unparseLvalue
-
unparseClassDeclarationBody
Generates Java code from aJava.AbstractClassDeclaration
.
-