Removed unneeded constant parsing functions.
This commit is contained in:
parent
80167fd21b
commit
0a104d222c
@ -16,8 +16,7 @@ namespace detail
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
std::experimental::optional<ast::ConstantPointer> testParsingConstant(Context &context, ASTContext &astContext);
|
std::experimental::optional<ast::ConstantPointer> parseConstant(Context &context, ASTContext &astContext);
|
||||||
ast::ConstantPointer parseConstant(Context &context, ASTContext &astContext);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ std::experimental::optional<ast::ConstantPointer> findConstant(const std::string
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
std::experimental::optional<ast::ConstantPointer> testParsingConstant(Context &context, ASTContext &astContext)
|
std::experimental::optional<ast::ConstantPointer> parseConstant(Context &context, ASTContext &astContext)
|
||||||
{
|
{
|
||||||
auto &tokenizer = context.tokenizer;
|
auto &tokenizer = context.tokenizer;
|
||||||
|
|
||||||
@ -65,20 +65,5 @@ std::experimental::optional<ast::ConstantPointer> testParsingConstant(Context &c
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ast::ConstantPointer parseConstant(Context &context, ASTContext &astContext)
|
|
||||||
{
|
|
||||||
auto &tokenizer = context.tokenizer;
|
|
||||||
|
|
||||||
const auto constantName = tokenizer.getIdentifier();
|
|
||||||
auto constant = findConstant(constantName, astContext);
|
|
||||||
|
|
||||||
if (!constant)
|
|
||||||
throw ParserException(tokenizer.location(), "undeclared constant “" + constantName + "”");
|
|
||||||
|
|
||||||
return std::move(constant.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ std::experimental::optional<ast::Term> parseTerm(Context &context, ASTContext &a
|
|||||||
return std::move(variable.value());
|
return std::move(variable.value());
|
||||||
|
|
||||||
// Parse argument if it is a constant
|
// Parse argument if it is a constant
|
||||||
auto constant = testParsingConstant(context, astContext);
|
auto constant = parseConstant(context, astContext);
|
||||||
|
|
||||||
if (constant)
|
if (constant)
|
||||||
return std::move(constant.value());
|
return std::move(constant.value());
|
||||||
|
Reference in New Issue
Block a user