bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: Strip blanks from %*-param


From: Akim Demaille
Subject: FYI: Strip blanks from %*-param
Date: Mon, 27 Sep 2004 09:41:47 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

This is to enable the following patch.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * src/parse-gram.y (add_param): Strip the leading and trailing
        blanks from a formal argument declaration.
        (YY_LOCATION_PRINT): New.

Index: src/parse-gram.y
===================================================================
RCS file: /cvsroot/bison/bison/src/parse-gram.y,v
retrieving revision 1.49
diff -u -u -r1.49 parse-gram.y
--- src/parse-gram.y 27 May 2004 07:38:17 -0000 1.49
+++ src/parse-gram.y 27 Sep 2004 07:40:43 -0000
@@ -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 @@
     "abcdefghijklmnopqrstuvwxyz"
     "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     "_";
+  static char const blank[] = " \t";
   char const *alpha = alphanum + 10;
   char const *name_start = NULL;
   char *p;
@@ -484,7 +488,13 @@
 
   /* 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"));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]