diff options
Diffstat (limited to 'bdep/new-parsers.cxx')
-rw-r--r-- | bdep/new-parsers.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bdep/new-parsers.cxx b/bdep/new-parsers.cxx index d5b8e6e..effa2a7 100644 --- a/bdep/new-parsers.cxx +++ b/bdep/new-parsers.cxx @@ -12,6 +12,7 @@ namespace bdep { using type = cmd_new_type; using lang = cmd_new_lang; + using vcs = cmd_new_vcs; // Parse comma-separated list of of options starting from the first comma // at pos. @@ -110,5 +111,33 @@ namespace bdep xs = true; } + + void parser<vcs>:: + parse (vcs& r, bool& xs, scanner& s) + { + const char* o (s.next ()); + + if (!s.more ()) + throw missing_value (o); + + string v (s.next ()); + size_t i (v.find (',')); + string l (v, 0, i); + + if (l == "git") + { + r.vcs = vcs::git; + r.git_opt = parse_options<cmd_new_git_options> (o, v, i); + } + else if (l == "none") + { + r.vcs = vcs::none; + r.none_opt = parse_options<cmd_new_none_options> (o, v, i); + } + else + throw invalid_value (o, l); + + xs = true; + } } } |