Defining skipper in separate translation unit using Boost.Spirit X3

How to define skipper grammar in a separate translation unit? What should be the type of the output attribute? Or can I just specify boost::spirit::x3::unused_type

as Attribute

a template parameter for boost::spirit::x3::rule

the template class for the skipper grammar? I think the skipper grammar should only internally move the input iterator forward on spaces, news, comments, etc. It's better in terms of performance and memory allocation / deallocation. How do I determine the type of context for such a grammar that I have to provide to the macro BOOST_SPIRIT_INSTANTIATE

?

+3


source to share


1 answer


Finally I found a solution.

using skipper_parser = x3::rule< class skipper_class, x3::unused_type const >;

is the type definition of the parser (the const

-ness return type is important).



BOOST_SPIRIT_INSTANTIATE(skipper_parser, iterator_type, x3::unused_type)

is an instance of the template function parse_rule

for the skipper in a separate translation block.

+3


source







All Articles