Detecting numeric overflow

Seth <[email protected]> Fri, 14 Sep 2018 09:31:08 +0200
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 13-09-18 16:51, braden wrote:
> Is there a way to distinguish numeric overflow in Spirit's numeric parsers
> from other types of failure? Do I need to write my own numeric parser if I
> want this?

It's not currently a feature, although you can easily use a bigger type
if you have it, and use semantic actions to constrain the range:

https://stackoverflow.com/questions/51272067/boost-spirit-qi-bounds-checking-against-primitive-data-types
or

https://stackoverflow.com/questions/40866528/how-to-write-a-boostspiritqi-parser-to-parse-an-integer-range-from-0-to-std?noredirect=1&lq=1

https://stackoverflow.com/questions/30375750/constraining-the-existing-boost-spirit-real-parser-with-a-policy/30385909#30385909