@@ -472,16 +472,6 @@ quantifier_expression:
472
472
mto ($$, $5 );
473
473
PARSER.pop_scope();
474
474
}
475
- | TOK_ACSL_FORALL compound_scope declaration primary_expression
476
- {
477
- // The precedence of this operator is too high; it is meant
478
- // to bind only very weakly.
479
- $$ =$1 ;
480
- set ($$, ID_forall);
481
- mto ($$, $3 );
482
- mto ($$, $4 );
483
- PARSER.pop_scope();
484
- }
485
475
| TOK_EXISTS compound_scope ' {' declaration comma_expression ' }'
486
476
{
487
477
$$ =$1 ;
@@ -490,36 +480,26 @@ quantifier_expression:
490
480
mto ($$, $5 );
491
481
PARSER.pop_scope();
492
482
}
493
- | TOK_ACSL_EXISTS compound_scope declaration primary_expression
494
- {
495
- // The precedence of this operator is too high; it is meant
496
- // to bind only very weakly.
497
- $$ =$1 ;
498
- set ($$, ID_exists);
499
- mto ($$, $3 );
500
- mto ($$, $4 );
501
- PARSER.pop_scope();
502
- }
503
483
;
504
484
505
485
loop_invariant_opt :
506
486
/* nothing */
507
487
{ init($$ ); parser_stack($$ ).make_nil(); }
508
- | TOK_CPROVER_LOOP_INVARIANT ' (' conditional_expression ' )'
488
+ | TOK_CPROVER_LOOP_INVARIANT ' (' ACSL_binding_expression ' )'
509
489
{ $$ =$3 ; }
510
490
;
511
491
512
492
requires_opt :
513
493
/* nothing */
514
494
{ init($$ ); parser_stack($$ ).make_nil(); }
515
- | TOK_CPROVER_REQUIRES ' (' conditional_expression ' )'
495
+ | TOK_CPROVER_REQUIRES ' (' ACSL_binding_expression ' )'
516
496
{ $$ =$3 ; }
517
497
;
518
498
519
499
ensures_opt :
520
500
/* nothing */
521
501
{ init($$ ); parser_stack($$ ).make_nil(); }
522
- | TOK_CPROVER_ENSURES ' (' conditional_expression ' )'
502
+ | TOK_CPROVER_ENSURES ' (' ACSL_binding_expression ' )'
523
503
{ $$ =$3 ; }
524
504
;
525
505
@@ -819,6 +799,27 @@ logical_equivalence_expression:
819
799
{ binary($$ , $1 , $2 , ID_equal, $3 ); }
820
800
;
821
801
802
+ /* Non-standard, defined by ACSL. Lowest precedence of all operators. */
803
+ ACSL_binding_expression :
804
+ conditional_expression
805
+ | TOK_ACSL_FORALL compound_scope declaration ACSL_binding_expression
806
+ {
807
+ $$ =$1 ;
808
+ set ($$, ID_forall);
809
+ mto ($$, $3 );
810
+ mto ($$, $4 );
811
+ PARSER.pop_scope();
812
+ }
813
+ | TOK_ACSL_EXISTS compound_scope declaration ACSL_binding_expression
814
+ {
815
+ $$ =$1 ;
816
+ set ($$, ID_exists);
817
+ mto ($$, $3 );
818
+ mto ($$, $4 );
819
+ PARSER.pop_scope();
820
+ }
821
+ ;
822
+
822
823
conditional_expression :
823
824
logical_equivalence_expression
824
825
| logical_equivalence_expression ' ?' comma_expression ' :' conditional_expression
@@ -838,7 +839,7 @@ conditional_expression:
838
839
;
839
840
840
841
assignment_expression :
841
- conditional_expression
842
+ ACSL_binding_expression /* usually conditional_expression */
842
843
| cast_expression ' =' assignment_expression
843
844
{ binary($$ , $1 , $2 , ID_side_effect, $3 ); parser_stack($$ ).set(ID_statement, ID_assign); }
844
845
| cast_expression TOK_MULTASSIGN assignment_expression
0 commit comments