@blockchaincommons/dcbor-pattern - v1.0.0-beta.2
    Preparing search index...

    Type Alias Instr

    Instr:
        | { type: "MatchPredicate"; literalIndex: number }
        | { type: "MatchStructure"; literalIndex: number }
        | { type: "Split"; a: number; b: number }
        | { type: "Jump"; address: number }
        | { type: "PushAxis"; axis: Axis }
        | { type: "Pop" }
        | { type: "Save" }
        | { type: "Accept" }
        | { type: "Search"; patternIndex: number; captureMap: [string, number][] }
        | { type: "ExtendSequence" }
        | { type: "CombineSequence" }
        | { type: "NotMatch"; patternIndex: number }
        | { type: "Repeat"; patternIndex: number; quantifier: Quantifier }
        | { type: "CaptureStart"; captureIndex: number }
        | { type: "CaptureEnd"; captureIndex: number }

    One instruction of a compiled pattern.

    Type Declaration

    • { type: "MatchPredicate"; literalIndex: number }
      • type: "MatchPredicate"

        The discriminant: fails the thread unless the literal matches the current node.

      • literalIndex: number

        The index in literals of the pattern to test.

    • { type: "MatchStructure"; literalIndex: number }
      • type: "MatchStructure"

        The discriminant: matches a structure literal, continuing along each path it yields.

      • literalIndex: number

        The index in literals of the structure pattern to match.

    • { type: "Split"; a: number; b: number }
      • type: "Split"

        The discriminant: continues at a, with a fallback thread at b.

      • a: number

        The address the thread continues at.

      • b: number

        The address the fallback thread starts at.

    • { type: "Jump"; address: number }
      • type: "Jump"

        The discriminant: continues at address.

      • address: number

        The address to continue at.

    • { type: "PushAxis"; axis: Axis }
      • type: "PushAxis"

        The discriminant: continues once per child of the current node along axis.

      • axis: Axis

        The axis to descend along.

    • { type: "Pop" }
      • type: "Pop"

        The discriminant: returns to the parent node.

    • { type: "Save" }
      • type: "Save"

        The discriminant: records the current path as a result and continues.

    • { type: "Accept" }
      • type: "Accept"

        The discriminant: records the current path as a result and ends the thread.

    • { type: "Search"; patternIndex: number; captureMap: [string, number][] }
      • type: "Search"

        The discriminant: continues once per node below the current one that the pattern matches.

      • patternIndex: number

        The index in literals of the pattern to search for.

      • captureMap: [string, number][]

        The capture names the searched pattern uses, each with its index in captureNames.

    • { type: "ExtendSequence" }
      • type: "ExtendSequence"

        The discriminant: sets aside the current path and starts a fresh one at the current node.

    • { type: "CombineSequence" }
      • type: "CombineSequence"

        The discriminant: appends the current path to the one set aside.

    • { type: "NotMatch"; patternIndex: number }
      • type: "NotMatch"

        The discriminant: fails the thread when the pattern matches the current node.

      • patternIndex: number

        The index in literals of the pattern that must not match.

    • { type: "Repeat"; patternIndex: number; quantifier: Quantifier }
      • type: "Repeat"

        The discriminant: continues once per repetition count the quantifier allows.

      • patternIndex: number

        The index in literals of the repeated pattern.

      • quantifier: Quantifier

        How many repetitions are allowed, and how eagerly they are taken.

    • { type: "CaptureStart"; captureIndex: number }
      • type: "CaptureStart"

        The discriminant: opens a capture at the current path.

      • captureIndex: number

        The index in captureNames of the capture.

    • { type: "CaptureEnd"; captureIndex: number }
      • type: "CaptureEnd"

        The discriminant: closes a capture, recording the current path under it.

      • captureIndex: number

        The index in captureNames of the capture.