Tomilov Anatoliy
Tomilov Anatoliy

Reputation: 16721

Defining skipper in separate translation unit using Boost.Spirit X3

How to define skipper grammar in separate translation unit? What is the type of output attribute should be? Or can I simply specify boost::spirit::x3::unused_type as Attribute template parameter to boost::spirit::x3::rule template class for skipper grammar? I think the skipper grammar should only internally move forward input iterator over blanks, newlines, comments, etc. It is better in sense of performance and memory allocations/frees. How to define a context type for such grammar, which should I provide to BOOST_SPIRIT_INSTANTIATE macro?

Upvotes: 4

Views: 508

Answers (1)

Tomilov Anatoliy
Tomilov Anatoliy

Reputation: 16721

Finally I found the solution.

using skipper_parser = x3::rule< class skipper_class, x3::unused_type const >; is the definition of skipper parser type (const-ness of returned type is important thing).

BOOST_SPIRIT_INSTANTIATE(skipper_parser, iterator_type, x3::unused_type) is the instantiation of parse_rule template function for the skipper somewere in separate translation unit.

Upvotes: 3

Related Questions