summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-02-11 08:26:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-02-11 08:26:59 +0200
commit21cc797ba5b0a1f357889946d7c15e101db80045 (patch)
treeca104003a990b4689c3a6bddb70d688eab07dcf7 /cli
parent96ff207be28274ae59aa67e941c7a6a261ae0c47 (diff)
Improve generic value parser (extract char)
Diffstat (limited to 'cli')
-rw-r--r--cli/runtime-source.cxx11
1 files 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