Re: [Qi] Phrase parsed but iterator did not reach end
Michael Powell <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <CAMEoF_FNsyRsYHDPKah2WETkKOAWb6NN6a2jjTf+a8160hFcMw@mail.gmail.com> |
On Mon, Nov 27, 2017 at 7:51 AM, Seth <[email protected]> wrote: > On 25-11-17 00:42, Michael Powell wrote: > > Basically to validate all the patterns from 0-65535 (valid port range). > > If that's the goal, see > > https://stackoverflow.com/questions/44156112/boost-spirit-qi-changing-tag-of-specialized-uint-parser/44158086#44158086 > > uint_parser<uint16_t, 10, 2, 5>(); > > which correctly parses 0..65535. uint_parser accepts MinDigits and MaxDigits. If that's the case, wouldn't that be matching things like "00" through "99999"? At least at self-documenting face value. Now, if that were bit-width, that would be another story, I think, i.e. masking values within the mask 0x...ffff, I'd buy that. > A more complete example: > > https://stackoverflow.com/questions/47243884/boost-spirit-qi-validating-input-parser/47244585#47244585 > > Which makes the point that you might want to `lexeme [ uint_parser<uint16_t, > 10, 2, 5>() >> !(digit|'.') ]` to avoid partially matching longer numbers. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot