* src/parse-gram.y (add_param): Strip the leading and trailing

blanks from a formal argument declaration.
(YY_LOCATION_PRINT): New.
This commit is contained in:
Akim Demaille
2004-09-27 07:42:04 +00:00
parent 619404e3fd
commit b233d5558f
2 changed files with 17 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
2004-09-24 Akim Demaille <akim@epita.fr>
* src/parse-gram.y (add_param): Strip the leading and trailing
blanks from a formal argument declaration.
(YY_LOCATION_PRINT): New.
2004-09-24 Akim Demaille <akim@epita.fr>
* data/c.m4 (b4_yysymprint_generate): Move the YYINPUT invocation

View File

@@ -35,6 +35,9 @@
#define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
static YYLTYPE lloc_default (YYLTYPE const *, int);
#define YY_LOCATION_PRINT(File, Loc) \
location_print (File, Loc)
/* Request detailed syntax error messages, and pass them to GRAM_ERROR.
FIXME: depends on the undocumented availability of YYLLOC. */
#undef yyerror
@@ -474,6 +477,7 @@ add_param (char const *type, char *decl, location loc)
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"_";
static char const blank[] = " \t";
char const *alpha = alphanum + 10;
char const *name_start = NULL;
char *p;
@@ -484,7 +488,13 @@ add_param (char const *type, char *decl, location loc)
/* Strip the surrounding '{' and '}'. */
decl++;
p[-1] = '\0';
*--p = '\0';
/* Strip surrounding white spaces. */
while (strchr (blank, *decl))
++decl;
while (strchr (blank, p[-1]))
*--p = '\0';
if (! name_start)
complain_at (loc, _("missing identifier in parameter declaration"));