File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 33#include " lexy/action/parse.hpp"
44#include " lexy/callback.hpp"
55#include " lexy/dsl.hpp"
6- #include " lexy/input/string_input .hpp"
6+ #include " lexy/input/argv_input .hpp"
77#include " lexy_ext/report_error.hpp"
88
9- #include < numeric>
109#include < optional>
1110#include < iostream>
12- #include < string>
1311
1412struct Args
1513{
@@ -52,7 +50,7 @@ namespace dsl = lexy::dsl;
5250
5351struct production
5452{
55- static constexpr auto sep = dsl::newline ;
53+ static constexpr auto sep = dsl::argv_separator ;
5654
5755 struct help
5856 {
@@ -105,12 +103,7 @@ Args ParseArgs(int argc, char** argv)
105103{
106104 using namespace arg_parse_detail ;
107105
108- auto concat = [](std::string str, const char * arg) -> std::string {
109- return (std::move (str) + arg) + ' \n ' ;
110- };
111- auto str = std::accumulate (argv + 1 , argv + argc, std::string (), concat);
112-
113- auto input = lexy::string_input (str);
106+ auto input = lexy::argv_input (argc, argv);
114107 if (auto parsed = lexy::parse<production>(input, lexy_ext::report_error); parsed.has_value ()) {
115108 return parsed.value ();
116109 }
You can’t perform that action at this time.
0 commit comments