Package eu.bandm.tools.format
Class Format.FormatPrinter
java.lang.Object
eu.bandm.tools.format.Format.FormatPrinter
- Enclosing class:
- Format
Central Visitor for formatted printing. Is constructed with a
PrintWriter and a maximal page width. Then
startPrinting(Format)
is
called to execute formatted printing.-
Field Summary
FieldsModifier and TypeFieldDescriptionComment lead-in, currently starting every printed line.(package private) int
Indentation for the currently printed comment lead-in: Field is only valid whenafterLf
!=null.(package private) Format.Context
Curent context of all variable bindings.(package private) int
The currently valid priority value for parenthesis visibility.(package private) int
The currently valid priority alterantive index for parenthesis visibility.Memory of the start columns of all urrently open Compound formats.(package private) final int
The limiting line width.(package private) boolean
Whether unbound variables may unalteredly survive resolution.(package private) int
The column number for the next output.(package private) final char
(package private) final PrintWriter
The target of all printing output.(package private) boolean
Whether we are at the start of a line and initial space must be delayed. -
Constructor Summary
ConstructorsConstructorDescriptionFormatPrinter
(PrintWriter p, int width) Sets the print target and the page width. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
advance
(int cnt) Output spacs and increment the column counter by the given number.(package private) boolean
Whether the next-to-write column is the very first of the innermost currently open Compound.(package private) void
Internal aux method: drop the top-most memorized start column.int
getPos()
Public getter method for the current (=next-to-write) column.(package private) void
gotocol
(int col) Output spacs to go to the given colum number.(package private) void
newline
(int indent) Output a newline and advance to the given indentation.(package private) void
Output a newline and advance to the indentation of the given Format.(package private) void
Internal aux method: push the current column number as start position of the Compond format.(package private) void
Internal aux method: output the text and advance the column number.(package private) void
Print the comment line prefix on the current line and memorize its contents and starting position for all subsequent lines, untilunsetCommentPrefix()
.void
Central service access point, prints the complete format to teh output.(package private) void
-
Field Details
-
SPACE
final char SPACE- See Also:
-
stream
The target of all printing output. -
linewidth
final int linewidthThe limiting line width. (Attention: Due to the heurstic nature of the algorithm, this is not a hard limit in every situation.) -
currentprior
int currentpriorThe currently valid priority value for parenthesis visibility. -
currentprioralternative
int currentprioralternativeThe currently valid priority alterantive index for parenthesis visibility. -
pos
int posThe column number for the next output. -
formatstarts
Memory of the start columns of all urrently open Compound formats. -
suppressSpaces
boolean suppressSpacesWhether we are at the start of a line and initial space must be delayed. -
afterLf
Comment lead-in, currently starting every printed line. (This field only exists once, so currently comemnts cannot be nested.) -
commentIndent
int commentIndentIndentation for the currently printed comment lead-in: Field is only valid whenafterLf
!=null. -
context
Format.Context contextCurent context of all variable bindings. -
partialEval
boolean partialEvalWhether unbound variables may unalteredly survive resolution.
-
-
Constructor Details
-
FormatPrinter
Sets the print target and the page width.
-
-
Method Details
-
getPos
public int getPos()Public getter method for the current (=next-to-write) column. -
atStartOfCompound
boolean atStartOfCompound()Whether the next-to-write column is the very first of the innermost currently open Compound. -
startPrinting
Central service access point, prints the complete format to teh output. -
printText
Internal aux method: output the text and advance the column number. -
newline
Output a newline and advance to the indentation of the given Format. -
newline
void newline(int indent) Output a newline and advance to the given indentation. -
advance
protected void advance(int cnt) Output spacs and increment the column counter by the given number. -
gotocol
void gotocol(int col) Output spacs to go to the given colum number. If the argument is smaller than the current position, then do nothing. -
openformat
void openformat()Internal aux method: push the current column number as start position of the Compond format. -
closeformat
void closeformat()Internal aux method: drop the top-most memorized start column. -
setCommentPrefix
Print the comment line prefix on the current line and memorize its contents and starting position for all subsequent lines, untilunsetCommentPrefix()
. -
unsetCommentPrefix
void unsetCommentPrefix()
-