MCPcopy Create free account
hub / github.com/bfgroup/Lyra / parse

Method parse

include/lyra/cli.hpp:330–350  ·  view source on GitHub ↗

tag::reference[] [#lyra_cli_parse] === `lyra::cli::parse` [source] ---- parse_result cli::parse( args const& args, const option_style& customize) const; ---- Parses given arguments `args` and optional option style. The result indicates success or failure, and if failure what kind of failure it was. The state of variables bound to options is unspecified and any bound callbacks may have been call

Source from the content-addressed store, hash-verified

328
329end::reference[] */
330inline parse_result cli::parse(
331 args const & args, const option_style & style) const
332{
333 LYRA_PRINT_SCOPE("cli::parse");
334 m_exeName.set(args.exe_name());
335 detail::token_iterator args_tokens(args, style);
336 parse_result p_result = parse(args_tokens, style);
337 if (p_result
338 && (p_result.value().type() == parser_result_type::no_match
339 || p_result.value().type() == parser_result_type::matched
340 || p_result.value().type() == parser_result_type::empty_match))
341 {
342 if (p_result.value().have_tokens())
343 {
344 return parse_result::error(p_result.value(),
345 "Unrecognized token: "
346 + p_result.value().remainingTokens().argument().name);
347 }
348 }
349 return p_result;
350}
351
352/* tag::reference[]
353[#lyra_cli_style]

Callers 15

mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
test_valFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 7

setMethod · 0.45
exe_nameMethod · 0.45
typeMethod · 0.45
valueMethod · 0.45
have_tokensMethod · 0.45
argumentMethod · 0.45
remainingTokensMethod · 0.45

Tested by 15

mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
test_valFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36