boost-fusion

Generating Spirit parser expressions from a variadic list of alternative parser expressions

这一生的挚爱 提交于 2019-11-27 05:21:13
I'm looking for the simplest way to implement variadic function which takes list of boost::spirit::qi rules and expands the list into expression of format: rule1 | rule2 | rule3 |.... Let's assume that the rules synthesize no attribute. Your kind help is very much appreciated. #include <boost/config/warning_disable.hpp> #include <boost/spirit/include/qi.hpp> #include <string> #include <iostream> #include <boost/spirit/include/phoenix_operator.hpp> namespace qi = boost::spirit::qi; namespace ph = boost::phoenix; namespace ascii = boost::spirit::ascii; using boost::spirit::qi::phrase_parse;

Spirit Qi attribute propagation issue with single-member struct

一笑奈何 提交于 2019-11-26 18:59:45
I have an compilation issue with Spirit Qi where it complains that value_type is not a member of identifier . For some reason, Qi's attribute system considers identifier to be a container type, and tries to enumerate it's value type. This is a similar issue as in this question , however, I believe the cause is the single member struct and may be related to this bug . #include <string> #include <boost/spirit/include/qi.hpp> #include <boost/fusion/include/adapt_struct.hpp> using namespace boost::spirit::qi; struct identifier { std::wstring name; }; struct problem { identifier _1; identifier _2;

C++ iterate into nested struct field with boost fusion adapt_struct

旧时模样 提交于 2019-11-26 16:09:52
问题 Two stackoverflow answers suggest the approach using fusion adapt_struct to iterate over struct fields. The approach looks nice. However, how do you iterate into a field which itself is a struct? Following the previous answers, I come up with the code below. The problem is at the "#if 0" clause the code does not compile. As an alternative solution I created "decode()" function to take a void pointer to the target argument. That works, but loses the type information at compile time. Is there a

Generating Spirit parser expressions from a variadic list of alternative parser expressions

时光毁灭记忆、已成空白 提交于 2019-11-26 11:32:32
问题 I\'m looking for the simplest way to implement variadic function which takes list of boost::spirit::qi rules and expands the list into expression of format: rule1 | rule2 | rule3 |.... Let\'s assume that the rules synthesize no attribute. Your kind help is very much appreciated. #include <boost/config/warning_disable.hpp> #include <boost/spirit/include/qi.hpp> #include <string> #include <iostream> #include <boost/spirit/include/phoenix_operator.hpp> namespace qi = boost::spirit::qi; namespace

Spirit Qi attribute propagation issue with single-member struct

青春壹個敷衍的年華 提交于 2019-11-26 06:44:04
问题 I have an compilation issue with Spirit Qi where it complains that value_type is not a member of identifier . For some reason, Qi\'s attribute system considers identifier to be a container type, and tries to enumerate it\'s value type. This is a similar issue as in this question, however, I believe the cause is the single member struct and may be related to this bug. #include <string> #include <boost/spirit/include/qi.hpp> #include <boost/fusion/include/adapt_struct.hpp> using namespace boost