static class CodePrinter.CompactCodePrinter extends CodePrinter.MappedCodePrinter
Modifier and Type | Field and Description |
---|---|
private boolean |
lineBreak |
private int |
lineStartPosition |
private boolean |
preferLineBreakAtEndOfFile |
private int |
preferredBreakPosition |
private int |
prevCutPosition |
private int |
prevLineStartPosition |
code, lineIndex, lineLength, lineLengthThreshold
sawFunction, statementNeedsEnded, statementStarted
Modifier | Constructor and Description |
---|---|
private |
CompactCodePrinter(boolean lineBreak,
boolean preferLineBreakAtEndOfFile,
int lineLengthThreshold,
boolean createSrcMap,
SourceMap.DetailLevel sourceMapDetailLevel) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
append(java.lang.String str)
Appends a string to the code, keeping track of the current line length.
|
(package private) void |
endFile()
Called when we're at the end of a file.
|
(package private) void |
maybeCutLine()
This may start a new line if the current line is longer than the line
length threshold.
|
(package private) void |
maybeLineBreak() |
(package private) void |
notePreferredLineBreak() |
(package private) void |
startNewLine()
Adds a newline to the code, resetting the line length.
|
endSourceMapping, generateSourceMap, getCode, getCurrentCharIndex, getCurrentLineIndex, getLastChar, reportLineCut, startSourceMapping
add, addConstant, addIdentifier, addNumber, addOp, appendBlockEnd, appendBlockStart, appendOp, beginBlock, beginCaseBody, breakAfterBlockFor, continueProcessing, endBlock, endBlock, endCaseBody, endClass, endFunction, endLine, endStatement, endStatement, isNegativeZero, isWordChar, listSeparator, maybeEndStatement, maybeInsertSpace, shouldPreserveExtraBlocks
private final boolean lineBreak
private final boolean preferLineBreakAtEndOfFile
private int lineStartPosition
private int preferredBreakPosition
private int prevCutPosition
private int prevLineStartPosition
private CompactCodePrinter(boolean lineBreak, boolean preferLineBreakAtEndOfFile, int lineLengthThreshold, boolean createSrcMap, SourceMap.DetailLevel sourceMapDetailLevel)
lineBreak
- break the lines a bit more aggressivelylineLengthThreshold
- The length of a line after which we force
a newline when possible.createSrcMap
- Whether to gather source position
mapping information when printing.sourceMapDetailLevel
- A filter to control which nodes get mapped into
the source map.void append(java.lang.String str)
append
in class CodeConsumer
void startNewLine()
startNewLine
in class CodeConsumer
void maybeLineBreak()
maybeLineBreak
in class CodeConsumer
void maybeCutLine()
maybeCutLine
in class CodeConsumer
void notePreferredLineBreak()
notePreferredLineBreak
in class CodeConsumer
void endFile()
CodeConsumer
endFile
in class CodeConsumer