polyglot.visit
Class StringPrettyPrinter.StringCodeWriter

java.lang.Object
  extended by polyglot.util.CodeWriter
      extended by polyglot.visit.StringPrettyPrinter.StringCodeWriter
Enclosing class:
StringPrettyPrinter

public static class StringPrettyPrinter.StringCodeWriter
extends CodeWriter


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

StringPrettyPrinter.StringCodeWriter

public StringPrettyPrinter.StringCodeWriter(java.io.CharArrayWriter w)
Method Detail

write

public void write(java.lang.String s)
Description copied from class: CodeWriter
Print the string s verbatim on the output stream.

Overrides:
write in class CodeWriter

newline

public void newline(int n)
Description copied from class: CodeWriter
Like newline(), but forces a newline with a specified indentation.

Overrides:
newline in class CodeWriter

allowBreak

public void allowBreak(int n)
Description copied from class: CodeWriter
The most common use of "allowBreak": level 1, with an alternative of a single space.

Overrides:
allowBreak in class CodeWriter
Parameters:
n - the indentation relative to the current block.

allowBreak

public void allowBreak(int n,
                       java.lang.String alt)
Overrides:
allowBreak in class CodeWriter

begin

public void begin(int n)
Description copied from class: CodeWriter
Start a new block with a relative indentation of 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.

Overrides:
begin in class CodeWriter
Parameters:
n - the number of characters increased on indentation (relative to the current position) for all lines in the block. Requires: n >= 0.

toString

public java.lang.String toString()
Description copied from class: CodeWriter
Return a readable representation of all the structured input given to the CodeWriter since the last flush.

Overrides:
toString in class CodeWriter