DFA based parser to match an hex number, plain, C or STEP.

Hierarchy (View Summary)

Constructors

Properties

Instance: default = ...

Methods

  • Parse a step hex value out to a binary value with the number of bits.

    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 | [Uint8Array, number]

    The extracted value or undefined.

  • 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 hex data, with a C style prefix of 0x or 0X.

    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 or undefined if none found.

  • Match hex data, with a STEP style

    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 or undefined if none found.

  • Match unprefixed hex data.

    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 or undefined if none found.