Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/MatchReport"

Index

Type aliases

MatchReport

All the data about the match, enough to generate either a PatternMatch or a value structure (with fields as declared in microgrammar terms) or a TreeNodeCompatible parse tree or a TreeNodeCompatible report of why it matched or didn't.

I can't get from one of these structures to another, because the child structures are different. So, let's output one structure that can be turned into any of them.

Functions

isFailedMatchReport

isSuccessfulMatchReport

toExplanationTree

  • Return a tree which explains the activity of the matching, both what matched and what didn't. Empty matches are included, and failed matches are included. Use this to figure out why something matched (or didn't).

    Parameters

    • mr: MatchReport

      a MatchReport from Grammar.perfectMatch

    Returns MatchExplanationTreeNode

toMatchPrefixResult

toParseTree

  • Extract a tree describing how the match was parsed. Each matcher adds a node, plus Concat adds nodes for all its properties and Rep adds nodes for all its elements. Synthetic elements are empty elements are not included; each node maps to content in the file.

    Parameters

    • mr: MatchReport

      match report from Grammar.perfectMatch

    Returns TreeNodeCompatible

toPatternMatchOrDismatchReport

toValueStructure

  • Return the values extracted from a match. For any match constructed with microgrammar(...) this will return an object with a property for each term. Synthetic properties are included.

    Type parameters

    • T

    Parameters

    • mr: MatchReport

      a MatchReport from Grammar.perfectMatch

    Returns T

Generated using TypeDoc