tvl-depot/users/Profpatsch
Profpatsch 59a9955d75 feat(users/Profpatsch/netencode): fully streaming parser
In order to arbitrarily split netencode over multiple reads, we need
to make the parser completely streaming, so that it recognizes all
cases where it needs more input.

Luckily, this is fairly trivial, after working around a bunch of
overeager parsing.

The tricky part was the giant `alt`, where inner parsers would start
consuming input and thus become incomplete when they fail afterwards.
Sinc the format *always* starts the different types with one
discriminator char, we can use that to instantly return the parser and
try the next one instead.

The other tricky part was that lists and records would parse all inner
elements and then choke on the empty string after the last element,
because the inner parser would consume at least the descriminator, and
an empty string is always `Incomplete`. We wrap these into a small
combinator which plays nice with `many0` in that regard.

Change-Id: Ib8d15d9a7cab19d432c6b24a35fcad6a5a72b246
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2704
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: sterni <sternenseemann@systemli.org>
2021-04-01 07:28:07 +00:00
..
advent-of-code/2020 feat(users/Profpatsch/advent-of-code): 2020 day 04 2021-03-01 23:26:25 +00:00
arglib feat(users/Profpatsch): build attrset members on CI 2021-03-15 22:16:19 +00:00
emacs-tree-sitter-move feat(emacs-tree-sitter-move): shell and json test files 2021-01-01 22:40:38 +00:00
execline feat(users/Profpatsch): build attrset members on CI 2021-03-15 22:16:19 +00:00
netencode feat(users/Profpatsch/netencode): fully streaming parser 2021-04-01 07:28:07 +00:00
netstring feat(users/Profpatsch): build attrset members on CI 2021-03-15 22:16:19 +00:00
nixpkgs-rewriter feat(users/Profpatsch): build attrset members on CI 2021-03-15 22:16:19 +00:00
writers fix(users/Profpatsch/writers): use s6-portable-utils 2021-03-26 11:01:20 +00:00
imap-idle.nix feat(users/Profpatsch): add imap-idle 2021-03-22 22:52:11 +00:00
imap-idle.rs feat(users/Profpatsch): add imap-idle 2021-03-22 22:52:11 +00:00
lib.nix fix(users/Profpatsch/lib/eprintenv): don’t crash when env is missing 2021-02-13 20:00:23 +00:00
OWNERS feat(users/Profpatsch): add sterni to my user dir OWNERS 2021-02-09 20:46:30 +00:00
read-http.nix feat(users/Profpatsch/{netencode,http-parse}): use HashMap 2021-02-06 21:38:57 +00:00
read-http.rs feat(users/Profpatsch/execline/exec_helpers): add no_args() 2021-02-13 20:00:23 +00:00
rust-crates.nix feat(users/Profpatsch): add imap-idle 2021-03-22 22:52:11 +00:00
tree-sitter.nix feat(users/Profpatsch): build attrset members on CI 2021-03-15 22:16:19 +00:00