latereasoning.cpp
No OneTemporary

File Metadata

Created
Sat, Nov 21, 2:14 AM

latereasoning.cpp

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Author: pgess <v.melnychenko@xreate.org>
* Created on June 7, 2018, 6:01 PM
*
* \file latereasoning.cpp
* \brief Late reasoninf support
*/
#include "aux/latereasoning.h"
#include "ast.h"
namespace xreate {namespace latereasoning {
boost::optional<Gringo::Symbol>
LateAnnotation::select(const std::list<Expression>& keys) const {
for(const auto& entry : guardedSymbols) {
const std::list<Expression>& keysExpected = entry.first;
auto keysIt = keys.begin();
bool result = true;
for(const Expression& keyExpected : keysExpected) {
if(!(keyExpected == *keysIt)) {
result = false;
break;
}
++keysIt;
}
if(!result) continue;
return entry.second;
}
return boost::none;
}
}}

Event Timeline