A pretty printer.
This code is transcribed from pprint.lisp in Steel Bank Common Lisp,
which is again based on the code in CMU Common Lisp.
NEWLINE_FILL
public static final int NEWLINE_FILL
NEWLINE_LINEAR
public static final int NEWLINE_LINEAR
NEWLINE_LITERAL
public static final int NEWLINE_LITERAL
NEWLINE_MANDATORY
public static final int NEWLINE_MANDATORY
NEWLINE_MISER
public static final int NEWLINE_MISER
NEWLINE_SPACE
public static final int NEWLINE_SPACE
A non-nested ' ' gets an implicit NEWLINE_SPACE.
This is treated similarly to NEWLINE_FILL, but not quite.
buffer
public char[] buffer
Holds all the text that has been output but not yet printed.
bufferFillPointer
public int bufferFillPointer
The index into BUFFER where more text should be put.
initialBufferSize
public static int initialBufferSize
isPrettyPrinting
public boolean isPrettyPrinting
pendingBlocksCount
public int pendingBlocksCount
Number of startLogicalBlock - number of endLogicalBlock.
addIndentation
public void addIndentation(int amount,
boolean current)
clearBuffer
public void clearBuffer()
close
public void close()
throws IOException
endLogicalBlock
public void endLogicalBlock()
endLogicalBlock
public void endLogicalBlock(String suffix)
enqueue
public int enqueue(int kind,
int size)
enqueueIndent
public int enqueueIndent(char kind,
int amount)
enqueueNewline
public void enqueueNewline(int kind)
forcePrettyOutput
public void forcePrettyOutput()
throws IOException
getColumnNumber
public int getColumnNumber()
Not meaningful if isPrettyPrinting.
getMiserWidth
protected int getMiserWidth()
lineAbbreviationHappened
public void lineAbbreviationHappened()
setColumnNumber
public void setColumnNumber(int column)
setIndentation
public void setIndentation(int column)
startLogicalBlock
public void startLogicalBlock(String prefix,
boolean perLine,
String suffix)
write
public void write(String str)
write
public void write(String str,
int start,
int count)
write
public void write(char[] str)
write
public void write(char[] str,
int start,
int count)
write
public void write(int ch)
writeBreak
public final void writeBreak(int kind)