Skip to content

whitespace in the SMV parser #1180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 33 additions & 32 deletions src/smvlang/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -539,36 +539,36 @@ enum_element: IDENTIFIER_Token
;

vardecl : variable_identifier ':' type_specifier ';'
{
const irep_idt &identifier=stack_expr($1).get(ID_identifier);
smv_parse_treet::mc_vart &var=PARSER.module->vars[identifier];
{
const irep_idt &identifier=stack_expr($1).get(ID_identifier);
smv_parse_treet::mc_vart &var=PARSER.module->vars[identifier];

switch(var.var_class)
{
case smv_parse_treet::mc_vart::UNKNOWN:
var.type=(typet &)stack_expr($3);
var.var_class=smv_parse_treet::mc_vart::DECLARED;
break;

case smv_parse_treet::mc_vart::DEFINED:
yyerror("variable `"+id2string(identifier)+"' already defined");
YYERROR;
break;

case smv_parse_treet::mc_vart::DECLARED:
yyerror("variable `"+id2string(identifier)+"' already declared as variable");
YYERROR;
break;
case smv_parse_treet::mc_vart::ARGUMENT:
yyerror("variable `"+id2string(identifier)+"' already declared as argument");
YYERROR;
break;
default:
DATA_INVARIANT(false, "unexpected variable class");
}
}
switch(var.var_class)
{
case smv_parse_treet::mc_vart::UNKNOWN:
var.type=(typet &)stack_expr($3);
var.var_class=smv_parse_treet::mc_vart::DECLARED;
break;

case smv_parse_treet::mc_vart::DEFINED:
yyerror("variable `"+id2string(identifier)+"' already defined");
YYERROR;
break;

case smv_parse_treet::mc_vart::DECLARED:
yyerror("variable `"+id2string(identifier)+"' already declared as variable");
YYERROR;
break;

case smv_parse_treet::mc_vart::ARGUMENT:
yyerror("variable `"+id2string(identifier)+"' already declared as argument");
YYERROR;
break;

default:
DATA_INVARIANT(false, "unexpected variable class");
}
}
;

assignments: assignment
Expand Down Expand Up @@ -623,9 +623,10 @@ assignment : assignment_head '(' assignment_var ')' BECOMES_Token formula ';'
assignment_var: variable_identifier
;

assignment_head: init_Token { init($$, ID_init); }
| next_Token { init($$, ID_smv_next); }
;
assignment_head:
init_Token { init($$, ID_init); }
| next_Token { init($$, ID_smv_next); }
;

defines: define
| defines define
Expand Down
Loading