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.
This commit is contained in:
Stephen Williams 2008-01-21 17:52:40 -08:00
parent 32d3e5ac46
commit b6b7d704b2
1 changed files with 18 additions and 4 deletions

View File

@ -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<m"[a-f0-9]*"x"[a-f0-9]*">" {
"C8<"[01234567xz]*">" {
yylval.text = strdup(yytext);
assert(yylval.text);
return T_SYMBOL; }
"Cr<m"[a-f0-9]*"g"[a-f0-9]*">" {
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