Minor refactoring.

This commit is contained in:
Patrick Lühne 2017-08-31 19:04:10 +02:00
parent 0a104d222c
commit 1dee4655a7
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -21,17 +21,13 @@ std::experimental::optional<ast::Term> parseTerm(Context &context, ASTContext &a
tokenizer.skipWhiteSpace();
// TODO: refactor
auto variable = parseVariable(context, variableStack);
std::experimental::optional<ast::Term> term;
if (variable)
return std::move(variable.value());
// Parse argument if it is a constant
auto constant = parseConstant(context, astContext);
if (constant)
return std::move(constant.value());
if ((term = parseVariable(context, variableStack))
|| (term = parseConstant(context, astContext)))
{
return std::move(term.value());
}
return std::experimental::nullopt;
}