[spirit] qi::raw and skip parsers

Hi. I got unexpected results when I introduced qi::raw[] inside qi expressions. It seems that under certain circumstances qi::raw[] inhibits skip parser and thus fails to parse valid input. Furthermore, parse error only occurs if expression is stored in a rule - if expression is used directly as an argument to qi::parse everything works. Example attached. Is this a bug? If not - could someone kindly explain the rationale for this behavior. Best Regards, Juraj Ivančić

On 11/25/2010 7:19 PM, Juraj Ivančić wrote:
Hi.
I got unexpected results when I introduced qi::raw[] inside qi expressions. It seems that under certain circumstances qi::raw[] inhibits skip parser and thus fails to parse valid input. Furthermore, parse error only occurs if expression is stored in a rule - if expression is used directly as an argument to qi::parse everything works. Example attached.
Is this a bug? If not - could someone kindly explain the rationale for this behavior.
You need to give the rule the skip parser to use, otherwise it will inhibit skip parsing. try: qi::rule<std::string::const_iterator, std::string(), qi::space_type> rule( expr ); Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net

On 25.11.2010 12:50, Joel de Guzman wrote:
On 11/25/2010 7:19 PM, Juraj Ivančić wrote:
I got unexpected results when I introduced qi::raw[] inside qi expressions. It seems that under certain circumstances qi::raw[] inhibits skip parser and thus fails to parse valid input. Furthermore, parse error only occurs if expression is stored in a rule - if expression is used directly as an argument to qi::parse everything works. Example attached.
Is this a bug? If not - could someone kindly explain the rationale for this behavior.
You need to give the rule the skip parser to use, otherwise it will inhibit skip parsing. try:
qi::rule<std::string::const_iterator, std::string(), qi::space_type> rule( expr );
D'oh. Makes perfect sense. Thank you.
participants (2)
-
Joel de Guzman
-
Juraj Ivančić