souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
81 assert(directive &&
"NULL directive");
98 clauses = std::move(newClauses);
141 cur =
map(std::move(cur));
144 cur =
map(std::move(cur));
147 cur =
map(std::move(cur));
150 cur =
map(std::move(cur));
152 for (
auto& cur :
types) {
153 cur =
map(std::move(cur));
156 cur =
map(std::move(cur));
159 cur =
map(std::move(cur));
162 cur =
map(std::move(cur));
167 std::vector<const Node*> res;
168 for (
const auto& cur :
pragmas) {
169 res.push_back(cur.get());
172 res.push_back(cur.get());
175 res.push_back(cur.get());
178 res.push_back(cur.get());
180 for (
const auto& cur :
types) {
181 res.push_back(cur.get());
184 res.push_back(cur.get());
186 for (
const auto& cur :
clauses) {
187 res.push_back(cur.get());
190 res.push_back(cur.get());
196 void print(std::ostream& os)
const override {
197 auto show = [&](
auto&& xs,
char const* sep =
"\n") {
198 if (!xs.empty()) os <<
join(xs, sep) <<
"\n";
212 const auto& other =
static_cast<const Program&
>(node);
249 assert(component &&
"NULL component");
255 assert(instantiation &&
"NULL instantiation");
std::vector< Component * > getComponents() const
Return components.
bool equal(const Node &node) const override
Abstract equality check for two AST nodes.
std::vector< FunctorDeclaration * > getFunctorDeclarations() const
Return functor declarations.
VecOwn< Pragma > pragmas
Pragmas.
An abstract class for manipulating AST Nodes by substitution.
auto map(const std::vector< A > &xs, F &&f)
Applies a function to each element of a vector and returns the results.
VecOwn< Directive > directives
Directives.
Intermediate representation of a horn clause.
std::vector< Clause * > getClauses() const
Return clauses.
VecOwn< Relation > relations
Program relations.
VecOwn< Clause > clauses
Program clauses.
void addPragma(Own< Pragma > pragma)
void addComponent(Own< Component > component)
Add component.
bool removeRelationDecl(const QualifiedName &name)
Remove relation.
The program class consists of relations, clauses and types.
void setClauses(VecOwn< Clause > newClauses)
Set clauses.
const VecOwn< Pragma > & getPragmaDirectives() const
Return pragma directives.
a directive has a type (e.g. input/output/printsize/limitsize), qualified relation name,...
auto clone(const std::vector< A * > &xs)
std::vector< const Node * > getChildNodes() const override
Obtain a list of all embedded AST child nodes.
detail::joined_sequence< Iter, Printer > join(const Iter &a, const Iter &b, const std::string &sep, const Printer &p)
Creates an object to be forwarded to some output stream for printing sequences of elements interspers...
bool equal_targets(const Container &a, const Container &b, const Comparator &comp)
A function testing whether two containers are equal with the given Comparator.
void addType(Own< Type > type)
Add a type declaration.
void addClause(Own< Clause > clause)
Add a clause.
VecOwn< FunctorDeclaration > functors
External Functors.
std::vector< Relation * > getRelations() const
Return relations.
void clearComponents()
Remove components and components' instantiations.
void addRelation(Own< Relation > relation)
std::vector< Directive * > getDirectives() const
Return relation directives.
std::vector< Type * > getTypes() const
Return types.
Program * clone() const override
Create a clone (i.e.
Abstract class for syntactic elements in an input program.
bool removeDirective(const Directive *directive)
Remove a directive.
void print(std::ostream &os) const override
Output to a given output stream.
std::vector< ComponentInit * > getComponentInstantiations() const
Return component instantiation.
void addFunctorDeclaration(Own< FunctorDeclaration > functor)
VecOwn< Component > components
Component definitions.
void addInstantiation(Own< ComponentInit > instantiation)
Add component instantiation.
VecOwn< Type > types
Program types
void addDirective(Own< Directive > directive)
Add relation directive.
Qualified Name class defines fully/partially qualified names to identify objects in components.
void apply(const NodeMapper &map) override
Apply the mapper to all child nodes.
bool removeClause(const Clause *clause)
Remove a clause.
std::vector< T * > toPtrVector(const std::vector< std::unique_ptr< T >> &v)
A utility function enabling the creation of a vector of pointers.
std::vector< Own< A > > VecOwn
VecOwn< ComponentInit > instantiations
Component instantiations.