From b6b7d704b2d7087388274092d6297e29d55f5543 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Mon, 21 Jan 2008 17:52:40 -0800 Subject: [PATCH] Clean up lexing of net literals. The matching of net literals (i.e. Cx<> and T<> symbols) should not get in the way of properly matching other symbols. --- vvp/lexor.lex | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/vvp/lexor.lex b/vvp/lexor.lex index 7a76d87d4..c85f72059 100644 --- a/vvp/lexor.lex +++ b/vvp/lexor.lex @@ -187,23 +187,37 @@ /* Symbols are pretty much what is left. They are used to refer to labels so the rule must match a string that a label would match. */ -[.$_a-zA-Z\\][.$_a-zA-Z\\0-9<>/]* { +[.$_a-zA-Z\\][.$_a-zA-Z\\0-9/]* { yylval.text = strdup(yytext); assert(yylval.text); return T_SYMBOL; } - /* Symbols may include comma `,' in certain constructs */ + /* Handle some specialized constant/literals as symbols. */ -[A-Z]"<"[.$_a-zA-Z0-9/,]*">" { +"C4<"[01xz]*">" { yylval.text = strdup(yytext); assert(yylval.text); return T_SYMBOL; } -"Cr" { +"C8<"[01234567xz]*">" { yylval.text = strdup(yytext); assert(yylval.text); return T_SYMBOL; } +"Cr" { + yylval.text = strdup(yytext); + assert(yylval.text); + return T_SYMBOL; } + +"T<"[0-9]*","[0-9]*","[us]">" { + yylval.text = strdup(yytext); + assert(yylval.text); + return T_SYMBOL; } + +"W<"[0-9]*","[r]">" { + yylval.text = strdup(yytext); + assert(yylval.text); + return T_SYMBOL; } /* Accept the common assembler style comments, treat them as white space. Of course, also skip white space. The semi-colon is