9 std::string graphml_dumper::id(
struct prod *p)
12 os << pretty_type(p) <<
"_" << p;
16 graphml_dumper::graphml_dumper(ostream &out)
19 o <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl <<
20 "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\" " <<
21 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " <<
22 "xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns " <<
23 "http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">" << endl;
25 o <<
"<key id=\"retries\" for=\"node\" "
26 "attr.name=\"retries\" attr.type=\"double\" />" << endl;
27 o <<
"<key id=\"label\" for=\"node\" "
28 "attr.name=\"label\" attr.type=\"string\" />" << endl;
29 o <<
"<key id=\"scope\" for=\"node\" "
30 "attr.name=\"scope\" attr.type=\"string\" />" << endl;
32 o <<
"<graph id=\"ast\" edgedefault=\"directed\">" << endl;
36 void graphml_dumper::visit(
struct prod *p)
38 o <<
"<node id=\"" << id(p) <<
"\">";
39 o <<
"<data key=\"retries\">" << p->
retries <<
"</data>";
40 o <<
"<data key=\"label\">" << pretty_type(p) <<
"</data>";
41 o <<
"<data key=\"scope\">" << p->
scope <<
"</data>";
42 o <<
"</node>" << endl;
44 o <<
"<edge source=\"" << id(p) <<
"\" target=\"" << id(p->
pprod) <<
"\"/>";
49 graphml_dumper::~graphml_dumper()
51 o <<
"</graph></graphml>" << endl;
54 void ast_logger::generated(
prod &query)
57 filename +=
"sqlsmith-";
58 filename += to_string(queries);
60 ofstream os(filename);
Dump syntax trees as GraphML.
Base class for AST nodes.
struct scope * scope
Scope object to model column/table reference visibility.
struct prod * pprod
Parent production that instanciated this one.
long retries
Number of retries in this production.
virtual void accept(prod_visitor *v)
Visitor pattern for walking the AST.