boost-spirit-qi

How to combine skipping and non-skipping (lexeme) rules?

会有一股神秘感。 提交于 2021-02-13 05:44:54
问题 my parser is nearly working :) (still amazed by Spirit feature set (and compiletimes) and the very welcoming community here on stack overflow) small sample for online try: http://coliru.stacked-crooked.com/a/1c1bf88909dce7e3 so i've learned to use more lexeme-rules and try to prevent no_skip - my rules are smaller and better to read as a result but now i stuck with combining lexeme-rules and skipping-rules what seems to be not possible (compiletime error with warning about not castable to

How to combine skipping and non-skipping (lexeme) rules?

老子叫甜甜 提交于 2021-02-13 05:42:12
问题 my parser is nearly working :) (still amazed by Spirit feature set (and compiletimes) and the very welcoming community here on stack overflow) small sample for online try: http://coliru.stacked-crooked.com/a/1c1bf88909dce7e3 so i've learned to use more lexeme-rules and try to prevent no_skip - my rules are smaller and better to read as a result but now i stuck with combining lexeme-rules and skipping-rules what seems to be not possible (compiletime error with warning about not castable to

boost spirit qi parser failed in release and pass in debug

坚强是说给别人听的谎言 提交于 2021-02-10 22:20:43
问题 #include <boost/spirit/include/qi.hpp> #include <string> #include <vector> #include <iterator> #include <algorithm> #include <iostream> using namespace boost::spirit; int main() { std::string s; std::getline(std::cin, s); auto specialtxt = *(qi::char_('-', '.', '_')); auto txt = no_skip[*(qi::char_("a-zA-Z0-9_.\\:$\'-"))]; auto anytxt = *(qi::char_("a-zA-Z0-9_.\\:${}[]+/()-")); qi::rule <std::string::iterator, void(),ascii::space_type> rule2 = txt ('=') >> ('[') >> (']'); auto begin = s.begin

boost spirit qi parser failed in release and pass in debug

 ̄綄美尐妖づ 提交于 2021-02-10 22:20:36
问题 #include <boost/spirit/include/qi.hpp> #include <string> #include <vector> #include <iterator> #include <algorithm> #include <iostream> using namespace boost::spirit; int main() { std::string s; std::getline(std::cin, s); auto specialtxt = *(qi::char_('-', '.', '_')); auto txt = no_skip[*(qi::char_("a-zA-Z0-9_.\\:$\'-"))]; auto anytxt = *(qi::char_("a-zA-Z0-9_.\\:${}[]+/()-")); qi::rule <std::string::iterator, void(),ascii::space_type> rule2 = txt ('=') >> ('[') >> (']'); auto begin = s.begin

Boost spirit get the whole match as a string

让人想犯罪 __ 提交于 2021-02-07 07:09:58
问题 I'm trying to define my own grammar using boost spirit framework and I'm defining such a matching rule: value = ( char_('"') >> (*qi::lexeme[ char_('\\') >> char_('\\') | char_('\\') >> char_('"') | graph - char_('"') | char_(' ') ])[some_func] >> char_('"') ); I'd like to assing an action - some_func - to the part of it, and pass the whole matching string as a parameter. But unfortunately I will get something like vector<boost::variant<boost::fusion::vector2 ..a lot of stuff...)...> . Can I

Boost spirit get the whole match as a string

社会主义新天地 提交于 2021-02-07 07:08:50
问题 I'm trying to define my own grammar using boost spirit framework and I'm defining such a matching rule: value = ( char_('"') >> (*qi::lexeme[ char_('\\') >> char_('\\') | char_('\\') >> char_('"') | graph - char_('"') | char_(' ') ])[some_func] >> char_('"') ); I'd like to assing an action - some_func - to the part of it, and pass the whole matching string as a parameter. But unfortunately I will get something like vector<boost::variant<boost::fusion::vector2 ..a lot of stuff...)...> . Can I

Boost spirit get the whole match as a string

落爺英雄遲暮 提交于 2021-02-07 07:08:36
问题 I'm trying to define my own grammar using boost spirit framework and I'm defining such a matching rule: value = ( char_('"') >> (*qi::lexeme[ char_('\\') >> char_('\\') | char_('\\') >> char_('"') | graph - char_('"') | char_(' ') ])[some_func] >> char_('"') ); I'd like to assing an action - some_func - to the part of it, and pass the whole matching string as a parameter. But unfortunately I will get something like vector<boost::variant<boost::fusion::vector2 ..a lot of stuff...)...> . Can I

Boost spirit get the whole match as a string

荒凉一梦 提交于 2021-02-07 07:08:17
问题 I'm trying to define my own grammar using boost spirit framework and I'm defining such a matching rule: value = ( char_('"') >> (*qi::lexeme[ char_('\\') >> char_('\\') | char_('\\') >> char_('"') | graph - char_('"') | char_(' ') ])[some_func] >> char_('"') ); I'd like to assing an action - some_func - to the part of it, and pass the whole matching string as a parameter. But unfortunately I will get something like vector<boost::variant<boost::fusion::vector2 ..a lot of stuff...)...> . Can I

Boost spirit get the whole match as a string

孤街浪徒 提交于 2021-02-07 07:08:09
问题 I'm trying to define my own grammar using boost spirit framework and I'm defining such a matching rule: value = ( char_('"') >> (*qi::lexeme[ char_('\\') >> char_('\\') | char_('\\') >> char_('"') | graph - char_('"') | char_(' ') ])[some_func] >> char_('"') ); I'd like to assing an action - some_func - to the part of it, and pass the whole matching string as a parameter. But unfortunately I will get something like vector<boost::variant<boost::fusion::vector2 ..a lot of stuff...)...> . Can I

Boost spirit get the whole match as a string

青春壹個敷衍的年華 提交于 2021-02-07 07:07:56
问题 I'm trying to define my own grammar using boost spirit framework and I'm defining such a matching rule: value = ( char_('"') >> (*qi::lexeme[ char_('\\') >> char_('\\') | char_('\\') >> char_('"') | graph - char_('"') | char_(' ') ])[some_func] >> char_('"') ); I'd like to assing an action - some_func - to the part of it, and pass the whole matching string as a parameter. But unfortunately I will get something like vector<boost::variant<boost::fusion::vector2 ..a lot of stuff...)...> . Can I