@@ -284,7 +284,7 @@ makeItemLikeRegex(JsonPathParseItem *expr, string *pattern, string *flags)
284
284
285
285
%type <result> result
286
286
287
- %type <value> scalar_value path_primary expr pexpr array_accessor
287
+ %type <value> scalar_value path_primary expr array_accessor
288
288
any_path accessor_op key predicate delimited_predicate
289
289
index_elem starts_with_initial opt_datetime_template
290
290
expr_or_predicate
@@ -351,21 +351,21 @@ comp_op:
351
351
;
352
352
353
353
delimited_predicate :
354
- ' (' predicate ' )' { $$ = $2 ; }
354
+ ' (' predicate ' )' { $$ = $2 ; }
355
355
| EXISTS_P ' (' expr ' )' { $$ = makeItemUnary(jpiExists, $3 ); }
356
356
;
357
357
358
358
predicate :
359
359
delimited_predicate { $$ = $1 ; }
360
- | pexpr comp_op pexpr { $$ = makeItemBinary($2 , $1 , $3 ); }
360
+ | expr comp_op expr { $$ = makeItemBinary($2 , $1 , $3 ); }
361
361
| predicate AND_P predicate { $$ = makeItemBinary(jpiAnd, $1 , $3 ); }
362
362
| predicate OR_P predicate { $$ = makeItemBinary(jpiOr, $1 , $3 ); }
363
363
| NOT_P delimited_predicate { $$ = makeItemUnary(jpiNot, $2 ); }
364
364
| ' (' predicate ' )' IS_P UNKNOWN_P { $$ = makeItemUnary(jpiIsUnknown, $2 ); }
365
- | pexpr STARTS_P WITH_P starts_with_initial
365
+ | expr STARTS_P WITH_P starts_with_initial
366
366
{ $$ = makeItemBinary(jpiStartsWith, $1 , $4 ); }
367
- | pexpr LIKE_REGEX_P STRING_P { $$ = makeItemLikeRegex($1 , &$3 , NULL ); }
368
- | pexpr LIKE_REGEX_P STRING_P FLAG_P STRING_P
367
+ | expr LIKE_REGEX_P STRING_P { $$ = makeItemLikeRegex($1 , &$3 , NULL ); }
368
+ | expr LIKE_REGEX_P STRING_P FLAG_P STRING_P
369
369
{ $$ = makeItemLikeRegex($1 , &$3 , &$5 ); }
370
370
;
371
371
@@ -385,29 +385,25 @@ accessor_expr:
385
385
path_primary { $$ = list_make1($1 ); }
386
386
| ' .' key { $$ = list_make2(makeItemType(jpiCurrent), $2 ); }
387
387
| ' (' expr ' )' accessor_op { $$ = list_make2($2 , $4 ); }
388
- | ' (' predicate ' )' accessor_op { $$ = list_make2($2 , $4 ); }
388
+ | ' (' predicate ' )' accessor_op { $$ = list_make2($2 , $4 ); }
389
389
| accessor_expr accessor_op { $$ = lappend($1 , $2 ); }
390
390
;
391
391
392
- pexpr :
393
- expr { $$ = $1 ; }
394
- | ' (' expr ' )' { $$ = $2 ; }
395
- ;
396
-
397
392
expr :
398
- accessor_expr { $$ = makeItemList($1 ); }
399
- | ' +' pexpr %prec UMINUS { $$ = makeItemUnary(jpiPlus, $2 ); }
400
- | ' -' pexpr %prec UMINUS { $$ = makeItemUnary(jpiMinus, $2 ); }
401
- | pexpr ' +' pexpr { $$ = makeItemBinary(jpiAdd, $1 , $3 ); }
402
- | pexpr ' -' pexpr { $$ = makeItemBinary(jpiSub, $1 , $3 ); }
403
- | pexpr ' *' pexpr { $$ = makeItemBinary(jpiMul, $1 , $3 ); }
404
- | pexpr ' /' pexpr { $$ = makeItemBinary(jpiDiv, $1 , $3 ); }
405
- | pexpr ' %' pexpr { $$ = makeItemBinary(jpiMod, $1 , $3 ); }
393
+ accessor_expr { $$ = makeItemList($1 ); }
394
+ | ' (' expr ' )' { $$ = $2 ; }
395
+ | ' +' expr %prec UMINUS { $$ = makeItemUnary(jpiPlus, $2 ); }
396
+ | ' -' expr %prec UMINUS { $$ = makeItemUnary(jpiMinus, $2 ); }
397
+ | expr ' +' expr { $$ = makeItemBinary(jpiAdd, $1 , $3 ); }
398
+ | expr ' -' expr { $$ = makeItemBinary(jpiSub, $1 , $3 ); }
399
+ | expr ' *' expr { $$ = makeItemBinary(jpiMul, $1 , $3 ); }
400
+ | expr ' /' expr { $$ = makeItemBinary(jpiDiv, $1 , $3 ); }
401
+ | expr ' %' expr { $$ = makeItemBinary(jpiMod, $1 , $3 ); }
406
402
;
407
403
408
404
index_elem :
409
- pexpr { $$ = makeItemBinary(jpiSubscript, $1 , NULL ); }
410
- | pexpr TO_P pexpr { $$ = makeItemBinary(jpiSubscript, $1 , $3 ); }
405
+ expr { $$ = makeItemBinary(jpiSubscript, $1 , NULL ); }
406
+ | expr TO_P expr { $$ = makeItemBinary(jpiSubscript, $1 , $3 ); }
411
407
;
412
408
413
409
index_list :
0 commit comments