libboost-parser

[full]

A parser combinator library

This is a parser combinator library for C++. As a quick example of use, here is a complete program that parses one or more doubles separated by commas, ignoring whitespace:

#include <boost/parser/parser.hpp>

#include <iostream>
#include <string>


namespace bp = boost::parser;

int main()
{
    std::cout << "Enter a list of doubles, separated by commas.  No pressure. ";
    std::string input;
    std::getline(std::cin, input);

    auto const result = bp::parse(
        input, bp::double_ >> *(',' >> bp::double_), bp::ws);

    if (result) {
        std::cout << "Great! It looks like you entered:\n";
        for (double x : *result) {
            std::cout << x << "\n";
        }
    } else {
        std::cout
            << "Good job!  Please proceed to the recovery annex for cake.\n";
    }
}
... More
license BSL-1.0
project boost
url github.com/boostorg/parser
doc-url www.boost.org/doc/libs/1_87_0/libs/parser
topics C++Boost
1 Version
version 1.87.0
repository https://pkg.cppget.org/1/stable
depends 4; libboost-assert, libboost-charconv, libboost-hana, libboost-type-index
reviews +1