Boost logo

Boost Users :

Subject: [Boost-users] [Spirit] Qi lexeme only taking the first word
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2018-11-06 22:01:59


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);


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 "", I receive back "two" in the AST.

Perhaps I should defer specifying the lexeme part of id until later?

Thoughts? Suggestions?

Thank you!

Best regards,

Michael Powell

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at