|
Boost Users : |
Subject: [Boost-users] [Spirit] Problem while parsing a quoted string
From: Sven Steckmann (spm_boost_at_[hidden])
Date: 2011-06-25 16:43:49
Dear list,
at the moment I am writing a grammar description in which I want to used
quoted string. Up to now I hardcoded the quotes to '"', but now, I want to
enable this rule working with a parameter. Maybe I am missing somethin, I
hope one can give me good hint:
This is the rule definition (for parsing QStrings, I took the code from the
example):
quotedQString %= lexeme[lit(_r1) >> +(char_ - lit(_r1)) >> lit(_r1)];
qi::rule quotedQString;
I am uisng the quotedQString as follows:
nextRule = quotedQString('"') [ anAction(_var,_1)];
This does not work as expected, if I parse a string looking like this
"String" I always got the quotes included. My old version:
quotedQString %= lexeme[lit('"') >> +(char_ - lit('"')) >> lit('"')];
works quite as expected and parses everything without quotes.
Kind regards,
Sven Steckmann
--
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net