[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: variables: accept dashes
From: |
Joel E. Denny |
Subject: |
Re: FYI: variables: accept dashes |
Date: |
Wed, 29 Apr 2009 20:21:21 -0400 (EDT) |
On Sun, 26 Apr 2009, Akim Demaille wrote:
> > > diff --git a/src/parse-gram.y b/src/parse-gram.y
> > > index 20dee8c..caa3d30 100644
> > > --- a/src/parse-gram.y
> > > +++ b/src/parse-gram.y
> > > @@ -535,15 +535,12 @@ rhs:
> > >
> > > variable:
> > > ID
> > > -| STRING { $$ = uniqstr_new ($1); } /* deprecated and not M4-friendly */
> > > +| STRING { $$ = uniqstr_new ($1); }
> > > ;
> >
> > The idea is that quotes around a variable name were deprecated in 2.3b.
> > Moreover, that form is allowed to break Bison:
> >
> > % cat >tmp.y <<EOF
> > %define "[" "value"
> > %%
> > start: ;
> > EOF
> > % bison tmp.y
> > /home/jdenny/installs/m4/using/bin/m4:stdin:190: ERROR: end of file in
> > string
> > /home/jdenny/cs/bison/bison-git/src/bison: subsidiary program `/
> > home/jdenny/installs/m4/using/bin/m4' failed (exit status 1)
> >
> > Maybe the comment here just needed to be more descriptive?
>
> Ah, thanks for the clarification. I removed it because I thought that in the
> past we might have simply transformed %define into m4_define (I honestly don't
> remember if there were a previous version), in which case, "foo bar" was not
> m4 friendly. Since now we are using your m4_define([b4_percent_$1]...) and
> use m4_indir, we no longer had this problem. But you show we have others.
I pushed this to branch-2.5 and master.
>From ae618dcca57abb16ad4e5e11083480ecdcfc511f Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Wed, 29 Apr 2009 20:05:32 -0400
Subject: [PATCH] Document how `%define "var" "value"' is not M4-friendly.
* src/parse-gram.y (variable): In comments here.
diff --git a/src/parse-gram.y b/src/parse-gram.y
index 5bf6694..5af473c 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -545,6 +545,8 @@ rhs:
| variable and content.opt. |
*---------------------------*/
+/* The STRING form of variable is deprecated and is not M4-friendly.
+ For example, M4 fails for `%define "[" "value"'. */
variable:
ID
| STRING { $$ = uniqstr_new ($1); }
--
1.5.4.3