Package | Description |
---|---|
org.stekikun.dolmen.codegen |
Modifier and Type | Method and Description |
---|---|
CodeBuilder |
CodeBuilder.closeBlock()
Closes a curly-braced block with decremented
indentation, i.e. is equivalent to:
decrIndent();
newline();
emit("}");
newline();
|
CodeBuilder |
CodeBuilder.closeBlock0()
Closes a curly-braced block with decremented
indentation and without breaking the line after
the closing brace, i.e. is equivalent to:
decrIndent();
newline();
emit("}");
It is useful when closing several blocks in a row
to avoid empty lines.
|
CodeBuilder |
CodeBuilder.decrIndent()
Decrements the indentation level by 1
(and the indentation amount by
PER_LEVEL |
CodeBuilder |
CodeBuilder.emit(char c)
Appends the given character, which should not
be a newline characters unless indentation
is not required
|
CodeBuilder |
CodeBuilder.emit(CharSequence code)
Appends the given characters, which should not
contain newline characters unless indentation
of the given piece of code is not required
|
CodeBuilder |
CodeBuilder.emitIf(boolean cond,
String code)
Appends the given code, which should not
contain newline characters, provided the condition
cond holds |
CodeBuilder |
CodeBuilder.emitln(String line)
Appends the given line of code and emits a terminal
newline() |
CodeBuilder |
CodeBuilder.emitlnIf(boolean cond,
String line)
Appends the given line of code and emits a terminal
newline() , provided the condition
cond holds |
CodeBuilder |
CodeBuilder.emitTracked(CExtent extent)
Convenient helper which emits the content of some
verbatim piece of code described by the given extent,
and maps it to the extent's original position.
|
CodeBuilder |
CodeBuilder.emitTrackedIf(boolean cond,
CExtent extent)
Same as
emitTracked(CExtent) but is only
performed if the given condition holds. |
CodeBuilder |
CodeBuilder.endTrackedRange(@Nullable CExtent extent)
Closes the currently tracked region and maps it to
the source position given in the corresponding call
to
startTrackedRange(LexBuffer.Position) . |
CodeBuilder |
CodeBuilder.incrIndent()
Increments the indentation level by 1
(and the indentation amount by
PER_LEVEL ) |
CodeBuilder |
CodeBuilder.newline()
Starts a new line with the current indentation amount
|
CodeBuilder |
CodeBuilder.openBlock()
Opens a new curly-braced block with incremented
indentation, i.e. is equivalent to:
emit(" {");
incrIndent();
newline();
|
CodeBuilder |
CodeBuilder.startTrackedRange(LexBuffer.Position pos)
Starts tracking a new region from the current position
in the emitted code.
|
Constructor and Description |
---|
TokensOutput(String className,
Config config,
List<TokenDecl> tokenDecls,
CodeBuilder buf) |