Boost logo

Boost Users :

Subject: [Boost-users] [xpressive] assert while matching file contents.
From: Raindog (raindog_at_[hidden])
Date: 2008-09-24 00:22:53


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

Originally I had wanted to match the varying parts of the above file but
I kept getting the above assertion, so I decided to take the easy way
and just match the last line of the file, but still got the assertion.
My original regex was this:

    mark_tag file_(0), vbp_(1), sig_(2);
    sregex files_re = "xcopy" >> *_ >> "/Y" >> _n;
    sregex vbp_re = "@rem " >> -*_ >> " files: " >> repeat<1, 4>(_d) >> _ln;
    sregex sig_re = "@rem {" >> -*_>> "}, " >> -*_ >> _ln;
    sregex file_re =
        (file_=(files_re)) >>
        (vbp_=(vbp_re)) >>
        (sig_=(sig_re));

But that failed. Which leads me to my second question, with the above
file, I would like an xpressive regex that will match the 3 portions of
the file so that I have:

a. An array of sub_match containing the following 4 strings
    xcopy "foo" "foo3.bat" /Y
    xcopy "foo" "foo3.bat" /Y
    xcopy "foo" "foo3.bat" /Y
    xcopy "foo" "foo3.bat" /Y

b. A sub_match with the following string:

    @rem c:\foo\somefile.txt files: 4

c. A sub_match with the following string:

    @rem {0xffffffff, SOMETYPEDEF, ""}, //c:\foo\somefile.txt

Thanks for the help.
Josh


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