Class ParseResult

java.lang.Object
org.kigalisim.lang.parse.ParseResult

public class ParseResult extends Object
Result of parsing a QubecTalk source code file.

Structure representing the result of parsing a QubecTalk source code file, which may contain either a successfully parsed program or a list of errors encountered during parsing.

  • Constructor Details

    • ParseResult

      public ParseResult(org.kigalisim.lang.QubecTalkParser.ProgramContext program)
      Constructs a ParseResult with the specified program and no errors.
      Parameters:
      program - the parsed program.
    • ParseResult

      public ParseResult(List<ParseError> errors)
      Constructs a ParseResult with the specified errors and no program.
      Parameters:
      errors - the errors encountered which must not be empty.
      Throws:
      IllegalArgumentException - if errors is empty.
  • Method Details

    • getProgram

      public Optional<org.kigalisim.lang.QubecTalkParser.ProgramContext> getProgram()
      Get the parsed program.
      Returns:
      An Optional containing the parsed program if available.
    • getErrors

      public List<ParseError> getErrors()
      Get the list of parsing errors.
      Returns:
      A list of ParseError encountered during parsing.
    • hasErrors

      public boolean hasErrors()
      Determine if there were errors during parsing.
      Returns:
      true if there are errors, false otherwise.