[xpressive] Compiler error; seems like normal usage?

My regex is as follows: sregex re = "Content-Disposition:" >> +_s >> (s1=!"inline;") >> -*_ >> "size=" >> (s2=+_d) >> ';' ; This seems to be the part causing the compiler errors: (s1=!"inline;") When I change it to this: !(s1="inline;") It compiles just fine. I'm on VS2008 SP1. Anyone know why the former usage does not work? I still want the group to capture an empty string if the string "inline;" does not match, which is why I put the ! inside the capture group. Does this matter? --------- Robert Dailey

Try wrapping "inline;" in as_xpr(). xpressive does not (and cannot) overload the ! operator for string literals because operators cannot be overloaded for built-in types.

Thanks; I thought this only applied to the start of the root of the expression, but I kind of got lost in the complexity of the DSL and forgot the language interference :P --------- Robert Dailey On Tue, Mar 13, 2012 at 11:45 AM, Nathan Ridge <zeratul976@hotmail.com>wrote:
Try wrapping "inline;" in as_xpr(). xpressive does not (and cannot) overload the ! operator for string literals because operators cannot be overloaded for built-in types.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On Tue, Mar 13, 2012 at 11:37:02AM -0500, Robert Dailey wrote:
My regex is as follows: sregex re = "Content-Disposition:" >> +_s >> (s1=!"inline;") >> -*_ >> "size=" >> (s2=+_d) >> ';' ;
This seems to be the part causing the compiler errors: (s1=!"inline;")
When I change it to this: !(s1="inline;")
Negating a string literal coerces it to a false boolean. The underlying language is still C++ with all its rules, no matter how cute you try to make the DSL you glue on top.
It compiles just fine. I'm on VS2008 SP1.
Anyone know why the former usage does not work? I still want the group to capture an empty string if the string "inline;" does not match, which is why I put the ! inside the capture group. Does this matter?
-- Lars Viklund | zao@acc.umu.se
participants (3)
-
Lars Viklund
-
Nathan Ridge
-
Robert Dailey