10 using std::shared_ptr;
16 virtual void out(std::ostream &
out) = 0;
19 static shared_ptr<value_expr> factory(
prod *p,
sqltype *type_constraint = 0);
23 shared_ptr<value_expr> condition;
24 shared_ptr<value_expr> true_expr;
25 shared_ptr<value_expr> false_expr;
27 virtual void out(std::ostream &
out);
34 vector<shared_ptr<value_expr> > parms;
35 virtual void out(std::ostream &
out);
51 virtual void out(std::ostream &
out);
57 virtual void out(std::ostream &
out) {
out << expr; }
63 virtual void out(std::ostream &
out) {
out << reference; }
64 std::string reference;
70 vector<shared_ptr<value_expr> > value_exprs;
73 virtual void out(std::ostream &
out);
76 for (
auto p : value_exprs)
84 :
coalesce(p, type_constraint,
"nullif")
91 static shared_ptr<bool_expr> factory(
prod *p);
99 op = ( (d6() < 4) ?
scope->schema->true_literal :
scope->schema->false_literal);
106 shared_ptr<value_expr> expr;
108 negate = ((d6()<4) ?
"not " :
"");
109 expr = value_expr::factory(
this);
112 out << *expr <<
" is " << negate <<
"NULL";
121 shared_ptr<struct query_spec> subquery;
124 virtual void out(std::ostream &
out);
129 shared_ptr<value_expr> lhs, rhs;
143 out <<
"(" << *lhs <<
") ";
145 out <<
op <<
" (" << *rhs <<
")";
149 op = ((d6()<4) ?
"or" :
"and");
150 lhs = bool_expr::factory(
this);
151 rhs = bool_expr::factory(
this);
158 virtual void out(std::ostream &o) {
159 o << *lhs <<
" is distinct from " << *rhs;
167 virtual void out(std::ostream &o) {
168 o << *lhs <<
" " << oper->name <<
" " << *rhs;
173 virtual void out(std::ostream &
out);
176 vector<shared_ptr<column_reference> > partition_by;
177 vector<shared_ptr<column_reference> > order_by;
178 shared_ptr<funcall> aggregate;
182 aggregate->accept(v);
183 for (
auto p : partition_by)
185 for (
auto p : order_by)
Base class for grammar productions.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void out(std::ostream &out)=0
Emit SQL for this production.
virtual void accept(prod_visitor *v)
Visitor pattern for walking the AST.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void accept(prod_visitor *v)
Visitor pattern for walking the AST.
virtual void accept(prod_visitor *v)
Visitor pattern for walking the AST.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void out(std::ostream &o)
Emit SQL for this production.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void out(std::ostream &o)
Emit SQL for this production.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void accept(prod_visitor *v)
Visitor pattern for walking the AST.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void accept(prod_visitor *v)
Visitor pattern for walking the AST.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void accept(prod_visitor *v)
Visitor pattern for walking the AST.
Base class for walking the AST.
Base class for AST nodes.
virtual void indent(std::ostream &out)
Newline and indent according to tree level.
struct prod * pprod
Parent production that instanciated this one.
virtual void accept(prod_visitor *v)
Visitor pattern for walking the AST.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void out(std::ostream &out)=0
Emit SQL for this production.
virtual void out(std::ostream &out)
Emit SQL for this production.
virtual void accept(prod_visitor *v)
Visitor pattern for walking the AST.