Michael Caisse | 9 Feb 20:36

Re: Parsing escaped strings

Steffen Rauh wrote:
> Hi all,
>   
> I am trying to parse escaped strings (backslash as escape char) with spirit 2.2. I do not want spirit to
unescape the strings itself but to simply provide the complete string to the attached action (I have my own
code to unescape those strings afterwards).
>
> The code at the end shows how I try to do it. With line #2 active, the code compiles and fails with parsing the
provided string as expected. With line #1 active, compilation fails with a message that value_type
cannot be converted to std::basic_string (\spirit\home\support\attributes.hpp(409)). Is there
something I got wrong with the attributes?
>   

Yes. StringChar has a synthesized attribute as char and Escapped has
one of string. The result is therefore a variant or char or string.

Also... if this is what you want, why break out the escape character at
all? If you are doing something with it later anyhow I don't see why
you are trying to detect it in the parse.

michael

--

-- 

----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev

Gmane