|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavafe.ast.PrettyPrint
Field Summary | |
private static byte[] |
_spaces
|
static boolean |
displayInferred
Should we display code that is inferred? |
static int |
INDENT
* Variables controling printing: * * |
static PrettyPrint |
inst
The only instance front-end code should use to pretty print information. |
PrettyPrint |
self
When an instance of PrettyPrint wishes to call itself recursively, it does not do so by using this, but rather by using this explicit self instance variable. |
Constructor Summary | |
protected |
PrettyPrint()
Create a normal instance of PrettyPrint that does not have a runtime extension. |
protected |
PrettyPrint(PrettyPrint self)
Create an instance of PrettyPrint that has a runtime extension. |
Method Summary | |
abstract void |
print(java.io.OutputStream o,
CompilationUnit cu)
Print a compilation onto to a stream. |
abstract void |
print(java.io.OutputStream o,
GenericVarDecl d)
|
abstract void |
print(java.io.OutputStream o,
int ind,
ExprVec es)
|
abstract void |
print(java.io.OutputStream o,
int ind,
FieldDecl d,
boolean showBody)
|
abstract void |
print(java.io.OutputStream o,
int ind,
FormalParaDeclVec fps)
|
abstract void |
print(java.io.OutputStream o,
int ind,
LocalVarDecl d,
boolean showBody)
|
abstract void |
print(java.io.OutputStream o,
int ind,
ModifierPragma mp)
Print a member or static initializer of a type declaration. |
abstract void |
print(java.io.OutputStream o,
int ind,
ObjectDesignator od)
|
abstract void |
print(java.io.OutputStream o,
int ind,
Stmt s)
Print a statement. |
abstract void |
print(java.io.OutputStream o,
int ind,
StmtPragma sp)
|
void |
print(java.io.OutputStream o,
int ind,
TypeDecl d)
Print a type declaration onto to a stream. |
abstract void |
print(java.io.OutputStream o,
int ind,
TypeDeclElem d,
Identifier classId,
boolean showBody)
Print a member or static initializer of a type declaration. |
abstract void |
print(java.io.OutputStream o,
int ind,
TypeDeclElemPragma tp)
|
abstract void |
print(java.io.OutputStream o,
int ind,
TypeModifierPragma tp)
|
abstract void |
print(java.io.OutputStream o,
int ind,
VarInit e)
|
abstract void |
print(java.io.OutputStream o,
LexicalPragma lp)
Print a lexical pragma. |
abstract void |
print(java.io.OutputStream o,
Name n)
|
abstract void |
print(java.io.OutputStream o,
Type t)
|
abstract void |
print(java.io.OutputStream o,
TypeNameVec tns)
|
void |
println(java.io.PrintStream out,
Expr e)
Writes an Expr (a type of ASTNode) to the given PrintStream, followed by an end-of-line. |
void |
println(java.io.PrintStream out,
java.lang.Object e)
Writes an Object (a type of ASTNode) to the given PrintStream, followed by an end-of-line. |
void |
println(java.io.PrintStream out,
ObjectDesignator e)
Writes an ObjectDesignator (a type of ASTNode) to the given PrintStream, followed by an end-of-line. |
abstract void |
printnoln(java.io.OutputStream o,
int ind,
TypeDecl d)
Print a type declaration onto to a stream, without a final newline. |
static void |
spaces(java.io.OutputStream o,
int number)
|
static java.lang.String |
toCanonicalString(int tag,
java.lang.Object val)
Returns a canonical text representation for literal values. |
java.lang.String |
toString(ExprVec es)
|
java.lang.String |
toString(FieldDecl d,
boolean showBody)
|
java.lang.String |
toString(FormalParaDeclVec fps)
|
java.lang.String |
toString(GenericVarDecl d)
|
java.lang.String |
toString(int tag)
|
java.lang.String |
toString(LocalVarDecl d,
boolean showBody)
|
java.lang.String |
toString(Name n)
|
java.lang.String |
toString(ObjectDesignator od)
|
java.lang.String |
toString(Type t)
|
java.lang.String |
toString(TypeNameVec tns)
|
java.lang.String |
toString(VarInit e)
|
static void |
write(java.io.OutputStream o,
char c)
|
static void |
write(java.io.OutputStream o,
java.lang.String s)
|
static void |
writeln(java.io.OutputStream o)
|
static void |
writeln(java.io.OutputStream o,
java.lang.String s)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static PrettyPrint inst
Will be some subclass of PrettyPrint; defaults to an instance of StandardPrettyPrint. Extensions should replace with an instance that understands how to pretty print the extensions.
public PrettyPrint self
This allows instances of PrettyPrint to be extended at runtime (rather than by compile-time static subclassing) using the DelegatingPrettyPrint class. See javafe.tc.TypePrint for an example of how this may be done.
public static int INDENT
public static boolean displayInferred
E.g., the inferred "this.", superclass constructor calls, etc.
private static byte[] _spaces
Constructor Detail |
protected PrettyPrint()
protected PrettyPrint(PrettyPrint self)
Self should be an instance of DelegatingPrettyPrint that eventually calls us after some amount of filtering.
Method Detail |
public abstract void print(java.io.OutputStream o, CompilationUnit cu)
o
is
positioned at the start of a new line.
public void print(java.io.OutputStream o, int ind, TypeDecl d)
Ends with a newline.
public abstract void printnoln(java.io.OutputStream o, int ind, TypeDecl d)
public abstract void print(java.io.OutputStream o, int ind, Stmt s)
s
should be printed starting
at the current position of o
. It does not print
a new-line at the end of the statement. However, if the statement needs to
span multiple lines (for example, because it has embedded statements), then
these lines are indented by ind
spaces.
public abstract void print(java.io.OutputStream o, int ind, TypeDeclElem d, Identifier classId, boolean showBody)
s
should be printed starting at the current position of
o
. If the declaration needs to span multiple lines (for
example, to print the statements in the body of a method), then these lines
are indented by ind
spaces. It should leave o
at the start of a new-line.
public abstract void print(java.io.OutputStream o, TypeNameVec tns)
public abstract void print(java.io.OutputStream o, int ind, FormalParaDeclVec fps)
public abstract void print(java.io.OutputStream o, int ind, ExprVec es)
public abstract void print(java.io.OutputStream o, GenericVarDecl d)
public abstract void print(java.io.OutputStream o, int ind, LocalVarDecl d, boolean showBody)
public abstract void print(java.io.OutputStream o, int ind, FieldDecl d, boolean showBody)
public abstract void print(java.io.OutputStream o, Type t)
public abstract void print(java.io.OutputStream o, Name n)
public abstract void print(java.io.OutputStream o, int ind, ObjectDesignator od)
public abstract void print(java.io.OutputStream o, int ind, VarInit e)
public abstract void print(java.io.OutputStream o, LexicalPragma lp)
o
is at the start of the
line; should leave o
at the start of a new line.
public abstract void print(java.io.OutputStream o, int ind, TypeDeclElemPragma tp)
public abstract void print(java.io.OutputStream o, int ind, ModifierPragma mp)
s
should be printed starting at the current position of
o
. If the declaration needs to span multiple lines (for
example, to print the statements in the body of a method), then these lines
are indented by ind
spaces. It should leave o
at the start of a new-line.
public abstract void print(java.io.OutputStream o, int ind, StmtPragma sp)
public abstract void print(java.io.OutputStream o, int ind, TypeModifierPragma tp)
public void println(java.io.PrintStream out, java.lang.Object e)
out
- The PrintStream to write toe
- The expression to writepublic void println(java.io.PrintStream out, Expr e)
out
- The PrintStream to write toe
- The expression to writepublic void println(java.io.PrintStream out, ObjectDesignator e)
out
- The PrintStream to write toe
- The expression to writepublic static java.lang.String toCanonicalString(int tag, java.lang.Object val)
tag
is one of constants on the left of this table:
TagConstants.BOOLEANLIT Boolean
TagConstants.CHARLIT Integer
TagConstants.DOUBLELIT Double
TagConstants.FLOATLIT Float
TagConstants.INTLIT Integer
TagConstants.LONGLIT Long
TagConstants.STRINGLIT String
and that val
is an instance of the corresponding type on the
right.
public java.lang.String toString(int tag)
public final java.lang.String toString(TypeNameVec tns)
public final java.lang.String toString(FormalParaDeclVec fps)
public final java.lang.String toString(ExprVec es)
public final java.lang.String toString(GenericVarDecl d)
public final java.lang.String toString(LocalVarDecl d, boolean showBody)
public final java.lang.String toString(FieldDecl d, boolean showBody)
public final java.lang.String toString(Type t)
public final java.lang.String toString(Name n)
public final java.lang.String toString(VarInit e)
public final java.lang.String toString(ObjectDesignator od)
public static void writeln(java.io.OutputStream o)
public static void writeln(java.io.OutputStream o, java.lang.String s)
public static void write(java.io.OutputStream o, char c)
public static void write(java.io.OutputStream o, java.lang.String s)
public static void spaces(java.io.OutputStream o, int number)
|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |