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