Requiring goal to contain only one statement.

Previously, the parser read the first statement of the goal as its
precondition, but didn’t check that it was properly terminated with a
closing parenthesis. This allowed arbitrary text to be included within
the goal description without error, which was incorrect.

This commit fixes this issue and adds a corresponding unit test.
This commit is contained in:
2017-11-15 15:52:10 +01:00
parent a1a80332ca
commit 010e7bf41e
3 changed files with 25 additions and 0 deletions

View File

@@ -283,6 +283,7 @@ void ProblemParser::parseGoalSection(ast::Problem &problem)
VariableStack variableStack;
problem.goal = parsePrecondition(m_context, astContext, variableStack);
tokenizer.expect<std::string>(")");
skipSection(tokenizer);
}