Boost logo

Boost Users :

From: jwwillcox2003 (jwwillcox2003_at_[hidden])
Date: 2003-08-18 12:50:17


struct usmtf : public grammar<usmtf>
{
    template <typename ScannerT>

    struct definition
    {
        definition(usmtf const& self)
        {
            message = mainText;

            exerciseSet = !eol_p >> str_p("EXER")[do_print("EXER")]
>> ch_p('/') >> *(field >> ch_p('/')) >> ch_p('/');
            messageIdentifierSet = str_p("MSGID")[do_print("MSGID")]
>> ch_p('/') >> *(field >> ch_p('/')) >> ch_p('/');

            field =
                lexeme_d
                [
                    +(upper_p - ch_p('/') - eol_p)
                ];

            mainText = exerciseSet >> eol_p >> messageIdentifierSet
>> end_p;
        };
    
        rule<ScannerT> message, mainText,
             exerciseSet, messageIdentifierSet, field;

        rule<ScannerT> const& start() const { return message; }
    };
};

Using this grammar above, it will parse
EXER/EE/FF//MSGID//
using
   mainText = exerciseSet >> messageIdentifierSet >> end_p;

However, I want it to parse
EXER/EE/FF//
MSGID//

and
    mainText = exerciseSet >> eol_p >> messageIdentifierSet >> end_p;
does not work. Why? How do I parse what I want?


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