Re: Qi parse retval vs iterators
Michael Powell <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <CAMEoF_EJccUe7VhTwxtJ7Jw-wR8X1FH0vjE1fkT1LixJG5TiXA@mail.gmail.com> |
On Tue, Dec 5, 2017 at 3:09 AM, Seth <[email protected]> wrote: > On 04-12-17 23:09, Michael Powell wrote: >> I should think that if there were any remaining input that would be a >> failure to match? > > You shouldn't. PEG grammars are left-to-right greedy. This is documented. That's a qualified greedily if I understand the background, where series are concerned, optional, one|zero-or-more. That said, I get it. Thank you. > I've said this before: > > On 30-11-17 00:40, Seth wrote: >> Bonus tip: consider adding `>> qi::eoi` at the end of the parse >> expression so you don't need to check whether all of the input has been >> consumed (it must). > > And also this warning about partially matching: > > On 27-11-17 13:51, Seth wrote: >> >> 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