Skip to content

Commit a1ceb66

Browse files
committed
SMV: introduce ID_smv_next
This replaces the string literal by an ID.
1 parent a61b25d commit a1ceb66

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/hw_cbmc_irep_ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ IREP_ID_ONE(F)
1717
IREP_ID_ONE(E)
1818
IREP_ID_ONE(G)
1919
IREP_ID_ONE(X)
20+
IREP_ID_ONE(smv_next)
2021
IREP_ID_ONE(smv_iff)
2122
IREP_ID_TWO(C_smv_iff, "#smv_iff")
2223
IREP_ID_ONE(smv_setin)

src/smvlang/parser.y

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,10 @@ assignment : assignment_head '(' assignment_var ')' BECOMES_Token formula ';'
377377
{
378378
binary($$, $3, ID_equal, $6, bool_typet{});
379379

380-
if(stack_expr($1).id()=="next")
380+
if(stack_expr($1).id()==ID_smv_next)
381381
{
382382
exprt &op=to_binary_expr(stack_expr($$)).op0();
383-
unary_exprt tmp("smv_next", std::move(op));
383+
unary_exprt tmp(ID_smv_next, std::move(op));
384384
tmp.swap(op);
385385
PARSER.module->add_trans(stack_expr($$));
386386
}
@@ -393,7 +393,7 @@ assignment_var: variable_name
393393
;
394394

395395
assignment_head: init_Token { init($$, ID_init); }
396-
| NEXT_Token { init($$, "next"); }
396+
| NEXT_Token { init($$, ID_smv_next); }
397397
;
398398

399399
defines: define
@@ -439,7 +439,7 @@ formula : term
439439
;
440440

441441
term : variable_name
442-
| NEXT_Token '(' term ')' { init($$, "smv_next"); mto($$, $3); }
442+
| NEXT_Token '(' term ')' { init($$, ID_smv_next); mto($$, $3); }
443443
| '(' formula ')' { $$=$2; }
444444
| '{' formula_list '}' { $$=$2; stack_expr($$).id("smv_nondet_choice"); }
445445
| INC_Token '(' term ')' { init($$, "inc"); mto($$, $3); }

src/smvlang/smv_typecheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ Function: smv_typecheckt::convert
969969

970970
void smv_typecheckt::convert(exprt &expr, expr_modet expr_mode)
971971
{
972-
if(expr.id()=="smv_next")
972+
if(expr.id() == ID_smv_next)
973973
{
974974
if(expr_mode!=NORMAL)
975975
{

0 commit comments

Comments
 (0)