|
@@ -42,7 +42,7 @@ cJSON* jroot;
|
|
%type <iv> INT_V
|
|
%type <iv> INT_V
|
|
%type <fv> FLOAT_V
|
|
%type <fv> FLOAT_V
|
|
%type <sv> STRING_V
|
|
%type <sv> STRING_V
|
|
-%type <sv> IDENTIFIER data_type PRIMARY_KEY col_options bin_compare_op bin_logical_op
|
|
|
|
|
|
+%type <sv> IDENTIFIER data_type PRIMARY_KEY col_options bin_compare_op bin_logical_op unary_compare_op
|
|
%type <jv> create_definition create_col_list create_table_stmt data_value
|
|
%type <jv> create_definition create_col_list create_table_stmt data_value
|
|
%type <jv> insert_stmt insert_list
|
|
%type <jv> insert_stmt insert_list
|
|
%type <jv> update_stmt update_list single_assign_item
|
|
%type <jv> update_stmt update_list single_assign_item
|
|
@@ -208,6 +208,12 @@ where_conditions: where_condition_item {
|
|
cJSON_AddItemToObject(node, "right", $3);
|
|
cJSON_AddItemToObject(node, "right", $3);
|
|
$$=node;
|
|
$$=node;
|
|
}
|
|
}
|
|
|
|
+ | unary_compare_op where_condition_item {
|
|
|
|
+ cJSON* node = cJSON_CreateObject();
|
|
|
|
+ cJSON_AddStringToObject(node, "type", $1);
|
|
|
|
+ cJSON_AddItemToObject(node, "right", $2);
|
|
|
|
+ $$=node;
|
|
|
|
+ }
|
|
;
|
|
;
|
|
|
|
|
|
identifier: IDENTIFIER {
|
|
identifier: IDENTIFIER {
|
|
@@ -227,6 +233,7 @@ where_condition_item: identifier_or_const_value bin_compare_op identifier_or_con
|
|
$$=node;
|
|
$$=node;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+
|
|
bin_compare_op: '=' {$$ = "相等";}
|
|
bin_compare_op: '=' {$$ = "相等";}
|
|
| '>' {$$ = "大于";}
|
|
| '>' {$$ = "大于";}
|
|
| '<' {$$ = "小于";}
|
|
| '<' {$$ = "小于";}
|
|
@@ -234,6 +241,9 @@ bin_compare_op: '=' {$$ = "相等";}
|
|
| "<=" {$$ = "小等";}
|
|
| "<=" {$$ = "小等";}
|
|
| "!=" {$$ = "不等";}
|
|
| "!=" {$$ = "不等";}
|
|
;
|
|
;
|
|
|
|
+
|
|
|
|
+unary_compare_op: NOT {$$ = "非";};
|
|
|
|
+
|
|
bin_logical_op: AND {$$ = "且";}
|
|
bin_logical_op: AND {$$ = "且";}
|
|
| OR {$$ = "或";}
|
|
| OR {$$ = "或";}
|
|
|
|
|