Class PdeParseTreeListener.PrintWriterWithEditGen

java.lang.Object
processing.mode.java.preproc.PdeParseTreeListener.PrintWriterWithEditGen
Enclosing class:
PdeParseTreeListener

public static class PdeParseTreeListener.PrintWriterWithEditGen extends Object
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 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

      public void addCodeLine(String newCode)
      Add code with a newline automatically appended.
      Parameters:
      newCode - The code to add.
    • addCode

      public void addCode(String newCode)
      Add code without a new line.
      Parameters:
      newCode - The code to add.
    • finish

      public void finish()
      Finalize edits made through this decorator.