Re: Qi lexeme only taking the first word
Michael Powell <[email protected]> Tue, 6 Nov 2018 17:42:03 -0500
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <CAMEoF_EuDnpe-6y8KdHrZbcbR0dFNGdWseH4EtjF6ugNcSFkig@mail.gmail.com> |
On Tue, Nov 6, 2018 at 5:01 PM Michael Powell <[email protected]> wrote: > > Hello, > > I've got a couple of rules that are perplexing to me. First, > > rule<It, std::string(), St> id %= lexeme[qi::alpha >> *char_("A-Za-z0-9_")]; > > In and of itself, id is working fine. Then I've got a "full id": > > rule<It, full_id_t(), St> full_id %= id >> *(char_('.') >> id); > > Where: > > struct full_id_t { > std::string val; > }; > > full_id_t::val is quite intentional for reasons elsewhere in the grammar. > > The perplexity comes in, it seems lexeme is only shaving off the first > word as the val. > > For instance, parsing "two.oranges.red.test", I receive back "two" in the AST. > > Perhaps I should defer specifying the lexeme part of id until later? I elaborated a little on the "simple" full id sub-grammar, but I cannot repro using the GCC compiler. I'm wondering if this has anything to do with the VS2017 fpos issue? http://coliru.stacked-crooked.com/a/adeb42ce2f19b0fd Or there may be insufficient context in the web compiler to adequately demo. > Thoughts? Suggestions? > > Thank you! > > Best regards, > > Michael Powell