Skip to content

Commit bf8d5c5

Browse files
committed
SMV: rename STRING_Token and QSTRING_Token
This renames the token identifiers used for SMV identifiers to better match the NuSMV manual.
1 parent 2728d52 commit bf8d5c5

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

src/smvlang/parser.y

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ static void new_module(YYSTYPE &module)
273273
%token ADD_Token
274274
%token SUB_Token
275275

276-
%token STRING_Token "string"
277-
%token QSTRING_Token "quoted string"
276+
%token IDENTIFIER_Token "identifier"
277+
%token QIDENTIFIER_Token "quoted identifier"
278278
%token QUOTE_Token "'"
279279
%token NUMBER_Token "number"
280280

@@ -310,7 +310,7 @@ modules : module
310310
module : module_head module_body
311311
;
312312

313-
module_name: STRING_Token
313+
module_name: IDENTIFIER_Token
314314
| QUOTE_Token
315315
;
316316

@@ -532,7 +532,7 @@ enum_list : enum_element
532532
}
533533
;
534534

535-
enum_element: STRING_Token
535+
enum_element: IDENTIFIER_Token
536536
{
537537
$$=$1;
538538
PARSER.module->enum_set.insert(stack_expr($1).id_string());
@@ -783,7 +783,12 @@ formula_list:
783783
| formula_list ',' formula { $$=$1; mto($$, $3); }
784784
;
785785

786-
identifier : STRING_Token
786+
identifier : IDENTIFIER_Token
787+
| QIDENTIFIER_Token
788+
{
789+
// not supported by NuSMV
790+
init($$, std::string(stack_expr($1).id_string(), 1)); // remove backslash
791+
}
787792
;
788793

789794
variable_identifier: complex_identifier
@@ -826,19 +831,15 @@ variable_identifier: complex_identifier
826831
}
827832
;
828833

829-
complex_identifier: QSTRING_Token
830-
{
831-
init($$, std::string(stack_expr($1).id_string(), 1)); // remove backslash
832-
}
833-
| STRING_Token
834-
| complex_identifier DOT_Token QSTRING_Token
834+
complex_identifier: identifier
835+
| complex_identifier DOT_Token QIDENTIFIER_Token
835836
{
836837
std::string id(stack_expr($1).id_string());
837838
id+=".";
838839
id+=std::string(stack_expr($3).id_string(), 1); // remove backslash
839840
init($$, id);
840841
}
841-
| complex_identifier DOT_Token STRING_Token
842+
| complex_identifier DOT_Token IDENTIFIER_Token
842843
{
843844
std::string id(stack_expr($1).id_string());
844845
id+=".";

src/smvlang/scanner.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ void newlocation(YYSTYPE &x)
176176
[\$A-Za-z_][A-Za-z0-9_\$#-]* {
177177
newstack(yysmvlval);
178178
stack_expr(yysmvlval).id(yytext);
179-
return STRING_Token;
179+
return IDENTIFIER_Token;
180180
}
181181
\\[A-Za-z0-9_\$#-]* {
182182
newstack(yysmvlval);
183183
stack_expr(yysmvlval).id(yytext);
184-
return QSTRING_Token;
184+
return QIDENTIFIER_Token;
185185
}
186186
[0-9][0-9]* {
187187
newstack(yysmvlval);

0 commit comments

Comments
 (0)