Re: simple sql query parser
Larry Evans <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 01/01/2018 01:43 PM, labsquare wrote: > It works perfect !!! Thanks you ! > My last question : what's the goal of "class" inside the rule declaration . > > auto rule = x3::rule<*class whereRule*, string>() > > is "class whereRule" is really necessary ? What's the purpose ? > [snip] It's used here: https://github.com/boostorg/spirit/blob/develop/include/boost/spirit/home/x3/nonterminal/rule.hpp#L32 What that does is looks up the rule definition in the context arg to the function *IF* BOOST_SPIRIT_DEFINE has *not* been used to associate the rule<ID,...> with it's RHS. OTOH, *IF* BOOST_SPIRIT_DEFINE *has* been used, then that creates another parse_rule function specialized on thate rule<ID,...>; hence, that specialized parse_rule is called instead. The parse_rule function is called from within the rule<ID,...>::parse function here: https://github.com/boostorg/spirit/blob/develop/include/boost/spirit/home/x3/nonterminal/rule.hpp#L113 Like me, you might find that a little hard to follow, but that's my understanding of how it works. HTH. -regards, Larry ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot