public class PrettyPrinter extends Object
Constructor and Description |
---|
PrettyPrinter(net.sourceforge.czt.base.ast.Term term,
int initW) |
Modifier and Type | Method and Description |
---|---|
boolean |
allowsNlAfter(Token o) |
boolean |
allowsNlBefore(Token o) |
protected boolean |
considerAddingNL(Token previous,
Token current,
int spaceLeft,
int length,
boolean startedProcessing) |
protected boolean |
considerAddingNLForToken(Token previous,
Token current,
int spaceLeft,
int length,
boolean startedProcessing) |
int |
getOffSet() |
net.sourceforge.czt.base.ast.Term |
getTerm() |
protected int |
handleSpaces(ListIterator<Token> iter,
Token previous,
Token current,
int spaceLeft,
int length,
boolean startedProcessing,
int indentAmount) |
int |
handleTokenSequence(TokenSequence tseq,
int startPos) |
int |
handleTokenSequence(TokenSequence tseq,
int space,
int indentAmount) |
protected boolean |
isSpecialCase(Token previous,
Token current)
Check tokens to see whether space handling is to be treated as special case or not.
|
protected boolean |
isSpecialTokenCase(Token previous,
Token current)
Check tokens to see whether space handling is to be treated as a special case or not.
|
void |
setLineWidth(int width) |
void |
setOffset(int offset) |
public PrettyPrinter(net.sourceforge.czt.base.ast.Term term, int initW)
public net.sourceforge.czt.base.ast.Term getTerm()
public void setOffset(int offset)
public int getOffSet()
public void setLineWidth(int width)
public int handleTokenSequence(TokenSequence tseq, int startPos) throws PrintException
PrintException
public int handleTokenSequence(TokenSequence tseq, int space, int indentAmount) throws PrintException
PrintException
protected boolean isSpecialCase(Token previous, Token current) throws PrintException
previous
- current
- PrintException
protected boolean isSpecialTokenCase(Token previous, Token current) throws PrintException
previous
- current
- PrintException
- is either previous or current is a token sequence.protected boolean considerAddingNL(Token previous, Token current, int spaceLeft, int length, boolean startedProcessing) throws PrintException
PrintException
protected boolean considerAddingNLForToken(Token previous, Token current, int spaceLeft, int length, boolean startedProcessing) throws PrintException
PrintException
protected int handleSpaces(ListIterator<Token> iter, Token previous, Token current, int spaceLeft, int length, boolean startedProcessing, int indentAmount) throws PrintException
PrintException
public boolean allowsNlBefore(Token o)
public boolean allowsNlAfter(Token o)
Copyright © 2003–2016 Community Z Tools Project. All rights reserved.