|
Boost : |
From: Bjørn Roald (bjorn_at_[hidden])
Date: 2006-01-05 18:35:52
On Thursday 05 January 2006 01:15, Eric Niebler wrote:
> Thanks for the code. I just tried it locally and it seems to work fine,
> so the bug is already fixed. The output I get is:
>
> namespace boost {
> gruble "grot}
> namespace boost {
> gruble "grot
> }
>
After CVS update I get same results :-)
> (Looks like you'll need to be smart about not matching braces that are
> in string literals.)
I use this for matching string literals:
sregex escaped_quote = as_xpr( '\\' ) >> '"';
sregex string_literal = as_xpr( '"' ) >> *( space |
escaped_quote |
-*_ ) >> '"';
seems to work, it will eat \" as part of string. I guess it should only eat
if there is an odd number of back-slashes prior to quote.
I tried:
sregex escaped_quote = as_xpr( '\\' ) >> '"';
sregex escaped_backslash = as_xpr( "\\\\" );
sregex string_literal = as_xpr( '"' ) >> *( space |
escaped_backslash |
escaped_quote |
-*_ ) >> '"';
But it did not work. What are the percidence rules for the sub-elements in
*( space |
escaped_backslash |
escaped_quote |
-*_ )
?
Next I try to combine that the literal string regexp into grammar so I don't
scan for braces within string literals.
Bjørn
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk