I'd like the grammar below to parse input such as
a_end
a_b_end
a_b_c_end
but it only parses a_end
and fails on anything with more than one _
. Here is the grammar:
template < typename Iterator >
struct recursive_parser : qi::grammar< Iterator >
{
qi::rule< Iterator > start;
qi::rule< Iterator > end;
recursive_parser() : recursive_parser::base_type( start )
{
using namespace qi;
end = string("_end") | start;
start = +(char_ - '_') >> end;
}
};
Are rules not designed to be used recursively or am I missing something more obvious?