Re: IPv6 address parsing

Michael Powell <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <CAMEoF_Gnt6ZAohD2gzb_c0=qpgXq2Q53P8pE_dS1awMSbouQVw@mail.gmail.com>
On Thu, Dec 7, 2017 at 2:32 AM, Seth <[email protected]> wrote:
> On 07-12-17 00:15, Michael Powell wrote:
>
> qi::rule<Iterator> _dec_octet = (
>     char_('0')
>     | char_('1') >> -(digit >> -digit)
>     | char_('2') >> (
>         char_('0', '4') >> -digit
>         | char_('5') >> -char_('0', '5')
>         | char_('6', '9')
>         )
>     | char_('3', '9') >> -digit
>     );
>
> Are you still using that contraption?! Why?

Why do you call it "contraption" when it is the octet grammar? I am
not interested in uint8_t-based parsers for this purpose, unless
absolutely necessary. And then, I'm not convinced Qi/Fusion could
interpret that? I could be wrong, however; i.e. string >> -(uint8_t >>
uint8_t >> uint8_t >> uint8_t), and ultimately, including port, string
>> -(uint8_t >> uint8_t >> uint8_t >> uint8_t) >> uint16_t. (Pardon
the "psuedo grammar", with attribution in view.)

Yes, I am interested to validate *and receive back* the full IPv6
address, *including any IPv4 components*, as part of the "address"
std::string. Not, uint8_t's.

Just besides, given the IPv6 grammar, what do you call "comparable"? I
just want to "validate" and attribute back the full string.

As of now, for my part, untested. Just wanted to probe for
constructive feedback.

> On 01-12-17 01:25, Seth wrote:
>
> On 30-11-17 14:32, Michael Powell wrote:
>
> My goal is to parse address into a std::string. That will be important
> for me when I turn the corner into IPv6 parsing. Could this approach
> support that? i.e. uint_parser... into a std::string?
>
> Of course. Just slap `qi::raw[]` around the whole hot mess, and pronto.
> However, I explained exactly why I didn't do this. If your application
> doesn't require comparable addresses, go for strings
>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.