Package processing.mode.java.preproc
Class PdeParseTreeListener.PrintWriterWithEditGen
java.lang.Object
processing.mode.java.preproc.PdeParseTreeListener.PrintWriterWithEditGen
- Enclosing class:
- PdeParseTreeListener
Decorator around a {TokenStreamRewriter}.
Decorator around a {TokenStreamRewriter} which converts input commands into something that the rewriter can understand but also generates edits saved to an input RewriteResultBuilder. Requires a call to finish() after completion of preprocessing.
-
Constructor Summary
ConstructorsConstructorDescriptionPrintWriterWithEditGen(org.antlr.v4.runtime.TokenStreamRewriter writer, RewriteResultBuilder newRewriteResultBuilder, int newInsertPoint, boolean newBefore) Create a new edit generator decorator. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd code without a new line.voidaddCodeLine(String newCode) Add code with a newline automatically appended.voidAdd an empty line into the code.voidfinish()Finalize edits made through this decorator.
-
Constructor Details
-
PrintWriterWithEditGen
public PrintWriterWithEditGen(org.antlr.v4.runtime.TokenStreamRewriter writer, RewriteResultBuilder newRewriteResultBuilder, int newInsertPoint, boolean newBefore) Create a new edit generator decorator.- Parameters:
writer- The writer to which edits should be immediately made.newRewriteResultBuilder- The builder to which edits should be saved.newInsertPoint- The point at which new values should be inserted.newBefore- If true, the values will be inserted before the given insert point. If false, will, insert after the insertion point.
-
-
Method Details
-
addEmptyLine
public void addEmptyLine()Add an empty line into the code. -
addCodeLine
Add code with a newline automatically appended.- Parameters:
newCode- The code to add.
-
addCode
Add code without a new line.- Parameters:
newCode- The code to add.
-
finish
public void finish()Finalize edits made through this decorator.
-