Skip to content

Commit cf17427

Browse files
authored
Merge pull request #1508 from diffblue/self1-grammar
SMV: grammar for `self` expression
2 parents e38465b + e2fa222 commit cf17427

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

regression/smv/modules/self1.desc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
KNOWNBUG
1+
CORE
22
self1.smv
33

4-
^EXIT=0$
4+
^file .* line 4: no support for self$
5+
^EXIT=2$
56
^SIGNAL=0$
67
--
78
^warning: ignoring
89
--
9-
This does not parse.

src/hw_cbmc_irep_ids.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ IREP_ID_TWO(C_smv_iff, "#smv_iff")
3636
IREP_ID_ONE(smv_range)
3737
IREP_ID_ONE(smv_resize)
3838
IREP_ID_ONE(smv_toint)
39+
IREP_ID_ONE(smv_self)
3940
IREP_ID_ONE(smv_set)
4041
IREP_ID_ONE(smv_setin)
4142
IREP_ID_ONE(smv_setnotin)

src/smvlang/parser.y

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,11 @@ basic_expr : constant
738738
unary($$, ID_member, $1);
739739
stack_expr($$).set(ID_component_name, stack_expr($3).id());
740740
}
741+
| self_Token
742+
{
743+
// This rule is part of "complex_identifier" in the NuSMV manual.
744+
init($$, ID_smv_self);
745+
}
741746
| basic_expr '(' basic_expr ')'
742747
{
743748
// Not in the NuSMV grammar.

src/smvlang/smv_typecheck.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,6 +1954,11 @@ void smv_typecheckt::convert(exprt &expr)
19541954
tmp.set_identifier(id2string(tmp.get_identifier()) + '.' + index_string);
19551955
expr = tmp;
19561956
}
1957+
else if(expr.id() == ID_smv_self)
1958+
{
1959+
throw errort().with_location(expr.source_location())
1960+
<< "no support for self";
1961+
}
19571962
else if(expr.id()=="smv_nondet_choice" ||
19581963
expr.id()=="smv_union")
19591964
{

0 commit comments

Comments
 (0)