You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.8 KiB
Plaintext

Compatibility matrix:
- Input type
- Streaming output
- Streaming item reads
Input type Streaming output Streaming item reads supported?
=============== ================ ===============================
Stream Yes Yes, blocking
Stream No No
Seekable Yes Yes
Seekable No Yes
Value Yes Yes
Value No Yes
Parsing options:
- Force streaming items to be buffered instead
- Allow incomplete parses (for incremental seeking parsing)
Input types:
- Value (string/buffer)
- Seekable (how to set encoding here?)
- Stream (how to detect string vs. buffer here?)
Thoughts:
- Maybe there should be a parseString vs. parseBuffer method to declare the *intended* parsing mode?
- Need to support *some* form of mixed-mode parsing, eg. for HTTP-encapsulated binary data
- FIXME/MARKER: regex parsing cannot work in either stremaing *or* mixed-mode parsing, because with the language implementation of regex it is unknowable whether it failed due to a mismatch or due to running out of Input
- Provide a custom character range operation instead
- ensure that this correctly handles the astral plane, since those characters are two codepoints in JS (with UCS-2) rather than one (as in UTF-8)
- also need to make sure to get the *codepoint* of characters for determining the ranges, not the first/single byte value (which I think charcodeAt does?)
- Need a trackBranch wrapper for custom `either` implementations and such, to make the core aware of when branching is occurring - this is necessary for both reasonable errors ("expected X or Y or Z") as well as input management; in streaming modes, earlier input can only be discarded once it becomes unreachable for backtracking, which is only the case when there are no remaining levels of branching in the parsing tree