mirror of
https://github.com/boostorg/parser.git
synced 2026-01-19 16:32:13 +00:00
34 lines
836 B
C++
34 lines
836 B
C++
// Copyright (C) 2020 T. Zachary Laine
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0. (See
|
|
// accompanying file LICENSE_1_0.txt or copy at
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
//[ trivial_skipper_example
|
|
#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::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";
|
|
}
|
|
}
|
|
//]
|