|
Boost Users : |
From: joshwaxman (JoshWaxman_at_[hidden])
Date: 2003-06-23 14:52:23
Hi.
I just started playing with spirit and tried the following code to
match palindromes of strings consisting of a's and b's. Why won't
this work? (It prints 0, not 1)
#include "boost/spirit/core.hpp"
#include <iostream.h>
using namespace boost::spirit;
int main(int argc, char* argv[])
{
rule <> S;
S = ch_p('a')
| ch_p('b')
| epsilon_p
| ('a' >> S >> 'a')
| ('b' >> S >> 'b');
char * str = "aabaa";
cout << parse(str, S).full;
return 0;
}
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