From 060bb0b8ca44affa817600f21caa33cf54d5ecad Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 3 Aug 2021 15:02:35 +0200 Subject: Regenerate options parsing files --- libbutl/builtin-options.cxx | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'libbutl/builtin-options.cxx') diff --git a/libbutl/builtin-options.cxx b/libbutl/builtin-options.cxx index 536f97d..5a243e5 100644 --- a/libbutl/builtin-options.cxx +++ b/libbutl/builtin-options.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -158,6 +159,7 @@ namespace butl else ++i_; + ++start_position_; return r; } else @@ -168,11 +170,20 @@ namespace butl skip () { if (i_ < argc_) + { ++i_; + ++start_position_; + } else throw eos_reached (); } + std::size_t argv_scanner:: + position () + { + return start_position_; + } + // vector_scanner // bool vector_scanner:: @@ -208,6 +219,12 @@ namespace butl throw eos_reached (); } + std::size_t vector_scanner:: + position () + { + return start_position_ + i_; + } + template struct parser { @@ -260,6 +277,17 @@ namespace butl }; template + struct parser > + { + static void + parse (std::pair& x, bool& xs, scanner& s) + { + x.second = s.position (); + parser::parse (x.first, xs, s); + } + }; + + template struct parser > { static void @@ -297,6 +325,7 @@ namespace butl if (s.more ()) { + std::size_t pos (s.position ()); std::string ov (s.next ()); std::string::size_type p = ov.find ('='); @@ -316,14 +345,14 @@ namespace butl if (!kstr.empty ()) { av[1] = const_cast (kstr.c_str ()); - argv_scanner s (0, ac, av); + argv_scanner s (0, ac, av, false, pos); parser::parse (k, dummy, s); } if (!vstr.empty ()) { av[1] = const_cast (vstr.c_str ()); - argv_scanner s (0, ac, av); + argv_scanner s (0, ac, av, false, pos); parser::parse (v, dummy, s); } -- cgit v1.1