Fixed whitespace issues when parsing constants.

This commit is contained in:
Patrick Lühne 2016-06-09 18:26:04 +02:00
parent 3041b6a278
commit 730a9b7e63

View File

@ -94,9 +94,15 @@ void Constant::parseTypedDeclaration(Context &context, Domain &domain, Constants
void Constant::parseTypedDeclarations(Context &context, Domain &domain)
{
while (context.parser.currentCharacter() != ')')
auto &parser = context.parser;
while (parser.currentCharacter() != ')')
{
parseTypedDeclaration(context, domain);
parser.skipWhiteSpace();
}
if (domain.constants().empty())
return;
@ -108,16 +114,22 @@ void Constant::parseTypedDeclarations(Context &context, Domain &domain)
domain.checkRequirement(Requirement::Type::Typing);
// If no types are given, check that typing is not a requirement
else if (domain.hasRequirement(Requirement::Type::Typing))
throw utils::ParserException(context.parser, "Constant has undeclared type");
throw utils::ParserException(parser, "Constant has undeclared type");
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void Constant::parseTypedDeclarations(Context &context, Problem &problem)
{
auto &parser = context.parser;
while (context.parser.currentCharacter() != ')')
{
parseTypedDeclaration(context, problem);
parser.skipWhiteSpace();
}
if (problem.objects().empty())
return;