Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MatchingLogic

Core matching logic interface. Only the matchPrefixReport method must be implemented to implement a matcher. Optional properties and functions can help make matching more efficient.

Hierarchy

Implemented by

Index

Properties

Optional $id

$id: string

Optional requiredPrefix

requiredPrefix: string

Optimization property. Prefix that's required for this to match. Return undefined if we don't know. If we can provide this information, it can make matching much more efficient if this is the first matcher in a Microgrammar.

Methods

Optional canStartWith

  • canStartWith(char: string): boolean
  • Optimization method. Can a match start with this character?

    Parameters

    • char: string

      character to test for

    Returns boolean

matchPrefix

  • Former core matching method. Now, this should be a wrapper around matchPrefixReport Implement as: toMatchPrefixResult(this.matchPrefixReport(is, thisMatchContext, parseContext));

    deprecated

    favor matchPrefixReport

    Parameters

    • is: InputState

      input state

    • thisMatchContext: __type

      context for this match, beginning from the top level and passed into nested matchers

    • parseContext: __type

      context for the whole parsing operation we're in: e.g. parsing a file

    Returns MatchPrefixResult

matchPrefixReport

  • Core matching method. Can we match at the present point in the given InputState? Context arguments may be used by matchers that require knowledge of current match or global context.

    Parameters

    • is: InputState

      input state

    • thisMatchContext: __type

      context for this match, beginning from the top level and passed into nested matchers

    • parseContext: __type

      context for the whole parsing operation we're in: e.g. parsing a file

    Returns MatchReport

Generated using TypeDoc