Skip to content

Parse bytes from Uint8Array #592

@hildjj

Description

@hildjj

See #591. Allow parsing a Uint8Array directly. Features needed:

  • Generate different parser from a similar grammar input based on an option.
  • Subset of grammar inputs are valid. In particular, all characters are treated as single byte Latin-1, and any character that can't fit in there is an error.
  • match byte by decimal/hex number
  • $ returns Uint8Array.prototype.subarray slice
  • Instead of Regexps for classes, use a 256-element bitstring. new BigUint64Array(4)?
  • location()/etc is all in bytes rather than code units
  • Error reporting in hexdump-like format (see chex for ideas)
  • building blocks of some kind for UTF8/16, float16/32/64, (u)int8/16/32/64 (all with big- and little-endian variants), and anything else that is common.
  • think about parsing bits rather than bytes also. Maybe a rule decoration of some kind.
  • example grammar for PNG or similar

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions