From f7573d6fba84c596e02d6aae9f1e4c0bdada823a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 3 Aug 2021 15:03:52 +0200 Subject: Regenerate options parsing files --- libbuild2/script/builtin-options.cxx | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'libbuild2/script/builtin-options.cxx') diff --git a/libbuild2/script/builtin-options.cxx b/libbuild2/script/builtin-options.cxx index c27f266..56e7f24 100644 --- a/libbuild2/script/builtin-options.cxx +++ b/libbuild2/script/builtin-options.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -160,6 +161,7 @@ namespace build2 else ++i_; + ++start_position_; return r; } else @@ -170,11 +172,20 @@ namespace build2 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:: @@ -210,6 +221,12 @@ namespace build2 throw eos_reached (); } + std::size_t vector_scanner:: + position () + { + return start_position_ + i_; + } + template struct parser { @@ -262,6 +279,17 @@ namespace build2 }; 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 @@ -299,6 +327,7 @@ namespace build2 if (s.more ()) { + std::size_t pos (s.position ()); std::string ov (s.next ()); std::string::size_type p = ov.find ('='); @@ -318,14 +347,14 @@ namespace build2 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