public interface IEmitter
Modifier and Type | Method and Description |
---|---|
void |
indentPop()
Pops an indent from the emitter so after newlines are emitted, the output
is correctly formatted.
|
void |
indentPush()
Pushes an indent into the emitter so after newlines are emitted, the
output is correctly formatted.
|
String |
stringifyNode(IASNode node)
Takes the node argument and created a String representation if it using
the buffer temporarily.
|
void |
write(IEmitterTokens value)
Writes a string to the writer.
|
void |
write(String value) |
void |
writeNewline()
Writes newline character(s)
|
void |
writeNewline(IEmitterTokens value)
Writes the
value and then a newline which will automatically
have the indent applied after the \n character. |
void |
writeNewline(IEmitterTokens value,
boolean pushIndent)
Writes the
value after a push or pop of the indent. |
void |
writeNewline(String value) |
void |
writeNewline(String value,
boolean pushIndent) |
void |
writeToken(IEmitterTokens value)
Writes a
ASEmitterTokens character to the buffer and appends a
space after automatically. |
void |
writeToken(String value) |
void indentPush()
void indentPop()
void write(IEmitterTokens value)
value
- The string to write to the output buffer.void write(String value)
void writeNewline()
void writeNewline(IEmitterTokens value)
value
and then a newline which will automatically
have the indent applied after the \n character.value
- The String value to write before the \n is appended.void writeNewline(String value)
void writeNewline(IEmitterTokens value, boolean pushIndent)
value
after a push or pop of the indent.
This method effectively lets you write a value and then indent our
outdent. The method can be useful in the following where your cursor
writer is at [0]
, you write
writeNewline("if (foo) {", true);
and the cursor after the
call will end up at [1]
.
[0]if (foo) { [1]this.something; }
value
- The String value to write before the \n is appended.pushIndent
- Whether to push indent true
or pop indent
false
.void writeNewline(String value, boolean pushIndent)
void writeToken(IEmitterTokens value)
ASEmitterTokens
character to the buffer and appends a
space after automatically.value
- The ASEmitterTokens
value.void writeToken(String value)
String stringifyNode(IASNode node)
Note; This method is still beta, it need more logic if an emitter is actually using the buffer!
node
- The node walk and create a String for.Copyright © 2016 The Apache Software Foundation. All rights reserved.