qi

Boost.Qi rule with skipper does not match '.' character

痞子三分冷 提交于 2021-02-19 23:09:33
问题 So I have the following qi skipper: template<typename Iterator> struct verilog_skipper : public qi::grammar<Iterator> { verilog_skipper() : verilog_skipper::base_type(skip) { namespace phx = boost::phoenix; skip = qi::ascii::space | qi::eol | line_comment; line_comment = (qi::lit("//") >> *(qi::char_ - qi::eol) >> *(qi::eol)); } qi::rule<Iterator> skip; qi::rule<Iterator> line_comment; }; and the following qi grammar: template <typename Iterator, typename Skipper = verilog_skipper<Iterator>

Boost.Qi rule with skipper does not match '.' character

Deadly 提交于 2021-02-19 23:06:59
问题 So I have the following qi skipper: template<typename Iterator> struct verilog_skipper : public qi::grammar<Iterator> { verilog_skipper() : verilog_skipper::base_type(skip) { namespace phx = boost::phoenix; skip = qi::ascii::space | qi::eol | line_comment; line_comment = (qi::lit("//") >> *(qi::char_ - qi::eol) >> *(qi::eol)); } qi::rule<Iterator> skip; qi::rule<Iterator> line_comment; }; and the following qi grammar: template <typename Iterator, typename Skipper = verilog_skipper<Iterator>

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::qi::parse grammar not working as expected

早过忘川 提交于 2020-01-06 01:24:45
问题 I try to write a grammar to parse the following syntax: // - command // - command value0 ... valueN // - command -arg0 ... -argN // - command -arg0 value0 ... valueN ... -argN value0 ... valueN Each element shall be interpreted as a string Within a string all symbols are allowed Between command, argument and value multiple blanks shall be allowed An argument starts always with '-' The results shall be stored in a struct: struct Data { std::string m_command; std::map< std::string, std::vector<

boost::spirit::qi::parse grammar not working as expected

丶灬走出姿态 提交于 2020-01-06 01:24:22
问题 I try to write a grammar to parse the following syntax: // - command // - command value0 ... valueN // - command -arg0 ... -argN // - command -arg0 value0 ... valueN ... -argN value0 ... valueN Each element shall be interpreted as a string Within a string all symbols are allowed Between command, argument and value multiple blanks shall be allowed An argument starts always with '-' The results shall be stored in a struct: struct Data { std::string m_command; std::map< std::string, std::vector<

Spirit Qi : rule for char [5]

不问归期 提交于 2019-12-21 23:24:01
问题 I have the following structure struct MyStruct { char CODE; char NAME[5]; }; I make it a fusion struct BOOST_FUSION_ADAPT_STRUCT ( MyStruct, (char, MARKET_CODE) (char, NAME[5]) ) My grammar is implemented as follow: MyStruct_parser() : ticker_parser::base_type(start) { using qi::lexeme; using ascii::char_; a_word %= lexeme[+(char_)]; start %= a_word >> a_word; } qi::rule<Iterator, std::string(), ascii::space_type> quoted_string; qi::rule<Iterator, Ticker(), ascii::space_type> start;

How to extract trimmed text using Boost Spirit?

元气小坏坏 提交于 2019-12-11 01:31:27
问题 Using boost spirit, I'd like to extract a string that is followed by some data in parentheses. The relevant string is separated by a space from the opening parenthesis. Unfortunately, the string itself may contain spaces. I'm looking for a concise solution that returns the string without a trailing space. The following code illustrates the problem: #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix_operator.hpp> #include <string> #include <iostream> namespace qi =

Spirit Qi : rule for char [5]

懵懂的女人 提交于 2019-12-04 19:05:36
I have the following structure struct MyStruct { char CODE; char NAME[5]; }; I make it a fusion struct BOOST_FUSION_ADAPT_STRUCT ( MyStruct, (char, MARKET_CODE) (char, NAME[5]) ) My grammar is implemented as follow: MyStruct_parser() : ticker_parser::base_type(start) { using qi::lexeme; using ascii::char_; a_word %= lexeme[+(char_)]; start %= a_word >> a_word; } qi::rule<Iterator, std::string(), ascii::space_type> quoted_string; qi::rule<Iterator, Ticker(), ascii::space_type> start; Unfortunately it does not compile. Now I use std::string instead of char[5] I have no problem. Can you please