This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Windres problem with Boling book example
Hi Danny,
- fix the small bug
Thanks!
- extend the lex pattern so more characters stop a keyword
I think that this may cause a problem. You are now allowing the
characters (); as keyword terminators, but you have not added a lex
pattern to match them in a string. Thus for example if the programmer
is trying to compile this string
ToBe(OrNotToBe)
the patched windres would barf on the parentheses.
There are a couple of other minor problems with the patch which it would
be nice to clean up:
* You have the comma character listed twice in the new lex pattern.
* The code does not follow the GNU coding standard.
The body of the pattern ought to look something like this.
(I have included a couple of code tidy ups as well):
s = get_string (strlen (yytext) + 1);
for (i = 0; keywords[i].word != NULL; i++)
if (strcasecmp (keywords[i].word, yytext) == 0)
break;
if (keywords[i].word == NULL)
yylval.s = strcpy (s, yytext);
MAYBE_RETURN (keywords[i].token);
Cheers
Nick