While I accept the rationale in https://github.com/tzlaine/parser/issues/54, I still expect that when I wrap a sequence of chars into a lexeme, I would get a string. Isn't "lexem" implying a one whole?
Feel free to close it, if you disagree with my reasoning. The following is an example demonstrating this.
#ifdef WITH_BOOST_SPIRIT
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
#include <boost/spirit/include/qi.hpp>
namespace bp = boost::spirit::qi;
#else
#include <boost/parser/parser.hpp>
namespace bp = boost::parser;
#endif
int main()
{
#ifdef WITH_BOOST_SPIRIT
auto alnum = bp::ascii::alnum;
auto alpha = bp::alpha;
#else
auto alnum = bp::ascii::alnum;
auto alpha = bp::ascii::alpha;
#endif
auto myParser = bp::lexeme[(bp::ascii::alnum | bp::char_('_')) >> bp::ascii::digit];
std::string input = "m1";
std::string result;
#ifdef WITH_BOOST_SPIRIT
auto begin = input.begin();
bool b = bp::phrase_parse(begin, input.end(), myParser, bp::ascii::space, result);
#else
auto b = bp::parse(input, myParser, bp::ws, result);
#endif
if (b)
std::cout << ":-) " << result << std::endl;
else
std::cout << ":-(" << std::endl;
}
While I accept the rationale in https://github.com/tzlaine/parser/issues/54, I still expect that when I wrap a sequence of
char
s into alexeme
, I would get astring
. Isn't "lexem" implying a one whole?Feel free to close it, if you disagree with my reasoning. The following is an example demonstrating this.