Skip to content

Commit 7bdefd9

Browse files
committed
is number -> is numeric
1 parent 87153d3 commit 7bdefd9

File tree

4 files changed

+31
-31
lines changed

4 files changed

+31
-31
lines changed

Diff for: expected/jsquery.out

+4-4
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ LINE 1: select 'a\r = x"\\abcd"'::jsquery AS err;
959959
^
960960
DETAIL: syntax error, unexpected STRING_P, expecting $end at or near """
961961
--IS
962-
select 'as IS boolean | as is ARRAY | as is ObJect | as is Number | as is string'::jsquery;
962+
select 'as IS boolean | as is ARRAY | as is ObJect | as is Numeric | as is string'::jsquery;
963963
jsquery
964964
--------------------------------------------------------------------------------------------
965965
(((("as" IS BOOLEAN | "as" IS ARRAY) | "as" IS OBJECT) | "as" IS NUMBER) | "as" IS STRING)
@@ -971,13 +971,13 @@ select '{"as": "xxx"}' @@ 'as IS string'::jsquery;
971971
t
972972
(1 row)
973973

974-
select '{"as": "xxx"}' @@ 'as IS boolean | as is ARRAY | as is ObJect | as is Number'::jsquery;
974+
select '{"as": "xxx"}' @@ 'as IS boolean | as is ARRAY | as is ObJect | as is Numeric'::jsquery;
975975
?column?
976976
----------
977977
f
978978
(1 row)
979979

980-
select '{"as": 5}' @@ 'as is Number'::jsquery;
980+
select '{"as": 5}' @@ 'as is Numeric'::jsquery;
981981
?column?
982982
----------
983983
t
@@ -1019,7 +1019,7 @@ select '"xxx"' @@ '$ IS string'::jsquery;
10191019
t
10201020
(1 row)
10211021

1022-
select '"xxx"' @@ '$ IS number'::jsquery;
1022+
select '"xxx"' @@ '$ IS numeric'::jsquery;
10231023
?column?
10241024
----------
10251025
f

Diff for: jsquery_gram.y

+18-18
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ makeItemList(List *list) {
198198
JsQueryParseItem *value;
199199
}
200200

201-
%token <str> IN_P IS_P NULL_P TRUE_P ARRAY_P
202-
FALSE_P NUMBER_P OBJECT_P TEXT_P
203-
BOOLEAN_P
201+
%token <str> IN_P IS_P NULL_P TRUE_P ARRAY_T
202+
FALSE_P NUMERIC_T OBJECT_T STRING_T
203+
BOOLEAN_T
204204

205205
%token <str> STRING_P NUMERIC_P
206206

@@ -233,12 +233,12 @@ scalar_value:
233233
| IS_P { $$ = makeItemString(&$1); }
234234
| NULL_P { $$ = makeItemString(NULL); }
235235
| TRUE_P { $$ = makeItemBool(true); }
236-
| ARRAY_P { $$ = makeItemString(&$1); }
236+
| ARRAY_T { $$ = makeItemString(&$1); }
237237
| FALSE_P { $$ = makeItemBool(false); }
238-
| NUMBER_P { $$ = makeItemString(&$1); }
239-
| OBJECT_P { $$ = makeItemString(&$1); }
240-
| TEXT_P { $$ = makeItemString(&$1); }
241-
| BOOLEAN_P { $$ = makeItemString(&$1); }
238+
| NUMERIC_T { $$ = makeItemString(&$1); }
239+
| OBJECT_T { $$ = makeItemString(&$1); }
240+
| STRING_T { $$ = makeItemString(&$1); }
241+
| BOOLEAN_T { $$ = makeItemString(&$1); }
242242
| NUMERIC_P { $$ = makeItemNumeric(&$1); }
243243
;
244244

@@ -259,11 +259,11 @@ right_expr:
259259
| '@' '>' array { $$ = makeItemUnary(jqiContains, $3); }
260260
| '<' '@' array { $$ = makeItemUnary(jqiContained, $3); }
261261
| '&' '&' array { $$ = makeItemUnary(jqiOverlap, $3); }
262-
| IS_P ARRAY_P { $$ = makeItemIs(jbvArray); }
263-
| IS_P NUMBER_P { $$ = makeItemIs(jbvNumeric); }
264-
| IS_P OBJECT_P { $$ = makeItemIs(jbvObject); }
265-
| IS_P TEXT_P { $$ = makeItemIs(jbvString); }
266-
| IS_P BOOLEAN_P { $$ = makeItemIs(jbvBool); }
262+
| IS_P ARRAY_T { $$ = makeItemIs(jbvArray); }
263+
| IS_P NUMERIC_T { $$ = makeItemIs(jbvNumeric); }
264+
| IS_P OBJECT_T { $$ = makeItemIs(jbvObject); }
265+
| IS_P STRING_T { $$ = makeItemIs(jbvString); }
266+
| IS_P BOOLEAN_T { $$ = makeItemIs(jbvBool); }
267267
;
268268

269269
expr:
@@ -284,12 +284,12 @@ key:
284284
| IS_P { $$ = $1; }
285285
| NULL_P { $$ = $1; }
286286
| TRUE_P { $$ = $1; }
287-
| ARRAY_P { $$ = $1; }
287+
| ARRAY_T { $$ = $1; }
288288
| FALSE_P { $$ = $1; }
289-
| NUMBER_P { $$ = $1; }
290-
| OBJECT_P { $$ = $1; }
291-
| TEXT_P { $$ = $1; }
292-
| BOOLEAN_P { $$ = $1; }
289+
| NUMERIC_T { $$ = $1; }
290+
| OBJECT_T { $$ = $1; }
291+
| STRING_T { $$ = $1; }
292+
| BOOLEAN_T { $$ = $1; }
293293
| NUMERIC_P { $$ = $1; }
294294
;
295295

Diff for: jsquery_scan.l

+5-5
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ static keyword keywords[] = {
201201
{ 2, false, IS_P, "is"},
202202
{ 4, true, NULL_P, "null"},
203203
{ 4, true, TRUE_P, "true"},
204-
{ 5, false, ARRAY_P, "array"},
204+
{ 5, false, ARRAY_T, "array"},
205205
{ 5, true, FALSE_P, "false"},
206-
{ 6, false, NUMBER_P, "number"},
207-
{ 6, false, OBJECT_P, "object"},
208-
{ 6, false, TEXT_P, "string"},
209-
{ 7, false, BOOLEAN_P, "boolean"},
206+
{ 6, false, OBJECT_T, "object"},
207+
{ 6, false, STRING_T, "string"},
208+
{ 7, false, BOOLEAN_T, "boolean"},
209+
{ 7, false, NUMERIC_T, "numeric"}
210210
};
211211

212212
static int

Diff for: sql/jsquery.sql

+4-4
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,17 @@ select 'a\r = x"\\abcd"'::jsquery AS err;
195195

196196
--IS
197197

198-
select 'as IS boolean | as is ARRAY | as is ObJect | as is Number | as is string'::jsquery;
198+
select 'as IS boolean | as is ARRAY | as is ObJect | as is Numeric | as is string'::jsquery;
199199
select '{"as": "xxx"}' @@ 'as IS string'::jsquery;
200-
select '{"as": "xxx"}' @@ 'as IS boolean | as is ARRAY | as is ObJect | as is Number'::jsquery;
201-
select '{"as": 5}' @@ 'as is Number'::jsquery;
200+
select '{"as": "xxx"}' @@ 'as IS boolean | as is ARRAY | as is ObJect | as is Numeric'::jsquery;
201+
select '{"as": 5}' @@ 'as is Numeric'::jsquery;
202202
select '{"as": true}' @@ 'as is boolean'::jsquery;
203203
select '{"as": false}' @@ 'as is boolean'::jsquery;
204204
select '{"as": "false"}' @@ 'as is boolean'::jsquery;
205205
select '["xxx"]' @@ '$ IS array'::jsquery;
206206
select '{"as": false}' @@ '$ IS object'::jsquery;
207207
select '"xxx"' @@ '$ IS string'::jsquery;
208-
select '"xxx"' @@ '$ IS number'::jsquery;
208+
select '"xxx"' @@ '$ IS numeric'::jsquery;
209209

210210
---table and index
211211

0 commit comments

Comments
 (0)