boost-spirit-qi

Parse quoted strings with boost::spirit

眉间皱痕 提交于 2019-11-26 07:47:21
问题 I would like to parse a sentence where some strings may be unquoted, \'quoted\' or \"quoted\". The code below almost works - but it fails to match closing quotes. I\'m guessing this is because of the qq reference. A modification is commented in the code, the modification reults in \"quoted\' or \'quoted\" also parsing and helps show the original problem is with the closing quote. The code also describes the exact grammar. To be completely clear: unquoted strings parse. A quoted string like \

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

boost spirit semantic action parameters

空扰寡人 提交于 2019-11-26 05:18:46
问题 in this article about boost spirit semantic actions it is mentioned that There are actually 2 more arguments being passed: the parser context and a reference to a boolean ‘hit’ parameter. The parser context is meaningful only if the semantic action is attached somewhere to the right hand side of a rule. We will see more information about this shortly. The boolean value can be set to false inside the semantic action invalidates the match in retrospective, making the parser fail. All fine, but

Boost Spirit: “Semantic actions are evil”?

久未见 提交于 2019-11-25 22:56:03
问题 Reading and watching this presentation: http://boost-spirit.com/home/2011/06/12/ast-construction-with-the-universal-tree/ I\'ve discovered this statement -- basically we are suggested not to use semantic actions. I must admit, that I\'ve already felt something like that: grammars with semantic actions actually look kinda ugly. and, when I needed to extend/change them, it took a lot of \"micromanagement\" exactly with semantic actions. The approach with attribute grammar, demonstrated in the

Boost spirit skipper issues

核能气质少年 提交于 2019-11-25 21:57:13
问题 I have trouble with boost spirit skippers. I need to parse a file like that : ROW int int [int, int] int [int, int] ... I am able to parse it without problem (thanks to stackoverflow ;) only if I add an \'_\' after the first int. In fact, I think the skipper eat the end of line after the first int, so the first and second (on second line) look as only one int. I don\'t understand how to keep eol but eat spaces. I\'ve found examples to use a custom parser like here and here. I tried qi::blank,