wrc: Don't use identifiers starting yy*, they're reserved for flex.

This commit is contained in:
Mike McCormack 2006-03-06 21:41:00 +09:00 committed by Alexandre Julliard
parent 8723936de6
commit 69dcbaaf93
1 changed files with 53 additions and 53 deletions

View File

@ -68,11 +68,11 @@
*/ */
/* Exclusive string handling */ /* Exclusive string handling */
%x yystr %x tkstr
/* Exclusive unicode string handling */ /* Exclusive unicode string handling */
%x yylstr %x tklstr
/* Exclusive rcdata single quoted data handling */ /* Exclusive rcdata single quoted data handling */
%x yyrcd %x tkrcd
/* Exclusive comment eating... */ /* Exclusive comment eating... */
%x comment %x comment
/* Set when stripping c-junk */ /* Set when stripping c-junk */
@ -428,102 +428,102 @@ static struct keyword *iskeyword(char *kw)
* Wide string scanning * Wide string scanning
*/ */
L\" { L\" {
yy_push_state(yylstr); yy_push_state(tklstr);
wbufidx = 0; wbufidx = 0;
if(!win32) if(!win32)
yywarning("16bit resource contains unicode strings\n"); yywarning("16bit resource contains unicode strings\n");
} }
<yylstr>\"{ws}+ | <tklstr>\"{ws}+ |
<yylstr>\" { <tklstr>\" {
yy_pop_state(); yy_pop_state();
yylval.str = get_buffered_wstring(); yylval.str = get_buffered_wstring();
return tSTRING; return tSTRING;
} }
<yylstr>\\[0-7]{1,6} { /* octal escape sequence */ <tklstr>\\[0-7]{1,6} { /* octal escape sequence */
unsigned int result; unsigned int result;
result = strtoul(yytext+1, 0, 8); result = strtoul(yytext+1, 0, 8);
if ( result > 0xffff ) if ( result > 0xffff )
yyerror("Character constant out of range"); yyerror("Character constant out of range");
addwchar((WCHAR)result); addwchar((WCHAR)result);
} }
<yylstr>\\x[0-9a-fA-F]{4} { /* hex escape sequence */ <tklstr>\\x[0-9a-fA-F]{4} { /* hex escape sequence */
unsigned int result; unsigned int result;
result = strtoul(yytext+2, 0, 16); result = strtoul(yytext+2, 0, 16);
addwchar((WCHAR)result); addwchar((WCHAR)result);
} }
<yylstr>\\x[0-9a-fA-F]{1,3} { yyerror("Invalid hex escape sequence '%s'", yytext); } <tklstr>\\x[0-9a-fA-F]{1,3} { yyerror("Invalid hex escape sequence '%s'", yytext); }
<yylstr>\\[0-9]+ yyerror("Bad escape sequence"); <tklstr>\\[0-9]+ yyerror("Bad escape sequence");
<yylstr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ <tklstr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */
<yylstr>\\a addwchar('\a'); <tklstr>\\a addwchar('\a');
<yylstr>\\b addwchar('\b'); <tklstr>\\b addwchar('\b');
<yylstr>\\f addwchar('\f'); <tklstr>\\f addwchar('\f');
<yylstr>\\n addwchar('\n'); <tklstr>\\n addwchar('\n');
<yylstr>\\r addwchar('\r'); <tklstr>\\r addwchar('\r');
<yylstr>\\t addwchar('\t'); <tklstr>\\t addwchar('\t');
<yylstr>\\v addwchar('\v'); <tklstr>\\v addwchar('\v');
<yylstr>\\. addwchar(yytext[1]); <tklstr>\\. addwchar(yytext[1]);
<yylstr>\\\r\n addwchar(yytext[2]); line_number++; char_number = 1; <tklstr>\\\r\n addwchar(yytext[2]); line_number++; char_number = 1;
<yylstr>\"\" addwchar('\"'); /* "bla""bla" -> "bla\"bla" */ <tklstr>\"\" addwchar('\"'); /* "bla""bla" -> "bla\"bla" */
<yylstr>\\\"\" addwchar('\"'); /* "bla\""bla" -> "bla\"bla" */ <tklstr>\\\"\" addwchar('\"'); /* "bla\""bla" -> "bla\"bla" */
<yylstr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */ <tklstr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
<yylstr>[^\\\n\"]+ { <tklstr>[^\\\n\"]+ {
char *yptr = yytext; char *yptr = yytext;
while(*yptr) /* FIXME: codepage translation */ while(*yptr) /* FIXME: codepage translation */
addwchar(*yptr++ & 0xff); addwchar(*yptr++ & 0xff);
} }
<yylstr>\n yyerror("Unterminated string"); <tklstr>\n yyerror("Unterminated string");
/* /*
* Normal string scanning * Normal string scanning
*/ */
\" yy_push_state(yystr); cbufidx = 0; \" yy_push_state(tkstr); cbufidx = 0;
<yystr>\"{ws}+ | <tkstr>\"{ws}+ |
<yystr>\" { <tkstr>\" {
yy_pop_state(); yy_pop_state();
yylval.str = get_buffered_cstring(); yylval.str = get_buffered_cstring();
return tSTRING; return tSTRING;
} }
<yystr>\\[0-7]{1,3} { /* octal escape sequence */ <tkstr>\\[0-7]{1,3} { /* octal escape sequence */
int result; int result;
result = strtol(yytext+1, 0, 8); result = strtol(yytext+1, 0, 8);
if ( result > 0xff ) if ( result > 0xff )
yyerror("Character constant out of range"); yyerror("Character constant out of range");
addcchar((char)result); addcchar((char)result);
} }
<yystr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */ <tkstr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
int result; int result;
result = strtol(yytext+2, 0, 16); result = strtol(yytext+2, 0, 16);
addcchar((char)result); addcchar((char)result);
} }
<yystr>\\x[0-9a-fA-F] { yyerror("Invalid hex escape sequence '%s'", yytext); } <tkstr>\\x[0-9a-fA-F] { yyerror("Invalid hex escape sequence '%s'", yytext); }
<yystr>\\[0-9]+ yyerror("Bad escape sequence"); <tkstr>\\[0-9]+ yyerror("Bad escape sequence");
<yystr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ <tkstr>\\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */
<yystr>\\a addcchar('\a'); <tkstr>\\a addcchar('\a');
<yystr>\\b addcchar('\b'); <tkstr>\\b addcchar('\b');
<yystr>\\f addcchar('\f'); <tkstr>\\f addcchar('\f');
<yystr>\\n addcchar('\n'); <tkstr>\\n addcchar('\n');
<yystr>\\r addcchar('\r'); <tkstr>\\r addcchar('\r');
<yystr>\\t addcchar('\t'); <tkstr>\\t addcchar('\t');
<yystr>\\v addcchar('\v'); <tkstr>\\v addcchar('\v');
<yystr>\\. addcchar(yytext[1]); <tkstr>\\. addcchar(yytext[1]);
<yystr>\\\r\n addcchar(yytext[2]); line_number++; char_number = 1; <tkstr>\\\r\n addcchar(yytext[2]); line_number++; char_number = 1;
<yystr>[^\\\n\"]+ { <tkstr>[^\\\n\"]+ {
char *yptr = yytext; char *yptr = yytext;
while(*yptr) while(*yptr)
addcchar(*yptr++); addcchar(*yptr++);
} }
<yystr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */ <tkstr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
<yystr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */ <tkstr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
<yystr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */ <tkstr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
<yystr>\n yyerror("Unterminated string"); <tkstr>\n yyerror("Unterminated string");
/* /*
* Raw data scanning * Raw data scanning
*/ */
\' yy_push_state(yyrcd); cbufidx = 0; \' yy_push_state(tkrcd); cbufidx = 0;
<yyrcd>\' { <tkrcd>\' {
yy_pop_state(); yy_pop_state();
yylval.raw = new_raw_data(); yylval.raw = new_raw_data();
yylval.raw->size = cbufidx; yylval.raw->size = cbufidx;
@ -531,14 +531,14 @@ L\" {
memcpy(yylval.raw->data, cbuffer, yylval.raw->size); memcpy(yylval.raw->data, cbuffer, yylval.raw->size);
return tRAWDATA; return tRAWDATA;
} }
<yyrcd>[0-9a-fA-F]{2} { <tkrcd>[0-9a-fA-F]{2} {
int result; int result;
result = strtol(yytext, 0, 16); result = strtol(yytext, 0, 16);
addcchar((char)result); addcchar((char)result);
} }
<yyrcd>{ws}+ ; /* Ignore space */ <tkrcd>{ws}+ ; /* Ignore space */
<yyrcd>\n line_number++; char_number = 1; <tkrcd>\n line_number++; char_number = 1;
<yyrcd>. yyerror("Malformed data-line"); <tkrcd>. yyerror("Malformed data-line");
/* /*
* Comment stripping * Comment stripping