ua.gradsoft.termware.printers
Class PrettyPrintWriter
java.lang.Object
ua.gradsoft.termware.printers.PrettyPrintWriter
public class PrettyPrintWriter
- extends Object
Writer for pretty printing.
In addition to print functions, user also can
mark beginning and ending of language constructs,
whitespaces and possible linebreaks.
So, unlike PrintWriter, which understand only one type
of token: strings, PrettyPrintWriter understand
(inside implemented pretty printing algorithm from
\@article{DBLP:journals/toplas/Oppen80,
author = {Derek C. Oppen},
title = {Prettyprinting},
journal = {ACM Trans. Program. Lang. Syst.},
volume = {2},
number = {4},
year = {1980},
pages = {465-483},
ee = {http://doi.acm.org/10.1145/357114.357115},
bibsource = {DBLP, http://dblp.uni-trier.de}
}
)
main changes from article are:
- We try gracefull handle any sequence of input tokens
- BreakType can be associated with begin/end brackets (TODO: descript)
- Author:
- rssh
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_LINE_WIDTH
public static final int DEFAULT_LINE_WIDTH
- See Also:
- Constant Field Values
PrettyPrintWriter
public PrettyPrintWriter(PrintWriter printWriter)
putString
public void putString(String value)
putBegin
public void putBegin(PrettyPrintingBreakType breakType)
putBegin
public void putBegin(PrettyPrintingBreakType breakType,
int size,
int offset)
putEnd
public void putEnd(PrettyPrintingBreakType breakType)
putEnd
public void putEnd(PrettyPrintingBreakType breakType,
int size,
int offset)
putConsistentBreak
public void putConsistentBreak(int size)
putInconsistentBreak
public void putInconsistentBreak(int size)
putLineBreak
public void putLineBreak()
putBreak
public void putBreak(PrettyPrintingBreakType breakType,
int size,
int offset)
putEof
public void putEof()
flush
public void flush()
getLineWidth
public int getLineWidth()
setLineWidth
public void setLineWidth(int lineWidth)