software/args.cxx
// Recursive descent parser that efficiently matches the current token from argv against
// the set of allowed arguments at the current parsing level, and returns their AST
// representation if matched, allowing the parser to build a neat tree of all
// the arguments for further use by the caller
Recursive descent parser that efficiently matches the current token from argv against
the set of allowed arguments at the current parsing level, and returns their AST
representation if matched, allowing the parser to build a neat tree of all
the arguments for further use by the caller
Recursive descent parser that efficiently matches the current token from argv against the set of allowed arguments at the current parsing level and returns their AST representation if matched allowing the parser to build a neat tree of all the arguments for further use by the caller
bool parseArguments(const size_t argCount, const char *const *const argList,
	const span_t<const option_t> options) try
{
	if (argCount < 1 || !argList)
		return false;
	tokenizer_t lexer{argCount - 1, argList + 1};
	const auto &token{lexer.token()};
	args = substrate::make_unique<argsTree_t>();
	while (token.valid())
	{
		if (!parseArgument(lexer, options, *args))
		{
			std::string argument{token.value()};
			console.warn("Found invalid token '"sv, argument, "' ("sv, 
				typeToName(token.type()), ") in arguments"sv); 
			return false;
		}
	}
	return true;
}
catch (std::exception &)
	{ return false; }
bool parseArguments ( const size_t argCount , const char * const * const argList , const span_t < const option_t > options ) try { if ( argCount < 1 || ! argList ) return false ; tokenizer_t lexer { argCount - 1 , argList + 1 } ; const auto & token { lexer . token ( ) } ; args = substrate :: make_unique < argsTree_t > ( ) ; while ( token . valid ( ) ) { if ( ! parseArgument ( lexer , options , * args ) ) { std :: string argument { token . value ( ) } ; console . warn ( " " sv , argument , " " sv , typeToName ( token . type ( ) ) , " " sv ) ; return false ; } } return true ; } catch ( std :: exception & ) { return false ; }
Recursive descent parser that efficiently matches the current token from argv against
the set of allowed arguments at the current parsing level, and returns their AST
representation if matched, allowing the parser to build a neat tree of all
the arguments for further use by the caller
Recursive descent parser that efficiently matches the current token from argv against the set of allowed arguments at the current parsing level and returns their AST representation if matched allowing the parser to build a neat tree of all the arguments for further use by the caller
// Skip the first argument (that's the name of the program) and start // tokenizing directly at the second. // NOLINT(readability-magic-numbers) // NOLINT(readability-magic-numbers)