diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-06-02 19:00:38 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-06-02 19:00:38 +0200 |
commit | 840f2fae3995a3e263801ad07d1285d35ddd9485 (patch) | |
tree | afbc65a206b3b45c25cb2afb3fc18040ba6b02c5 /cli/options.cxx | |
parent | 5653d0317e60cea2fb9bb2eed464cb6f024879cb (diff) |
Update description of the --options-file option
Diffstat (limited to 'cli/options.cxx')
-rw-r--r-- | cli/options.cxx | 35 |
1 files changed, 33 insertions, 2 deletions
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 <typename X, typename T, T X::*P> + template <typename X, typename T, T X::*M> void thunk (X& x, scanner& s) { - parser<T>::parse (x.*P, s); + parser<T>::parse (x.*M, s); } } |