boost-spirit

How to increase the gcc executable stack size?

守給你的承諾、 提交于 2019-11-29 06:28:53
I have large Boost/Spirit metaprogram that is blowing gcc's stack when I try to compile it. How can I increase gcc's stack size, so I can compile this program? Note: There's no infinite recursion going on, but there is enough incidental recursion to exhaust gcc's stack. LiraNuna On Linux, you can expand the stack size in /etc/security/limits.conf. You can check your current stack size by using $ ulimit -s 8192 Then expand the stack to be double than that: youruser soft stack 16384 And then relog. This will increase stack size for all executable you're running, not just GCC's. I use that in my

Can Boost Spirit be used to parse byte stream data?

孤街醉人 提交于 2019-11-29 03:15:09
问题 Can Spirit (part of Boost C++ library) be used to parse out binary data coming from a stream? For example, can it be used to parse data coming from a socket into structures, bytes, and individual bit flags? Thanks! 回答1: Boost Spirit allows for a parser to be defined using Extended Backus–Naur Form (EBNF) syntax with template meta-programming. It is very flexible and uses abstract classes in all phases of the parsing process that can be customized. In order to process a binary data stream, you

Boost Spirit x3: parse into structs

六月ゝ 毕业季﹏ 提交于 2019-11-29 02:39:54
From the Boost Spirit X3 tutorial: First, let's create a struct representing an employee: namespace client { namespace ast { struct employee { int age; std::string surname; std::string forename; double salary; }; }} Then, we need to tell Boost.Fusion about our employee struct to make it a first-class fusion citizen that the grammar can utilize. BOOST_FUSION_ADAPT_STRUCT( client::ast::employee, (int, age) (std::string, surname) (std::string, forename) (double, salary) )` [...] In fusion's view, a struct is just a form of a tuple. You can adapt any struct to be a fully conforming fusion tuple. [

Getting boost::spirit::qi to use stl containers

断了今生、忘了曾经 提交于 2019-11-28 20:56:14
I'm trying to parse something with boost.spirit's qi library, and I'm running into an issue. According to the spirit docs , a >> b should produce something with the type tuple<A, B> . But this is a boost::tuple (aka fusion vector), and not a std::tuple (which I want). Is there any easy way to make this conversion between boost::tuple => std::tuple ? The same documentation page says that *a should produce something with the type vector<A> . This seems to be producing a std::vector<A> (or some kind of boost::vector<A> that can implicitly convert to a std::vector<A> ). I just wanted to know if

How can I use the skipper ascii::space WITHOUT skipping eol?

冷暖自知 提交于 2019-11-28 18:58:17
I have to use boost::spirit for parsing, and I want use phrase_parse function : qi::phrase_parse(str.begin(), str.end(), grammar, ascii::space - qi::eol); But the fourth term (ascii::space - qi::eol), isnt allowed by my compiler. How can I use the skipper ascii::space WITHOUT skipping eol ? The simplest answer is qi::phrase_parse(str.begin(), str.end(), grammar, ascii::blank); Of course, it depends on your grammar too: if it expects a specific skipper class you might need to change that. See below for a generic way to handle that (although you could just specify qi::blank_type for a Grammar

Example parsing error

不打扰是莪最后的温柔 提交于 2019-11-28 14:31:41
I'm trying to parse an example of boost spirit (2.5.2) following the example. My code is the following #include <boost\spirit\home\qi.hpp> #include <iostream> #include <string> #include <utility> int main() { // Parsing two numbers std::string input("1.0 2.0"); std::pair<double, double> p; boost::spirit::qi::phrase_parse( input.begin(), input.end(), boost::spirit::qi::double_ >> boost::spirit::qi::double_ , // Parse grammar boost::spirit::qi::space, p ); return 0; } It's almost equal to the example found here , but when I compile it with Visual studio 2010 (32 bit, debug) I obtain the

Boost spirit revert parsing

陌路散爱 提交于 2019-11-28 14:27:32
I want to parse a file containing the following structure: some garbage *&% section1 { section_content } section2 { section_content } The rule parsing section_name1 { ... } section_name2 { ... } is already defined: section_name_rule = lexeme[+char_("A-Za-z0-9_")]; section = section_name_rule > lit("{") > /*some complicated things*/... > lit("}"); sections %= +section; So I need to skip any garbage until the sections rule is met. Is there any way to accomplish this? I have tried seek[sections] , but it seems not to work. EDIT : I localized the reason why seek is not working: if I use follows

how to customise default Boost xml Serialisation default node naming to make it more readable

左心房为你撑大大i 提交于 2019-11-28 14:18:44
The code below generates a xml file but , when it loops theough a map , it always names the map key as first and value as second Is there a way that we can customise tag names first and second to groupid and groupType as shown in desired output #include <fstream> #include <boost/serialization/map.hpp> #include <boost/serialization/nvp.hpp> #include <boost/archive/xml_oarchive.hpp> #include <string> #include <iostream> #include <map> using namespace std; class MyConnections { public: MyConnections() { e_group.insert( std::make_pair(1,"ETOTO") ) ; e_group.insert( std::make_pair(2,"ETOTO") ) ; }

Boost.Spirit mini_xml2.cpp example could not be compiled by C++11, Boost 1.55

╄→尐↘猪︶ㄣ 提交于 2019-11-28 14:00:41
c++0x compiler fails to compile boost.spirit example mini_xml2.cpp (and no errors from not c++0x compiler) $> c++ -std=c++0x mini_xml2.cpp (errors) $> c++ mini_xml2.cpp (no errors) The error log is placed here . I suspect that problem is related to nonterminal attributes (lines 159-163), but I could be wrong. c++ version (Ubuntu / Linaro 4.8.1-10ubuntu9) 4.8.1 Boost version 1.55 I've created issue at the boost tracker, but have no answer. Does anybody have the same errors? Solved : I found a solution here . // Add this macro #define BOOST_SPIRIT_USE_PHOENIX_V3 As indicated, on modern compilers

boost::spirit::qi permutation parser and synthesized attributes

僤鯓⒐⒋嵵緔 提交于 2019-11-28 12:53:05
I'm trying to put together a simple command line parser with SPIRIT without semantic actions. I'm using BOOST 1.52 but I would like to avoid using C++11 features. The grammar has the following syntax: [-p num1] [-j] [--jobs num2] str1 str2 Optional parameters can be in any order. I successfully parsed only optional parameters. Once I add the additional mandatory two string parsers it breaks. It breaks even when I try to write down the "rstart" attributes explicitly and avoid type deduction using "auto". Any help or suggestion is very appreciated! #include <iostream> #include <string> #include