Boost logo

Boost Users :

Subject: Re: [Boost-users] [xpressive] assert while matching file contents.
From: Eric Niebler (eric_at_[hidden])
Date: 2008-09-24 17:59:46


Raindog wrote:
> Hello,
>
> I have the following regex:
>
> sregex sig_re = "@rem {" >>(sig_= -*_)>> "}, " >> (vbp_= -*_) >> _ln;
>
> which I am trying to use to match the last line of the following string.
> The string is read in from a file.
>
> xcopy "foo" "foo3.bat" /Y
> xcopy "foo" "foo3.bat" /Y
> xcopy "foo" "foo3.bat" /Y
> xcopy "foo" "foo3.bat" /Y
> @rem c:\foo\somefile.txt files: 4
> @rem {0xffffffff, SOMETYPEDEF, ""}, //c:\foo\somefile.txt
>
> When I call:
>
> sregex_iterator cur(file_contents.begin(), file_contents.end(), sig_re);
>
> however, I get an assertion:
>
> Assertion failed: !s0.matched, file
> c:\code\boost-trunk\boost\xpressive\detail\core\matcher\end_matcher.hpp,
> line 37

I cannot reproduce your error. The following works (doesn't assert) for me:

     mark_tag sig_(1), vbp_(2);
     sregex sig_re = "@rem {" >>(sig_= -*_)>> "}, " >> (vbp_= -*_) >> _ln;

     std::string file_contents =
         "xcopy \"foo\" \"foo3.bat\" /Y\n"
         "xcopy \"foo\" \"foo3.bat\" /Y\n"
         "xcopy \"foo\" \"foo3.bat\" /Y\n"
         "xcopy \"foo\" \"foo3.bat\" /Y\n"
         "@rem c:\\foo\\somefile.txt files: 4\n"
         "@rem {0xffffffff, SOMETYPEDEF, \"\"}, //c:\\foo\\somefile.txt\n";

     sregex_iterator cur(file_contents.begin(), file_contents.end(),
sig_re);

Please post complete source that reproduces the problem. Thanks.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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