(disclaimer, I am learning boost spirit)
I am trying to parse an expression like this: F( 1 )
and want to get the 1 as a string ("1" instead of a number (which works with qi::int_)).
I tried something like this (which is wrong, but maybe I am in the right direction), but the resulting string is "\x1" instead of just "1"
Any insight as to what is needed to parse a number into a string?
template <typename Iterator>
struct range_parser : boost::spirit::qi::grammar<Iterator, RangeResult(), iso8859_1::space_type>
{
range_parser() : range_parser::base_type(start)
{
using qi::lexeme;
using qi::int_;
using iso8859_1::digit;
number_as_string %= lexeme[ +(int_) ];
start %=
qi::lit("F")
>> '('
>> number_as_string
>> ")"
;
}
qi::rule<Iterator, std::wstring(), iso8859_1::space_type> number_as_string;
qi::rule<Iterator, RangeResult(), iso8859_1::space_type> start;
};