boost-spirit

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

Is this the correct way of defining a set of recursive rules?

China☆狼群 提交于 2021-02-10 14:44:45
问题 PREFACE: I am asking this question because for some reason I can not get my code to compile. I just want to know whether an incorrect understanding of spirit::x3 is the cause or not Hello, I'd just like to verify something; is the following the correct way (at least technically) of defining rules for a large set of heavily recursive parsers? So for each parser, I do the following operations: // This is for reference only, it greatly simplifies the process of defining attributes. template

Boost::Spirit struggle with parsing a String

此生再无相见时 提交于 2021-02-10 06:14:37
问题 I'm trying to Parse a String with Boost::Spirit, but i just cannot get it to work. I have no experience with Boost::Spirit since today. The string is composed of commands separated by an ';'. The commands are "INC someInteger" "BOMB firstInteger secondInteger" "MOVE firstInteger secondInteger thirdInteger" "MSG someString" "WAIT" I Managed to get this far: #include <boost/spirit/include/qi.hpp> #include <boost/phoenix/phoenix.hpp> using namespace boost::spirit; int main() { std::string

Boost::Spirit struggle with parsing a String

China☆狼群 提交于 2021-02-10 06:11:38
问题 I'm trying to Parse a String with Boost::Spirit, but i just cannot get it to work. I have no experience with Boost::Spirit since today. The string is composed of commands separated by an ';'. The commands are "INC someInteger" "BOMB firstInteger secondInteger" "MOVE firstInteger secondInteger thirdInteger" "MSG someString" "WAIT" I Managed to get this far: #include <boost/spirit/include/qi.hpp> #include <boost/phoenix/phoenix.hpp> using namespace boost::spirit; int main() { std::string

Boost::Spirit struggle with parsing a String

倖福魔咒の 提交于 2021-02-10 06:11:04
问题 I'm trying to Parse a String with Boost::Spirit, but i just cannot get it to work. I have no experience with Boost::Spirit since today. The string is composed of commands separated by an ';'. The commands are "INC someInteger" "BOMB firstInteger secondInteger" "MOVE firstInteger secondInteger thirdInteger" "MSG someString" "WAIT" I Managed to get this far: #include <boost/spirit/include/qi.hpp> #include <boost/phoenix/phoenix.hpp> using namespace boost::spirit; int main() { std::string

Boost Spirit x3 conditional (ternary) operator parser

我只是一个虾纸丫 提交于 2021-02-10 05:37:34
问题 I need to build an abstract syntax tree from mathematical expression that I later need to link domain specific objects together as a calculation tree. I found the expression parser library https://github.com/hmenke/boost_matheval as an excellent starting point. In my use case I need to have support for ternary conditional expressions condition ? true_exp : false_exp . As of now the parser is able to parse expressions such as 1 + (2 + abs(x)) or min(x,1+y) . However I would need to have syntax

Creating a boost::spirit::x3 parser for quoted strings with escape sequence handling

a 夏天 提交于 2021-02-10 05:27:32
问题 I need to create a parser for quoted strings for my custom language that will also properly handle escape sequences, which includes allowing escaped quotes within the string. This is my current string parser: x3::lexeme[quote > *(x3::char_ - quote) > quote] where quote is just a constant expression for '"' . It does no escape sequence handling whatsoever. I know about boost::spirit::classic::lex_escape_ch_p , but I've no idea how to use that with the boost::spirit::x3 tools (or in general).

Customizing the full error message for expectation failures (boost::spirit::x3)

旧时模样 提交于 2021-02-08 09:38:06
问题 The boost::spirit::x3 error handling utilities allow for the user to choose what is shown to the user when an expectation failure occurs. This, however, does not seem to be the case for the line number portion of the message, which is exactly what I'd like to modify. So instead of it printing out In line 1: etc. I would like to print some other message in it's place with the same line number info. Anyone know how I could do that, or if it is even modifiable in the first place? EDIT: Here's

Parse OBJ file with mixed data-types using Boost.Spirit?

不问归期 提交于 2021-02-08 06:17:15
问题 I do have an OBJ file that looks like this: # This file uses centimeters as units for non-parametric coordinates. # first element v -0.017050 -0.017928 0.005579 v -0.014504 -0.017928 0.010577 . . v -0.000000 -0.017928 0.017967 vt 0.397581 0.004762 vt 0.397544 0.034263 . . vt 0.397507 0.063764 vn -0.951057 0.000000 0.309016 vn -0.809017 0.000000 0.587785 . . vn -0.587785 0.000000 0.809017 f 1/1/1 2/2/2 21/4/3 f 21/4/3 2/2/2 22/3/4 . . f 3/5/5 4/7/7 23/6/6 # second element v -0.014504 0.017928