| java.lang.Object java.io.Writer gnu.text.PrettyWriter
PrettyWriter | public class PrettyWriter extends java.io.Writer (Code) | | 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.
|
Method Summary | |
public void | addIndentation(int amount, boolean current) | public void | clearBuffer() | public void | close() | int | computeTabSize(int tab, int sectionStart, int column) | void | dumpQueue() | void | dumpQueue(int start, int todo, PrintWriter out) | public void | endLogicalBlock() | public void | endLogicalBlock(String suffix) | public int | enqueue(int kind, int size) | public int | enqueueIndent(int kind, int amount) | public void | enqueueNewline(int kind) | int | enqueueTab(int flags, int colnum, int colinc) | int | ensureSpaceInBuffer(int want) | void | expandTabs(int through) | int | fitsOnLine(int sectionEnd, boolean forceNewlines) Return 1 if true; -1 if false; 0 if don't know. | public void | flush() | public void | forcePrettyOutput() | public int | getColumnNumber() Not meaningful if isPrettyPrinting. | int | getMaxLines() | protected int | getMiserWidth() | int | indexColumn(int index) | boolean | isMisering() | public void | lineAbbreviationHappened() | boolean | maybeOutput(boolean forceNewlines) | void | outputLine(int newline) Output a newline. | void | outputPartialLine() | boolean | printReadably() | void | reallyEndLogicalBlock() | void | reallyStartLogicalBlock(int column, String prefix, String suffix) | public void | setColumnNumber(int column) | public void | setIndentation(int column) | public void | startLogicalBlock(String prefix, boolean perLine, String suffix) | public void | write(int ch) | public void | write(String str) | public void | write(String str, int start, int count) | public void | write(char[] str) | public void | write(char[] str, int start, int count) | final public void | writeBreak(int kind) |
NEWLINE_FILL | final public static int NEWLINE_FILL(Code) | | |
NEWLINE_LINEAR | final public static int NEWLINE_LINEAR(Code) | | |
NEWLINE_LITERAL | final public static int NEWLINE_LITERAL(Code) | | |
NEWLINE_MANDATORY | final public static int NEWLINE_MANDATORY(Code) | | |
NEWLINE_MISER | final public static int NEWLINE_MISER(Code) | | |
QUEUED_OP_BLOCK_END_SIZE | final static int QUEUED_OP_BLOCK_END_SIZE(Code) | | |
QUEUED_OP_BLOCK_END_TYPE | final static int QUEUED_OP_BLOCK_END_TYPE(Code) | | |
QUEUED_OP_BLOCK_PREFIX | final static int QUEUED_OP_BLOCK_PREFIX(Code) | | |
QUEUED_OP_BLOCK_START_BLOCK_END | final static int QUEUED_OP_BLOCK_START_BLOCK_END(Code) | | If the QUEUED_OP_SECTION_START_SECTION_END < 0, it points to
the previous (outer) un-closed block-start.
If QUEUED_OP_SECTION_START_SECTION_END > 0, it points to the
corresponding block-end node.
In both cases the pointers are relative to the current BLOCK_START.
|
QUEUED_OP_BLOCK_START_SIZE | final static int QUEUED_OP_BLOCK_START_SIZE(Code) | | |
QUEUED_OP_BLOCK_START_SUFFIX | final static int QUEUED_OP_BLOCK_START_SUFFIX(Code) | | |
QUEUED_OP_BLOCK_START_TYPE | final static int QUEUED_OP_BLOCK_START_TYPE(Code) | | A "block-start" queue item.
|
QUEUED_OP_DUMMY_TYPE | final static int QUEUED_OP_DUMMY_TYPE(Code) | | A dummy queue item used at the high end of the queue buffer
when there isn't enough space for the needed queue item.
|
QUEUED_OP_INDENTATION_AMOUNT | final static int QUEUED_OP_INDENTATION_AMOUNT(Code) | | |
QUEUED_OP_INDENTATION_BLOCK | final static int QUEUED_OP_INDENTATION_BLOCK(Code) | | |
QUEUED_OP_INDENTATION_CURRENT | final static int QUEUED_OP_INDENTATION_CURRENT(Code) | | |
QUEUED_OP_INDENTATION_KIND | final static int QUEUED_OP_INDENTATION_KIND(Code) | | |
QUEUED_OP_INDENTATION_SIZE | final static int QUEUED_OP_INDENTATION_SIZE(Code) | | |
QUEUED_OP_INDENTATION_TYPE | final static int QUEUED_OP_INDENTATION_TYPE(Code) | | |
QUEUED_OP_NEWLINE_KIND | final static int QUEUED_OP_NEWLINE_KIND(Code) | | |
QUEUED_OP_NEWLINE_SIZE | final static int QUEUED_OP_NEWLINE_SIZE(Code) | | |
QUEUED_OP_NEWLINE_TYPE | final static int QUEUED_OP_NEWLINE_TYPE(Code) | | A newline queue item.
|
QUEUED_OP_POSN | final static int QUEUED_OP_POSN(Code) | | Relative offset of POSN field of a QUEUED_OP>
|
QUEUED_OP_SECTION_START_DEPTH | final static int QUEUED_OP_SECTION_START_DEPTH(Code) | | |
QUEUED_OP_SECTION_START_SECTION_END | final static int QUEUED_OP_SECTION_START_SECTION_END(Code) | | |
QUEUED_OP_SECTION_START_SIZE | final static int QUEUED_OP_SECTION_START_SIZE(Code) | | "Abstract" type for beginning of section.
A section is from a block-start to a newline, from a newline to
the next newline (in the same block?), or from a newline to
the block end (?).
|
QUEUED_OP_SIZE | final static int QUEUED_OP_SIZE(Code) | | Size of "base part" of a QUEUED_OP.
|
QUEUED_OP_TAB_COLINC | final static int QUEUED_OP_TAB_COLINC(Code) | | |
QUEUED_OP_TAB_COLNUM | final static int QUEUED_OP_TAB_COLNUM(Code) | | |
QUEUED_OP_TAB_FLAGS | final static int QUEUED_OP_TAB_FLAGS(Code) | | |
QUEUED_OP_TAB_IS_RELATIVE | final static int QUEUED_OP_TAB_IS_RELATIVE(Code) | | |
QUEUED_OP_TAB_IS_SECTION | final static int QUEUED_OP_TAB_IS_SECTION(Code) | | |
QUEUED_OP_TAB_SIZE | final static int QUEUED_OP_TAB_SIZE(Code) | | |
QUEUED_OP_TAB_TYPE | final static int QUEUED_OP_TAB_TYPE(Code) | | |
QUEUED_OP_TYPE | final static int QUEUED_OP_TYPE(Code) | | |
QUEUE_INIT_ALLOC_SIZE | final static int QUEUE_INIT_ALLOC_SIZE(Code) | | |
blockDepth | int blockDepth(Code) | | |
blocks | int[] blocks(Code) | | Stack of logical blocks in effect at the buffer start.
I.e. blocks for which reallyStartLogicalBlock has been called.
|
buffer | public char[] buffer(Code) | | Holds all the text that has been output but not yet printed.
|
bufferFillPointer | public int bufferFillPointer(Code) | | The index into BUFFER where more text should be put.
|
bufferOffset | int bufferOffset(Code) | | Total amount of stuff that has been shifted out of the buffer.
Whenever we output stuff from the buffer, we shift the remaining noise
over. This makes it difficult to keep references to locations in
the buffer.
|
bufferStartColumn | int bufferStartColumn(Code) | | The column the first character in the buffer will appear in.
Normally zero, but if we end up with a very long line with no breaks in it
we might have to output part of it. Then this will no longer be zero.
|
currentBlock | int currentBlock(Code) | | Index (into queueInts) of current unclosed begin-block node.
|
initialBufferSize | public static int initialBufferSize(Code) | | |
isPrettyPrinting | public boolean isPrettyPrinting(Code) | | |
lineLength | int lineLength(Code) | | Line length we should format to.
|
lineNumber | int lineNumber(Code) | | The line number we are currently on. Used for *print-lines* abrevs and
to tell when sections have been split across multiple lines.
|
miserWidth | int miserWidth(Code) | | |
pendingBlocksCount | public int pendingBlocksCount(Code) | | |
prefix | char[] prefix(Code) | | Buffer holding the per-line prefix active at the buffer start.
Indentation is included in this. The length of this is stored
in the logical block stack.
|
queueInts | int[] queueInts(Code) | | |
queueSize | int queueSize(Code) | | Number of elements (in queueInts and queueStrings) in use.
|
queueStrings | String[] queueStrings(Code) | | For simplicity, queueStrings is the same size as queueInts.
|
suffix | char[] suffix(Code) | | Buffer holding the total remaining suffix active at the buffer start.
The characters are right-justified in the buffer to make it easier
to output the buffer. The length is stored in the logical block stack.
|
addIndentation | public void addIndentation(int amount, boolean current)(Code) | | |
clearBuffer | public void clearBuffer()(Code) | | |
computeTabSize | int computeTabSize(int tab, int sectionStart, int column)(Code) | | |
dumpQueue | void dumpQueue()(Code) | | |
endLogicalBlock | public void endLogicalBlock()(Code) | | |
endLogicalBlock | public void endLogicalBlock(String suffix)(Code) | | |
enqueue | public int enqueue(int kind, int size)(Code) | | |
enqueueIndent | public int enqueueIndent(int kind, int amount)(Code) | | |
enqueueNewline | public void enqueueNewline(int kind)(Code) | | |
enqueueTab | int enqueueTab(int flags, int colnum, int colinc)(Code) | | |
ensureSpaceInBuffer | int ensureSpaceInBuffer(int want)(Code) | | |
expandTabs | void expandTabs(int through)(Code) | | |
fitsOnLine | int fitsOnLine(int sectionEnd, boolean forceNewlines)(Code) | | Return 1 if true; -1 if false; 0 if don't know.
|
flush | public void flush()(Code) | | |
getColumnNumber | public int getColumnNumber()(Code) | | Not meaningful if isPrettyPrinting.
|
getMaxLines | int getMaxLines()(Code) | | |
getMiserWidth | protected int getMiserWidth()(Code) | | |
indexColumn | int indexColumn(int index)(Code) | | |
isMisering | boolean isMisering()(Code) | | |
lineAbbreviationHappened | public void lineAbbreviationHappened()(Code) | | |
maybeOutput | boolean maybeOutput(boolean forceNewlines)(Code) | | |
outputLine | void outputLine(int newline) throws IOException(Code) | | Output a newline.
Parameters: newline - index of a newline queue item |
outputPartialLine | void outputPartialLine()(Code) | | |
printReadably | boolean printReadably()(Code) | | |
reallyEndLogicalBlock | void reallyEndLogicalBlock()(Code) | | |
reallyStartLogicalBlock | void reallyStartLogicalBlock(int column, String prefix, String suffix)(Code) | | |
setColumnNumber | public void setColumnNumber(int column)(Code) | | |
setIndentation | public void setIndentation(int column)(Code) | | |
startLogicalBlock | public void startLogicalBlock(String prefix, boolean perLine, String suffix)(Code) | | |
write | public void write(int ch)(Code) | | |
write | public void write(String str, int start, int count)(Code) | | |
write | public void write(char[] str)(Code) | | |
write | public void write(char[] str, int start, int count)(Code) | | |
writeBreak | final public void writeBreak(int kind)(Code) | | |
|
|