Efficient DFA based parser for parsing a STEP enum.

Hierarchy (View Summary)

Constructors

Properties

Methods

Constructors

Properties

Instance: default = ...

Methods

  • Parse a generated enum that is based on a minimal perfect hash.

    Type Parameters

    • T extends number

    Parameters

    • typeMap: default<T>

      The map to the enum type using a minimal perfect hash that doesn't require string extraction.

    • input: Uint8Array

      The input buffer.

    • cursor: number

      The offset in the input buffer where the enum may be.

    • endCursor: number

      The end point of the parse which should not be overflowed.

    Returns undefined | T

    The matching enum value or undefined if none matches or the parse fails.

  • Get the value of a given state for a given value.

    Useful for using this for mappings. Will cause an exception if out of bounds.

    Parameters

    • value: number

      The byte value to lookup.

    • state: number

      The state to get the value for.

    Returns number

  • Match a step enum

    Parameters

    • input: Uint8Array

      The input buffer to match against.

    • cursor: number

      The cursor to test the match against.

    • endCursor: number

      The end point to look at in the buffer.

    Returns undefined | number

    The end of the match.