109 struct ConfigToIni : qi::grammar<Iterator, std::string(), Skipper>
113 ConfigToIni() : ConfigToIni::base_type(root_rule_,
"ConfigToIni")
115 namespace phx = boost::phoenix;
127 using boost::spirit::lexeme;
128 using boost::spirit::as_string;
130 root_rule_.name(
"ConfigToIni_root_rule");
132 root_rule_ = eps[_val =
""] >> *line_[_val = _val + _1+
"\n"] >> -last_line_[_val = _val + _1];
135 line_.name(
"line_of_settings_input");
136 line_ = (eps >> colon_ >> yes_eol_)[_val = lazy_to_lower_()(_1) +
"=" + _2];
138 last_line_.name(
"line_of_settings_input_with_no_eol");
139 last_line_ = (eps >> colon_ >> no_eol_)[_val = lazy_to_lower_()(_1) +
"=" + _2];
141 colon_.name(
"Set of characters with no : or eol");
142 colon_ = lexeme[*(char_ -
":") >> omit[
":"] ];
144 yes_eol_.name(
"Set of characters with eol");
145 yes_eol_ = lexeme[*(char_ - eol -
";") >> omit[-(char_(
';') >> *(char_ - eol) )] >> eol];
147 no_eol_.name(
"Set of characters with no eol");
148 no_eol_ = lexeme[*(char_ -
";") >> omit[-(char_(
';') >> *(char_ ) )]];
162 using phx::construct;
163 using namespace qi::labels;
164 qi::on_error<qi::fail>
167 val(
"config/input split parser could not complete parsing. Expecting ")<<
170 construct<std::string>(_3,_2)<<
176 qi::rule<Iterator, std::string(), ascii::space_type > root_rule_;
177 qi::rule<Iterator, ascii::space_type, std::string()> line_, last_line_, colon_, yes_eol_, no_eol_;