This commit is contained in:
2024-12-28 14:24:10 -06:00
parent 969215f3fa
commit 1b949772c2
2 changed files with 13 additions and 8 deletions

View File

@@ -46,9 +46,10 @@ auto ParseGrammar_(G const& grammar, std::istream & in) -> typename G::start_typ
return result;
}
template <typename P, typename R>
auto ParseSimple(std::istream& in, P p, R & result) -> void
template <typename R>
auto ParseSimple(std::istream& in, auto p) -> R
{
R result;
namespace qi = boost::spirit::qi;
auto const content = std::string{std::istreambuf_iterator{in}, {}};
qi::rule<std::string::const_iterator, R()> r { std::move(p) };
@@ -58,6 +59,7 @@ auto ParseSimple(std::istream& in, P p, R & result) -> void
if (!success || it != end) {
throw std::runtime_error("Parsing failed or input was not fully consumed.");
}
return result;
}
}