parser icon indicating copy to clipboard operation
parser copied to clipboard

Single parser error handler

Open asolwa opened this issue 7 months ago • 0 comments

When a single, primitive parser is used, the error stream remains empty, even if an error occurs. In the example below, 'oss' is empty, but it should have an error message, shouldn't it?

#include <boost/parser/parser.hpp>

int main()
{
    using namespace boost::parser;

    constexpr auto parser = string("test");
    {
        char const * str = "abz";
        std::ostringstream oss;
        stream_error_handler eh("simple_parser.cpp", oss);
        auto result = parse(str, with_error_handler(parser, eh));
        std::cout << oss.str();
    }
}

asolwa avatar Jul 01 '24 15:07 asolwa