@configuredthings/rdp.js - v0.7.0
    Preparing search index...

    Class RDParserAbstract

    Index

    Constructors

    Methods

    • Returns true when the parser has reached the end of input. Implemented by subclasses based on their input representation.

      Returns boolean

    • Returns a human-readable description of the input element at pos for use in error messages. In scannerless parsers this describes a byte; in token parsers it describes a token.

      Parameters

      • pos: number

        The position index to describe.

      Returns string

    • Throws an RDParserException with the given message and the current position appended. The return type is never so call sites can write return this.error(...) to satisfy TypeScript's control-flow analysis.

      Parameters

      • message: string

        Description of the parse failure.

      Returns never

      Always.

    • Throws a RDParserException naming the unexpected input element at the furthest position reached during parsing.

      Call this from the top-level parse() method when the first rule returns null, to give callers a precise error location rather than a generic "Failed to parse input (at position 0)" message.

      Returns never

      Always.

    • Returns the furthest position at which a terminal match was attempted and failed. Useful for producing informative error messages when the overall parse fails.

      Returns number

    • Returns the current position within the input.

      Returns number

    • Restores the current position to a previously saved value.

      Used with getPosition to implement backtracking in parser alternatives.

      Parameters

      • pos: number

        The position to restore to.

      Returns void

    • Records the current position as a fail point if it is further than any previously recorded fail. Subclasses call this when a terminal match fails.

      Returns void