[prev in list] [next in list] [prev in thread] [next in thread] 

List:       binutils
Subject:    Re: Windres problem with Boling book example
From:       Nick Clifton <nickc () redhat ! com>
Date:       2006-11-28 9:39:47
Message-ID: 456C03E3.7050100 () redhat ! com
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic