parse iterator going past end()

Dan Bloomquist via Spirit-general <[email protected]> Sat, 25 Apr 2020 12:40:05 -0700
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
Hi,
I don't know if it is just because I'm a bit sloppy here or if this is 
something that needs fixing. I would think that no matter what you throw 
at a parser, it should not iterate past the end marker. Here I would 
just look for a failed parse and move to a next possible or log it as 
failed.

Here is a simple example that does it. It happens in 'seek'.
Best, Dan.

#include <iostream>
#include <boost/spirit/home/x3.hpp>
#include <boost/fusion/include/adapt_struct.hpp>

struct test_st {
     std::string a;
     std::string b;
};
BOOST_FUSION_ADAPT_STRUCT(test_st, a, b)

const char* data = R"(+OK 1199 octets
Return-Path: <[email protected]>
To: [email protected]
From: Dan Bloomquist <[email protected]>
Subject: test
)";

int main()
{
     test_st st;
     using namespace boost::spirit::x3;
     std::string input{data};
     auto begin(input.begin());
     auto mail_header = seek["Submitter: "] >> *(char_ - "To:") >> 
seek["Date:"] >> lexeme[*(char_ - eol)];
     phrase_parse(begin, input.end(), mail_header, space, st);

     std::cout << begin << std::endl;
}



_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general