Fixed issue with different result types in Clara

This commit is contained in:
Phil Nash 2017-06-13 08:29:56 +01:00
parent c41a45e79c
commit e62b3beef4

View File

@ -870,16 +870,16 @@ namespace detail {
using ParserRefImpl::ParserRefImpl; using ParserRefImpl::ParserRefImpl;
auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {
auto result = validate(); auto validationResult = validate();
if (!result) if (!validationResult)
return InternalParseResult(result); return InternalParseResult(validationResult);
auto remainingTokens = tokens; auto remainingTokens = tokens;
auto const &token = *remainingTokens; auto const &token = *remainingTokens;
if (token.type != TokenType::Argument) if (token.type != TokenType::Argument)
return InternalParseResult::ok(ParseState(ParseResultType::NoMatch, remainingTokens)); return InternalParseResult::ok(ParseState(ParseResultType::NoMatch, remainingTokens));
result = m_ref->setValue(remainingTokens->token); auto result = m_ref->setValue(remainingTokens->token);
if (!result) if (!result)
return InternalParseResult(result); return InternalParseResult(result);
else else