Options
All
  • Public
  • Public/Protected
  • All
Menu

Single use, usually stateful, class for matching input. Offers the ability to observe a match, as well as match one, and to change the matcher in use depending on observation and matching. E.g. it's possible to choose to start matching pattern B after finding pattern A, or after seeing pattern A, even if starting off matching something else. This enables us, for example, to parse XML, with the observer watching element open and close to maintain the current path, while the matcher matches anything we want.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

  • Create a new stateful matching machine

    Parameters

    • initialMatcher: any

      matcher to start using. This can be changed by the callback methods in this class

    • Optional o: any

      optional observer

    Returns MatchingMachine

Properties

Protected matcher

matcher: MatchingLogic

Protected observer

observer: MatchingLogic

Private omg

omg: Microgrammar<any>

Methods

consume

  • Stream-oriented matching. The observer can match in parallel with the main matcher.

    Parameters

    • input: string | InputStream
    • Default value parseContext: object = {}

      context for the whole parsing operation

    • Optional l: Listeners

      listeners observing input characters as they are read

    Returns void

Protected observeMatch

  • Observe a match. The return can change the matcher in use, or return the current matcher.

    Parameters

    Returns any

Protected onMatch

Generated using TypeDoc