|
@@ -41,6 +41,8 @@ cJSON* jroot;
|
|
cJSON_AddStringToObject(node, "type", #type_name); \
|
|
cJSON_AddStringToObject(node, "type", #type_name); \
|
|
cJSON_Add##json_type_name##ToObject(node, "value", value); \
|
|
cJSON_Add##json_type_name##ToObject(node, "value", value); \
|
|
res = node;
|
|
res = node;
|
|
|
|
+
|
|
|
|
+#define MEET(msg) fprintf(stderr, "MEET: %s\n", #msg);
|
|
%}
|
|
%}
|
|
|
|
|
|
%union {
|
|
%union {
|
|
@@ -245,19 +247,21 @@ op_where_expr: {$$=cJSON_CreateObject();}
|
|
compare_expr: compare_expr bin_cmp_op compare_expr {
|
|
compare_expr: compare_expr bin_cmp_op compare_expr {
|
|
fprintf(stderr, "compare_expr %s\n", $2);
|
|
fprintf(stderr, "compare_expr %s\n", $2);
|
|
SIMPLE_OP_NODE($$, $2, $1, $3);}
|
|
SIMPLE_OP_NODE($$, $2, $1, $3);}
|
|
- | single_expr {$$=$1;}
|
|
|
|
|
|
+ | single_expr {MEET(single_expr from cmp) $$=$1;}
|
|
|
|
+ | where_expr {MEET(where_expr from cmp) $$=$1;}
|
|
|
|
|
|
;
|
|
;
|
|
negative_expr: NOT negative_expr {
|
|
negative_expr: NOT negative_expr {
|
|
fprintf(stderr, "negative_expr\n");
|
|
fprintf(stderr, "negative_expr\n");
|
|
SIMPLE_OP_NODE_ONLY_LEFT($$, "非", $2);}
|
|
SIMPLE_OP_NODE_ONLY_LEFT($$, "非", $2);}
|
|
- | compare_expr {$$=$1;}
|
|
|
|
|
|
+ | compare_expr {MEET(compare_expr from neg) $$=$1;}
|
|
|
|
+ | where_expr {MEET(where_expr from neg) $$=$1;}
|
|
;
|
|
;
|
|
logical_expr: logical_expr bin_logical_op negative_expr {
|
|
logical_expr: logical_expr bin_logical_op negative_expr {
|
|
fprintf(stderr, "logical_expr %s\n", $2);
|
|
fprintf(stderr, "logical_expr %s\n", $2);
|
|
SIMPLE_OP_NODE($$, $2, $1, $3);}
|
|
SIMPLE_OP_NODE($$, $2, $1, $3);}
|
|
- | negative_expr {$$=$1;}
|
|
|
|
- | single_expr {$$=$1;}
|
|
|
|
|
|
+ | negative_expr {MEET(negative_expr from log) $$=$1;}
|
|
|
|
+ | single_expr {MEET(single_expr from log) $$=$1;}
|
|
;
|
|
;
|
|
|
|
|
|
// expr: compare_expr
|
|
// expr: compare_expr
|
|
@@ -374,12 +378,12 @@ bin_cmp_op: '=' {$$ = "相等";}
|
|
|
|
|
|
unary_compare_op: NOT {$$ = "非";};
|
|
unary_compare_op: NOT {$$ = "非";};
|
|
|
|
|
|
-bin_logical_op: AND {$$ = "且";}
|
|
|
|
- | OR {$$ = "或";}
|
|
|
|
-
|
|
|
|
|
|
+bin_logical_op: AND {MEET(and from bin_log) $$ = "且";}
|
|
|
|
+ | OR {MEET(or from bin_log) $$ = "或";}
|
|
|
|
+;
|
|
bin_contains_op: IN {$$ = "包含于";}
|
|
bin_contains_op: IN {$$ = "包含于";}
|
|
| NOT IN {$$ = "不包含于";}
|
|
| NOT IN {$$ = "不包含于";}
|
|
-
|
|
|
|
|
|
+;
|
|
delete_stmt: DELETE FROM IDENTIFIER op_where_expr NEWLINE {
|
|
delete_stmt: DELETE FROM IDENTIFIER op_where_expr NEWLINE {
|
|
cJSON* node = cJSON_CreateObject();
|
|
cJSON* node = cJSON_CreateObject();
|
|
cJSON_AddStringToObject(node, "type", "delete");
|
|
cJSON_AddStringToObject(node, "type", "delete");
|