Class AbstractParserErrorMessageProviderAbstract

Hierarchy (view full)

Implements

  • IParserErrorMessageProvider

Constructors

Methods

  • An Early Exit Error happens when the parser cannot detect the first mandatory iteration of a repetition. It corresponds to a failed BaseParser.AT_LEAST_ONE_SEP or BaseParser.AT_LEAST_ONE_SEP in Chevrotain DSL terms.

    Parameters

    • options: {
          actual: IToken[];
          customUserDescription: string;
          expectedIterationPaths: TokenType[][];
          previous: IToken;
          ruleName: string;
      }
      • actual: IToken[]

        The actual sequence of tokens encountered.

      • customUserDescription: string

        A user may provide custom error message descriptor in the BaseParser.AT_LEAST_ONE_SEP DSL method options parameter, this is that custom message.

      • expectedIterationPaths: TokenType[][]

        The valid (expected) paths in the first iteration.

      • previous: IToken

        The previous Token "instance". This is useful if options.actual[0] is of type chevrotain.EOF and you need to know the last token parsed.

      • ruleName: string

        The rule in which the error occurred.

    Returns string

  • Mismatched Token Error happens when the parser attempted to consume a terminal and failed. It corresponds to a failed BaseParser.CONSUME in Chevrotain DSL terms.

    Parameters

    • options: {
          actual: IToken;
          expected: TokenType;
          previous: IToken;
          ruleName: string;
      }
      • actual: IToken

        The actual Token "instance".

      • expected: TokenType

        The expected Token Type.

      • previous: IToken

        The previous Token "instance". This is useful if options.actual[0] is of type chevrotain.EOF and you need to know the last token parsed.

      • ruleName: string

        The rule in which the error occurred.

    Returns string

  • A Redundant Input Error happens when the parser has completed parsing but there is still unprocessed input remaining.

    Parameters

    • options: {
          firstRedundant: IToken;
          ruleName: string;
      }
      • firstRedundant: IToken

        The first unprocessed token "instance".

      • ruleName: string

        The rule in which the error occurred.

    Returns string

  • A No Viable Alternative Error happens when the parser cannot detect any valid alternative in an alternation. It corresponds to a failed BaseParser.OR in Chevrotain DSL terms.

    Parameters

    • options: {
          actual: IToken[];
          customUserDescription: string;
          expectedPathsPerAlt: TokenType[][][];
          previous: IToken;
          ruleName: string;
      }
      • actual: IToken[]

        The actual sequence of tokens encountered.

      • customUserDescription: string

        A user may provide custom error message descriptor in the BaseParser.AT_LEAST_ONE_SEP DSL method options parameter, this is that custom message.

      • expectedPathsPerAlt: TokenType[][][]

        First level of the array represents each alternative The next two levels represent valid (expected) paths in each alternative.

      • previous: IToken

        The previous Token "instance". This is useful if options.actual[0] is of type chevrotain.EOF and you need to know the last token parsed.

      • ruleName: string

        The rule in which the error occurred.

    Returns string