mirror of
https://github.com/postgres/postgres.git
synced 2026-06-10 09:10:33 -04:00
Rename jsonpath method arg tokens
This is just cleanup in the jsonpath grammar. Rename the `csv_` tokens to `int_`, because they represent signed or unsigned integers, as follows: * `csv_elem` => `int_elem` * `csv_list` => `int_list` * `opt_csv_list` => `opt_int_list` Rename the `datetime_precision` tokens to `uint_arg`, as they represent unsigned integers and will be useful for other methods in the future, as follows: * `datetime_precision` => `uint_elem` * `opt_datetime_precision` => `opt_uint_arg` Rename the `datetime_template` tokens to `str_arg`, as they represent strings and will be useful for other methods in the future, as follows: * `datetime_template` => `str_elem` * `opt_datetime_template` => `opt_str_arg` Author: David E. Wheeler <david@justatheory.com> Reviewed-by: Andrew Dunstan <andrew@dunslane.net> Discussion: https://postgr.es/m/CA+v5N40sJF39m0v7h=QN86zGp0CUf9F1WKasnZy9nNVj_VhCZQ@mail.gmail.com
This commit is contained in:
parent
fd7a25af11
commit
a35c9d524e
1 changed files with 21 additions and 21 deletions
|
|
@ -92,10 +92,10 @@ static bool makeItemLikeRegex(JsonPathParseItem *expr,
|
|||
%type <value> scalar_value path_primary expr array_accessor
|
||||
any_path accessor_op key predicate delimited_predicate
|
||||
index_elem starts_with_initial expr_or_predicate
|
||||
datetime_template opt_datetime_template csv_elem
|
||||
datetime_precision opt_datetime_precision
|
||||
str_elem opt_str_arg int_elem
|
||||
uint_elem opt_uint_arg
|
||||
|
||||
%type <elems> accessor_expr csv_list opt_csv_list
|
||||
%type <elems> accessor_expr int_list opt_int_list
|
||||
|
||||
%type <indexs> index_list
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ accessor_op:
|
|||
| '.' any_path { $$ = $2; }
|
||||
| '.' method '(' ')' { $$ = makeItemType($2); }
|
||||
| '?' '(' predicate ')' { $$ = makeItemUnary(jpiFilter, $3); }
|
||||
| '.' DECIMAL_P '(' opt_csv_list ')'
|
||||
| '.' DECIMAL_P '(' opt_int_list ')'
|
||||
{
|
||||
if (list_length($4) == 0)
|
||||
$$ = makeItemBinary(jpiDecimal, NULL, NULL);
|
||||
|
|
@ -268,19 +268,19 @@ accessor_op:
|
|||
errmsg("invalid input syntax for type %s", "jsonpath"),
|
||||
errdetail(".decimal() can only have an optional precision[,scale].")));
|
||||
}
|
||||
| '.' DATETIME_P '(' opt_datetime_template ')'
|
||||
| '.' DATETIME_P '(' opt_str_arg ')'
|
||||
{ $$ = makeItemUnary(jpiDatetime, $4); }
|
||||
| '.' TIME_P '(' opt_datetime_precision ')'
|
||||
| '.' TIME_P '(' opt_uint_arg ')'
|
||||
{ $$ = makeItemUnary(jpiTime, $4); }
|
||||
| '.' TIME_TZ_P '(' opt_datetime_precision ')'
|
||||
| '.' TIME_TZ_P '(' opt_uint_arg ')'
|
||||
{ $$ = makeItemUnary(jpiTimeTz, $4); }
|
||||
| '.' TIMESTAMP_P '(' opt_datetime_precision ')'
|
||||
| '.' TIMESTAMP_P '(' opt_uint_arg ')'
|
||||
{ $$ = makeItemUnary(jpiTimestamp, $4); }
|
||||
| '.' TIMESTAMP_TZ_P '(' opt_datetime_precision ')'
|
||||
| '.' TIMESTAMP_TZ_P '(' opt_uint_arg ')'
|
||||
{ $$ = makeItemUnary(jpiTimestampTz, $4); }
|
||||
;
|
||||
|
||||
csv_elem:
|
||||
int_elem:
|
||||
INT_P
|
||||
{ $$ = makeItemNumeric(&$1); }
|
||||
| '+' INT_P %prec UMINUS
|
||||
|
|
@ -289,31 +289,31 @@ csv_elem:
|
|||
{ $$ = makeItemUnary(jpiMinus, makeItemNumeric(&$2)); }
|
||||
;
|
||||
|
||||
csv_list:
|
||||
csv_elem { $$ = list_make1($1); }
|
||||
| csv_list ',' csv_elem { $$ = lappend($1, $3); }
|
||||
int_list:
|
||||
int_elem { $$ = list_make1($1); }
|
||||
| int_list ',' int_elem { $$ = lappend($1, $3); }
|
||||
;
|
||||
|
||||
opt_csv_list:
|
||||
csv_list { $$ = $1; }
|
||||
opt_int_list:
|
||||
int_list { $$ = $1; }
|
||||
| /* EMPTY */ { $$ = NULL; }
|
||||
;
|
||||
|
||||
datetime_precision:
|
||||
uint_elem:
|
||||
INT_P { $$ = makeItemNumeric(&$1); }
|
||||
;
|
||||
|
||||
opt_datetime_precision:
|
||||
datetime_precision { $$ = $1; }
|
||||
opt_uint_arg:
|
||||
uint_elem { $$ = $1; }
|
||||
| /* EMPTY */ { $$ = NULL; }
|
||||
;
|
||||
|
||||
datetime_template:
|
||||
str_elem:
|
||||
STRING_P { $$ = makeItemString(&$1); }
|
||||
;
|
||||
|
||||
opt_datetime_template:
|
||||
datetime_template { $$ = $1; }
|
||||
opt_str_arg:
|
||||
str_elem { $$ = $1; }
|
||||
| /* EMPTY */ { $$ = NULL; }
|
||||
;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue