Closed raehik closed 2 years ago
snip, placed above
This will be a while while I fumble more primop compatibility helpers in.
This is ready - I'll write a few tests before merging, at least for C-strings and skips. The address stuff is harder to test and a lot less user-facing.
Fairly high confidence from the tests and these are very useful parsing primitives (I have been using them successfully via a fork). Merging!
More binary primitives.
skip :: Int -> Parser e ()
skip X bytesanyCString :: Parser e ByteString
parse a null-terminated bytestringThe
Addr#
-related primitives enable parsing structures like offset tables efficiently. We can "save" anAddr#
via thewithAddr#
continuation, then use it in a lookahead together with an offset read from the input to jump around and parse arbitrary data elsewhere in the input. Some old code might explain better (function names are different): https://github.com/raehik/binrep/blob/180cd12c8fd773b0a99e5bb509432a2d0d11fae7/src/Binrep/Example/FileTable.hs#L81TODO
#
suffix for something that might not be useful anyway