Le 11 août 09 à 05:36, Joel E. Denny a écrit :
I pushed this to master and a similar patch to branch-2.5.
Hi Joel,
Subject: [PATCH] Miscellaneous code readability improvements.
Much better, indeed!
"'"|"\n" {
- STRING_GROW;
STRING_FINISH;
loc->start = token_start;
- val->character = last_string[1];
+ val->character = last_string[0];
{
/* FIXME: Eventually, make these errors. */
- size_t length = strlen (last_string);
- if (length < 3)
- warn_at (*loc, _("empty character literal"));
- else if (length > 3)
+ if (last_string[0] == '\0')
+ {
+ warn_at (*loc, _("empty character literal"));
+ /* '\0' seems dangerous even if we are about to
complain. */
+ val->character = '\'';
+ }
Aren't you preventing the use of the character '\0' itself? While
dubious in the strings, it should probably be valid in the
characters. But then of course we need to handle the case of EOF :(