%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
| '.' 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);
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
{ $$ = 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; }
;