Class Parser

java.lang.Object
ca.mcscert.jpipe.compiler.model.Transformation<org.antlr.v4.runtime.CommonTokenStream, org.antlr.v4.runtime.tree.ParseTree>
ca.mcscert.jpipe.compiler.steps.transformations.Parser

public final class Parser extends Transformation<org.antlr.v4.runtime.CommonTokenStream, org.antlr.v4.runtime.tree.ParseTree>
Delegate to ANTLR the transformation of a token stream into a parse tree.

Parsing errors are reported as non-fatal diagnostics via the CompilationContext, allowing the pipeline to accumulate both lexing and parsing errors before deciding to abort.

  • Constructor Details

    • Parser

      public Parser()
  • Method Details

    • run

      protected org.antlr.v4.runtime.tree.ParseTree run(org.antlr.v4.runtime.CommonTokenStream tokens, CompilationContext ctx)
      Description copied from class: Transformation
      Business logic of this step. Must not return null; may throw any exception. Use ctx to report non-fatal diagnostics or inspect previously accumulated errors.
      Specified by:
      run in class Transformation<org.antlr.v4.runtime.CommonTokenStream, org.antlr.v4.runtime.tree.ParseTree>
      Parameters:
      tokens - the value produced by the previous step.
      ctx - compilation context carrying the source path and diagnostic bag.
      Returns:
      the transformed value — never null.