Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface InputState

InputState abstraction, exposed to matchers. Backed by a buffer or stream that is managed transparently.

Hierarchy

  • InputState

Implemented by

Index

Properties

Optional listeners

listeners: Listeners

InputStateListeners, if set. InputStateListener instances will have seen only the characters up to this point.

offset

offset: number

Methods

advance

consume

  • Consume the given string if our input begins with it. Otherwise fail

    Parameters

    • s: string

      string that we must find

    • message: string

      description of what we're doing to help in diagnosing problems

    Returns InputState

exhausted

  • exhausted(): boolean

peek

  • peek(n: number): string
  • Look ahead in the input without consuming characters

    Parameters

    • n: number

      number of characters to look ahead

    Returns string

skipTo

  • Skip to before this pattern. Exhaust input if necessary. Return tuple of what was skipped and the resulting InputState

    Parameters

    • what: string

      what to skip to

    Returns Skipped

skipWhile

  • skipWhile(skip: function, n: number): Skipped
  • Skip input while it matches the given function

    Parameters

    • skip: function

      function to test characters

        • (s: string): boolean
        • Parameters

          • s: string

          Returns boolean

    • n: number

      number of characters to test for skip function Return tuple of what was skipped and the resulting InputState

    Returns Skipped

Generated using TypeDoc