Klasse LookaheadParser

java.lang.Object
edu.hm.hafner.analysis.IssueParser
edu.hm.hafner.analysis.LookaheadParser
Alle implementierten Schnittstellen:
Serializable
Bekannte direkte Unterklassen:
AbstractMavenLogParser, AcuCobolParser, AnsibleLintParser, Armcc5CompilerParser, ArmccCompilerParser, BluePearlParser, BuckminsterParser, CadenceIncisiveParser, CargoClippyParser, ClangParser, ClangTidyParser, CMakeParser, CodeAnalysisParser, CodeCheckerParser, CodeGeneratorParser, CoolfluxChessccParser, CppLintParser, CrossCoreEmbeddedStudioParser, DiabCParser, DrMemoryParser, EclipseMavenParser, EclipseParser, ErlcParser, ErrorProneParser, FlawfinderParser, FlexSdkParser, FoodcriticParser, Gcc4CompilerParser, Gcc4LinkerParser, GccParser, GhsMultiParser, GnatParser, GnuFortranParser, GoLintParser, GoVetParser, GradleErrorProneParser, IarCstatParser, IarParser, IntelParser, InvalidsParser, MentorParser, MetrowerksCwCompilerParser, MetrowerksCwLinkerParser, MsBuildParser, NagFortranParser, OELintAdvParser, P4Parser, Pep8Parser, PerlCriticParser, PhpParser, PreFastParser, ProtoLintParser, PuppetLintParser, PyLintParser, QacSourceCodeAnalyserParser, RobocopyParser, RuboCopParser, SbtScalacParser, ScalacParser, SphinxBuildLinkCheckParser, SphinxBuildParser, SunCParser, TaskingVxCompilerParser, TiCcsParser, TnsdlParser, XlcCompilerParser, XlcLinkerParser, YuiCompressorParser

public abstract class LookaheadParser extends IssueParser
Parses a report file line by line for issues using a pre-defined regular expression. If the regular expression matches then the abstract method createIssue(Matcher, LookaheadStream, IssueBuilder) will be called. Sub classes need to provide an implementation that transforms the Matcher instance into a new issue. If required, sub classes may consume additional lines from the report file before control is handed back to the template method of this parser.
Autor:
Ullrich Hafner
Siehe auch:
  • Felddetails

    • ANT_TASK

      protected static final String ANT_TASK
      Pattern identifying an ant task debug output prefix.
      Siehe auch:
  • Konstruktordetails

    • LookaheadParser

      protected LookaheadParser(String pattern)
      Creates a new instance of LookaheadParser.
      Parameter:
      pattern - pattern of compiler warnings.
  • Methodendetails

    • parse

      public Report parse(ReaderFactory readerFactory) throws ParsingException, ParsingCanceledException
      Beschreibung aus Klasse kopiert: IssueParser
      Parses the specified file for issues.
      Angegeben von:
      parse in Klasse IssueParser
      Parameter:
      readerFactory - provides a reader to the reports
      Gibt zurück:
      the issues
      Löst aus:
      ParsingException - Signals that during parsing a non-recoverable error has been occurred
      ParsingCanceledException - Signals that the parsing has been aborted by the user
    • preprocessLine

      protected void preprocessLine(String line)
      Preprocesses the specified line. This method is called before the line is checked for a match. Subclasses may override this empty default implementation.
      Parameter:
      line - the line to preprocess
    • createIssue

      protected abstract Optional<Issue> createIssue(Matcher matcher, edu.hm.hafner.util.LookaheadStream lookahead, IssueBuilder builder) throws ParsingException
      Creates a new issue for the specified pattern. This method is called for each matching line in the specified file. If a match is a false positive, then return Optional.empty() to ignore this warning.
      Parameter:
      matcher - the regular expression matcher
      lookahead - the lookahead stream to read additional lines
      builder - the issue builder to use
      Gibt zurück:
      a new annotation for the specified pattern
      Löst aus:
      ParsingException - Signals that during parsing a non recoverable error has been occurred
    • isLineInteresting

      protected boolean isLineInteresting(String line)
      Returns whether the specified line is interesting. Each interesting line will be matched by the defined regular expression. Here a parser can implement some fast checks (i.e. string or character comparisons) in order to see if a required condition is met. This default implementation does always return true.
      Parameter:
      line - the line to inspect
      Gibt zurück:
      true if the line should be handed over to the regular expression scanner, false if the line does not contain a warning.
    • postProcess

      protected Report postProcess(Report report)
      Post processes the issues. This default implementation does nothing.
      Parameter:
      report - the issues after the parsing process
      Gibt zurück:
      the post processed issues