wrc: support '-' and '!' in identifiers and filenames
Dimitrie O. Paun
dpaun at rogers.com
Fri Jan 3 12:14:14 CST 2003
To support - as first char, we need to recognize negative
numbers as first class numbers.
This patch obsoletes the "wrc: support '-' and '!' in identifiers" patch.
ChangeLog
Add support for '-' and '!' in identifiers and filenames.
Recognize negative number as first class objects.
Index: tools/wrc/parser.l
===================================================================
RCS file: /var/cvs/wine/tools/wrc/parser.l,v
retrieving revision 1.22
diff -u -r1.22 parser.l
--- tools/wrc/parser.l 15 Aug 2002 21:57:36 -0000 1.22
+++ tools/wrc/parser.l 3 Jan 2003 16:48:17 -0000
@@ -394,9 +394,9 @@
\{ return tBEGIN;
\} return tEND;
-[0-9]+[lL]? { yylval.num = strtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
-0[xX][0-9A-Fa-f]+[lL]? { yylval.num = strtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
-0[oO][0-7]+[lL]? { yylval.num = strtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
+-?[0-9]+[lL]? { yylval.num = strtol(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
+-?0[xX][0-9A-Fa-f]+[lL]? { yylval.num = strtol(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
+-?0[oO][0-7]+[lL]? { yylval.num = strtol(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? tLNUMBER : tNUMBER; }
/*
* The next two rules scan identifiers and filenames.
@@ -405,7 +405,7 @@
* and *only* in a filename. In this case, the second
* rule will be reduced because it is longer.
*/
-[A-Za-z_0-9]+ {
+[A-Za-z_0-9\-!]+ {
struct keyword *tok = iskeyword(yytext);
if(tok)
@@ -424,7 +424,7 @@
return tIDENT;
}
}
-[A-Za-z_0-9./\\]+ yylval.str = make_string(yytext); return tFILENAME;
+[A-Za-z_0-9\-!./\\]+ yylval.str = make_string(yytext); return tFILENAME;
/*
* Wide string scanning
--
Dimi.
More information about the wine-patches
mailing list