|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object polyglot.util.CodeWriter polyglot.visit.StringPrettyPrinter.StringCodeWriter
public static class StringPrettyPrinter.StringCodeWriter
Field Summary |
---|
Fields inherited from class polyglot.util.CodeWriter |
---|
debug, precompute |
Constructor Summary | |
---|---|
StringPrettyPrinter.StringCodeWriter(java.io.CharArrayWriter w)
|
Method Summary | |
---|---|
void |
allowBreak(int n)
The most common use of "allowBreak": level 1, with an alternative of a single space. |
void |
allowBreak(int n,
java.lang.String alt)
|
void |
begin(int n)
Start a new block with a relative indentation of n
characters. |
void |
newline(int n)
Like newline(), but forces a newline with a specified indentation. |
java.lang.String |
toString()
Return a readable representation of all the structured input given to the CodeWriter since the last flush. |
void |
write(java.lang.String s)
Print the string s verbatim on the output stream. |
Methods inherited from class polyglot.util.CodeWriter |
---|
allowBreak, end, flush, flush, newline, unifiedBreak, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StringPrettyPrinter.StringCodeWriter(java.io.CharArrayWriter w)
Method Detail |
---|
public void write(java.lang.String s)
CodeWriter
s
verbatim on the output stream.
write
in class CodeWriter
public void newline(int n)
CodeWriter
newline
in class CodeWriter
public void allowBreak(int n)
CodeWriter
allowBreak
in class CodeWriter
n
- the indentation relative to the current block.public void allowBreak(int n, java.lang.String alt)
allowBreak
in class CodeWriter
public void begin(int n)
CodeWriter
n
characters.
A block is a formatting unit. The formatting algorithm will try to put the whole block in one line unless
If either of the two conditions is satisfied, the formatting algorithm
will break the block into lines by generating newlines for some of the
inserted breaks. The first line is printed at the current cursor
position pos
, all the following lines are printed at the
position pos+n
.
begin
in class CodeWriter
n
- the number of characters increased on indentation (relative
to the current position) for all lines in the block.
Requires: n >= 0.public java.lang.String toString()
CodeWriter
toString
in class CodeWriter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |