Finished implementing completion (unit tests to follow).

This commit is contained in:
2017-04-08 16:21:24 +02:00
parent a23e248e7b
commit a716da4af1
4 changed files with 261 additions and 22 deletions

41
include/anthem/ASTUtils.h Normal file
View File

@@ -0,0 +1,41 @@
#ifndef __ANTHEM__AST_UTILS_H
#define __ANTHEM__AST_UTILS_H
#include <anthem/AST.h>
namespace anthem
{
namespace ast
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// AST Utils
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class VariableStack
{
public:
using Layer = const std::vector<ast::Variable> *;
public:
void push(Layer layer);
void pop();
bool contains(const ast::Variable &variable) const;
private:
std::vector<Layer> m_layers;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
std::vector<ast::Variable> collectFreeVariables(const ast::Formula &formula, ast::VariableStack &variableStack);
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif