1 #include "generator.hh"
2 #include <core/assert.hh>
5 namespace ag
= ast::generator
;
7 bool ag::isNode(const std::string
& type
)
19 bool ag::isPrintable(const std::string
& type
)
25 bool ag::isVectorOfNode(const std::string
& type
)
28 type
== "std::vector<Node *> *" ||
29 type
== "std::vector<Type *> *" ||
30 type
== "std::vector<VarDecl *> *" ||
35 ag::findNodeByName(const std::string
& name
)
37 for (const ag::Node
* node
= ag::nodes
; !node
->name
.empty() > 0; node
++)
38 if (node
->name
== name
)
43 std::vector
<const ag::Attribute
*>
44 ag::allAttributes(const ag::Node
* node
)
46 std::vector
<const ag::Attribute
*> attrs
;
50 for (const ag::Attribute
* attr
= node
->attrs
; !attr
->type
.empty(); ++attr
)
51 attrs
.push_back(attr
);
52 } while ((node
= findNodeByName(node
->parent
)));
56 void ag::appendGeneratedWarning(std::ostream
& out
)
58 out
<< "/* DO NOT MODIFY THIS FILE (GENERATED) */" << std::endl
;
61 template class std::vector
<ag::Attribute
*>;