Class PdeIssueEmitter

java.lang.Object
org.antlr.v4.runtime.BaseErrorListener
processing.mode.java.preproc.PdeIssueEmitter
All Implemented Interfaces:
org.antlr.v4.runtime.ANTLRErrorListener

public class PdeIssueEmitter extends org.antlr.v4.runtime.BaseErrorListener
ANTLR error listener to inform a preprocess issue listener when syntax errors are encountered.

A {BaseErrorListener} which looks for syntax errors reported by ANTLR and converts them to {PdePreprocessIssue}s that are consumable by a {PdePreprocessIssueListener}. It does this by running the {PreprocessIssueMessageSimplifier} to generate a more user-friendly error message before informing the provided listener.

  • Constructor Details

    • PdeIssueEmitter

      public PdeIssueEmitter(PdeIssueEmitter.PdePreprocessIssueListener newListener)
      Create a new issue emitter.

      Create a new issue emitter when access to the processing sketch source is not available. Note that this will not allow some error beautification and, if sketch source is available, use other constructor.

      Parameters:
      newListener - The listener to inform when encountering a syntax error.
    • PdeIssueEmitter

      public PdeIssueEmitter(PdeIssueEmitter.PdePreprocessIssueListener newListener, PdeIssueEmitter.SourceEmitter newSourceEmitter)
      Create a new issue emitter.
      Parameters:
      newListener - The listener to inform when encountering a syntax error.
      newSourceEmitter - The sketch source to use when helping beautify certain syntax error messages.
  • Method Details

    • syntaxError

      public void syntaxError(org.antlr.v4.runtime.Recognizer<?,?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, org.antlr.v4.runtime.RecognitionException e)
      Specified by:
      syntaxError in interface org.antlr.v4.runtime.ANTLRErrorListener
      Overrides:
      syntaxError in class org.antlr.v4.runtime.BaseErrorListener