Boost logo

Boost Users :

Subject: [Boost-users] [Boost][spirit] Confused about spaces!
From: Germán Diago (germandiago_at_[hidden])
Date: 2011-06-03 12:32:27


Hello. I'm trying to implement a very basic parser but I'm stuck at
the beginning of it.

The parser will be fed with input from a very basic minilanguage to
execute tests.

I want that the first line begins literally like this:

begin TestActions

But with my current implementation I can't:

template <class FwdIterator>
struct TestFileParser : qi::grammar<FwdIterator, Test (),
qi::ascii::space_type> {

        TestFileParser() : TestFileParser::base_type(start_) {
                using namespace boost::spirit::qi;

                start_ = lit("begin") >> lit("TestActions");
        
        }

        qi::rule<FwdIterator, Test (), qi::ascii::space_type> start_;
};

Because this implementation matches "beginTestActions" as well. And I
want them to be
different words. If I put a space between them, my rule complains
because its attribute
must be a Test(). And if I put in the middel a ' ' it doesn't work
anymore. What's wrong with spaces?
I'm using phrase_parse with qi::ascii::space skipper. Thanks in advance.


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