boost-spirit-x3

linking errors while separate parser using boost spirit x3

廉价感情. 提交于 2019-11-27 06:25:33
问题 I am currentyl trying to separate my boost spirit x3 parser into different _def and .cpp files using BOOST_SPIRIT_DEFINE/DECLARE/INSTANTIATE , but I keep getting a linking error. HERE is my parser which is separated. The linker error reads <artificial>:(.text.startup+0xbb): undefined reference to `bool kyle::parser::impl::parse_rule<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::spirit::x3::context<boost::spirit:

Boost Spirit X3 cannot compile repeat directive with variable factor

梦想的初衷 提交于 2019-11-27 05:06:59
I am trying to use the Boost Spirit X3 directive repeat with a repetition factor that is variable. The basic idea is that of a header + payload, where the header specifies the size of the payload. A simple example “3 1 2 3” is interpreted as header = 3, data= {1, 2, 3} (3 integers). I could only find examples from the spirit qi documentation. It uses boost phoenix reference to wrap the variable factor: http://www.boost.org/doc/libs/1_50_0/libs/spirit/doc/html/spirit/qi/reference/directive/repeat.html std::string str; int n; test_parser_attr("\x0bHello World", char_[phx::ref(n) = _1] >> repeat

How to make a recursive rule in boost spirit x3 in VS2017

故事扮演 提交于 2019-11-26 18:36:18
问题 I've written the following recursive rule in boost::spirit::x3 but it only seems to compile in g++/clang, not VS2017 (15.5.3): #include <iostream> #include <boost/spirit/home/x3.hpp> namespace lex3 { namespace x3 = boost::spirit::x3; x3::rule<struct foo_class> const foo = "foo"; x3::rule<struct bar_class> const bar = "bar"; auto bar_def = *((x3::char_ - "/*") - "*/") >> *(foo > *((x3::char_ - "/*") - "*/")); auto foo_def = "/*" > bar > "*/"; BOOST_SPIRIT_DEFINE(foo) BOOST_SPIRIT_DEFINE(bar) }

Boost Spirit X3 cannot compile repeat directive with variable factor

人走茶凉 提交于 2019-11-26 11:27:36
问题 I am trying to use the Boost Spirit X3 directive repeat with a repetition factor that is variable. The basic idea is that of a header + payload, where the header specifies the size of the payload. A simple example “3 1 2 3” is interpreted as header = 3, data= {1, 2, 3} (3 integers). I could only find examples from the spirit qi documentation. It uses boost phoenix reference to wrap the variable factor: http://www.boost.org/doc/libs/1_50_0/libs/spirit/doc/html/spirit/qi/reference/directive