AndrasKovacs / flatparse

Fast parsing from bytestrings
MIT License
146 stars 12 forks source link

Rework digit parsers for failure and provide Word verions #33

Closed dminuoso closed 1 year ago

dminuoso commented 1 year ago

I have reworked the bounded numeric parsers with two features:

a) Provide Word specific parsers (readWord, readWordHex) to allow parsing numbers twice as large.

To read smaller bounded types, a user can simply use something like intCastMaybe - but to provide broadest compatibility, we should start from Word.

b) Have all bounded parsers (readWord, readWordHex, readInt, readIntHex) fail on overflow.

This feels more rigid and in line with the rest of the library. Note that from the outside an overflow is near impossible to detect reliably.

dminuoso commented 1 year ago

This subsumes some of the attempted work in #21