From 21cc797ba5b0a1f357889946d7c15e101db80045 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Feb 2016 08:26:59 +0200 Subject: Improve generic value parser (extract char) --- cli/runtime-source.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/runtime-source.cxx b/cli/runtime-source.cxx index cb0cde0..144eace 100644 --- a/cli/runtime-source.cxx +++ b/cli/runtime-source.cxx @@ -487,13 +487,16 @@ generate_runtime_source (context& ctx, bool complete) << "static void" << endl << "parse (X& x, " << (sp ? "bool& xs, " : "") << "scanner& s)" << "{" - << "std::string o (s.next ());" + << "using namespace std;" + << endl + << "string o (s.next ());" << endl << "if (s.more ())" << "{" - << "std::string v (s.next ());" - << "std::istringstream is (v);" - << "if (!(is >> x && is.eof ()))" << endl + << "string v (s.next ());" + << "istringstream is (v);" + << "if (!(is >> x && " << + "is.peek () == istringstream::traits_type::eof ()))" << endl << "throw invalid_value (o, v);" << "}" << "else" << endl -- cgit v1.1