boost-spirit

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

Getting started guide for Boost.Spirit? [closed]

谁说我不能喝 提交于 2021-02-05 12:59:08
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . Improve this question I've been looking recently at Boost.Spirit (the version included in Boost 1.39), however I'm quite confused from the docs alone. What I'm looking for is for an example of a toy language implemented with Boost.Spirit -- something along the lines of a tiny

Parsing Selector struct with alternating tokens using Boost Spirit X3

前提是你 提交于 2021-02-05 08:30:09
问题 I am trying to parse the following struct: struct Selector { std::string element; std::string id; std::vector<std::string> classes; }; This struct is used to parse selectors in the form element#id.class1.class2.classn . These selectors always start with 1 or no elements, could contain 1 or no ids, and could contain 0 to n classes. This gets even more complicated though, because classes and id can appear in any order, so the following selectors are all valid: element#id.class1 , .class1#id

Parsing Selector struct with alternating tokens using Boost Spirit X3

故事扮演 提交于 2021-02-05 08:28:06
问题 I am trying to parse the following struct: struct Selector { std::string element; std::string id; std::vector<std::string> classes; }; This struct is used to parse selectors in the form element#id.class1.class2.classn . These selectors always start with 1 or no elements, could contain 1 or no ids, and could contain 0 to n classes. This gets even more complicated though, because classes and id can appear in any order, so the following selectors are all valid: element#id.class1 , .class1#id

Parse a '.' chained identifier list, with qi::lexeme and prevent space skipping

丶灬走出姿态 提交于 2021-02-05 08:21:33
问题 im currently working on a Spirit based Expression Parser that should allow in the end (far far in the future) expressions like "a*b*c" "10+20*x.y.z" "a.b.c[ a.b ][ e.c( d.e()*4 )].e.f( (a.b+23)*d, -23*b.e(a.b.c) ).x.y" wild mix of member accesses, array subscriptions, function calling and expressions [] -> subscription () -> function call or expression bracket . member chaining currently im fighting with the space skipping on member-chaining "a . b . c" is not valid in my world - but gets