patrick
/
plasp
Archived
1
0
Fork 0

Correctly parsing quantified expressions thanks to variable stack.

This commit is contained in:
Patrick Lühne 2016-09-06 17:36:51 +02:00
parent eb28ed3938
commit faa920e1ad
1 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#include <plasp/pddl/Context.h>
#include <plasp/pddl/Expression.h>
#include <plasp/pddl/ExpressionContext.h>
#include <plasp/pddl/expressions/Variable.h>
namespace plasp
@ -65,9 +66,15 @@ boost::intrusive_ptr<Derived> Quantified<Derived>::parse(Context &context,
Variable::parseTypedDeclarations(context, expressionContext, expression->m_variables);
parser.expect<std::string>(")");
// Push newly parsed variables to the stack
expressionContext.variables.push(&expression->m_variables);
// Parse argument of the expression
expression->Quantified<Derived>::setArgument(parseExpression(context, expressionContext));
// Clean up variable stack
expressionContext.variables.pop();
parser.expect<std::string>(")");
return expression;