From 4cd45298f257750d0715a076678f2f1bfb652314 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 15 Mar 2019 22:48:25 +0300 Subject: Merge bdep-new parameter-specific options --- bdep/new-parsers.cxx | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'bdep/new-parsers.cxx') diff --git a/bdep/new-parsers.cxx b/bdep/new-parsers.cxx index f8a8c75..7a12132 100644 --- a/bdep/new-parsers.cxx +++ b/bdep/new-parsers.cxx @@ -15,11 +15,11 @@ namespace bdep using vcs = cmd_new_vcs; // Parse comma-separated list of of options starting from the first comma - // at pos. + // at pos, merging them with options parsed previously. // template - static O - parse_options (const char* o, const string v, size_t pos) + static void + parse_options (const char* o, const string v, size_t pos, O& r) { // Use vector_scanner to parse the comma-separated list of // parameter-specific options. Make sure that option values are only @@ -73,10 +73,7 @@ namespace bdep } vector_scanner s (os); - - O r; r.parse (s); - return r; } void parser:: @@ -94,22 +91,22 @@ namespace bdep if (l == "exe") { r.type = type::exe; - r.exe_opt = parse_options (o, v, i); + parse_options (o, v, i, r.exe_opt); } else if (l == "lib") { r.type = type::lib; - r.lib_opt = parse_options (o, v, i); + parse_options (o, v, i, r.lib_opt); } else if (l == "bare") { r.type = type::bare; - r.bare_opt = parse_options (o, v, i); + parse_options (o, v, i, r.bare_opt); } else if (l == "empty") { r.type = type::empty; - r.empty_opt = parse_options (o, v, i); + parse_options (o, v, i, r.empty_opt); } else throw invalid_value (o, l); @@ -132,12 +129,12 @@ namespace bdep if (l == "c") { r.lang = lang::c; - r.c_opt = parse_options (o, v, i); + parse_options (o, v, i, r.c_opt); } else if (l == "c++") { r.lang = lang::cxx; - r.cxx_opt = parse_options (o, v, i); + parse_options (o, v, i, r.cxx_opt); } else throw invalid_value (o, l); @@ -160,12 +157,12 @@ namespace bdep if (l == "git") { r.vcs = vcs::git; - r.git_opt = parse_options (o, v, i); + parse_options (o, v, i, r.git_opt); } else if (l == "none") { r.vcs = vcs::none; - r.none_opt = parse_options (o, v, i); + parse_options (o, v, i, r.none_opt); } else throw invalid_value (o, l); -- cgit v1.1