From 840f2fae3995a3e263801ad07d1285d35ddd9485 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 2 Jun 2010 19:00:38 +0200 Subject: Update description of the --options-file option --- cli/options.cxx | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'cli/options.cxx') diff --git a/cli/options.cxx b/cli/options.cxx index a079f9e..3f3c1b9 100644 --- a/cli/options.cxx +++ b/cli/options.cxx @@ -125,6 +125,25 @@ namespace cli return "unable to open file or read failure"; } + // unmatched_quote + // + unmatched_quote:: + ~unmatched_quote () throw () + { + } + + void unmatched_quote:: + print (std::ostream& os) const + { + os << "unmatched quote in argument '" << argument () << "'"; + } + + const char* unmatched_quote:: + what () const throw () + { + return "unmatched quote"; + } + // scanner // scanner:: @@ -329,6 +348,18 @@ namespace cli string s2 (line, p); + // If the string is wrapped in quotes, remove them. + // + n = s2.size (); + + if (s2[0] == '"' || s2[n - 1] == '"') + { + if (n == 1 || s2[0] != s2[n - 1]) + throw unmatched_quote (s2); + + s2 = string (s2, 1, n - 2); + } + if (!skip_ && s1 == option_) load (s2.c_str ()); else @@ -468,11 +499,11 @@ namespace cli } }; - template + template void thunk (X& x, scanner& s) { - parser::parse (x.*P, s); + parser::parse (x.*M, s); } } -- cgit v1.1