Class PdeIssueEmitter.IssueLocationFactory

java.lang.Object
processing.mode.java.preproc.PdeIssueEmitter.IssueLocationFactory
Enclosing class:
PdeIssueEmitter

public static class PdeIssueEmitter.IssueLocationFactory extends Object
Utility that can help clean up where in source an issue should be reported.

For some errors, the location of the "mistake" does not appear close to where the actual error is generated. For example, consider omitting a semicolon. Though the "mistake" is arguably on the line on which a semicolon is forgotten, the grammatical error appears in the first non-skip token after the omitted character. This means that the issue shown to the user may be far away from the line they would want to edit. This utility helps determine if an issue requires a new location and, if so, where the location should be.

  • Constructor Details

    • IssueLocationFactory

      public IssueLocationFactory()
  • Method Details

    • getLineWithOffset

      public static PdeIssueEmitter.IssueLocation getLineWithOffset(PdeIssueEmitter.IssueMessageSimplification simplification, int originalLine, int originalOffset, String source)
      Determine where an issue should be reported.
      Parameters:
      simplification - The issue simplification generated from {PreprocessIssueMessageSimplifier}.
      originalLine - The original line (1 indexed) on which the issue was reported.
      originalOffset - The original number of characters from the start of the line where the the issue was reported.
      source - The full concatenated source of the sketch being built.
      lineCount - The total
      Returns:
      The new location where the issue should be reported. This may be identical to the original location if the issue was not moved.