bison-patches
[Top][All Lists]
Advanced

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

FYI: Default locations


From: Akim Demaille
Subject: FYI: Default locations
Date: 02 May 2002 18:41:18 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

how embarassing :(  It could be considered a backward incompatibility,
but AFAIK, it is still not widely used.

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * data/bison.simple (yyparse): Do not implement @$ = @1.
        (YYLLOC_DEFAULT): Adjust to do it.
        * doc/bison.texinfo (Location Default Action): Fix.

Index: NEWS
===================================================================
RCS file: /cvsroot/bison/bison/NEWS,v
retrieving revision 1.40
diff -u -u -r1.40 NEWS
--- NEWS 2 May 2002 15:13:09 -0000 1.40
+++ NEWS 2 May 2002 16:40:25 -0000
@@ -43,9 +43,11 @@
 * Revert the C++ namespace changes introduced in 1.31, as they caused too
   many portability hassles.
 
-* Items overflow
-  Bison no longer dumps core when there are too many items, it just
-  dies.
+* Default locations
+  By an accident of design, the default computation of @$ was
+  performed after another default computation was performed: @$ = @1.
+  The latter is now removed: YYLLOC_DEFAULT is fully responsible of
+  the computation of @$.
 
 * Token end-of-file
   The token end of file may be specified by the user, in which case,
Index: data/bison.simple
===================================================================
RCS file: /cvsroot/bison/bison/data/bison.simple,v
retrieving revision 1.18
diff -u -u -r1.18 bison.simple
--- data/bison.simple 2 May 2002 15:06:46 -0000 1.18
+++ data/bison.simple 2 May 2002 16:40:25 -0000
@@ -465,16 +465,14 @@
 #define YYERRCODE      256
 
 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
-   are run).
-
-   When YYLLOC_DEFAULT is run, CURRENT is set the location of the
-   first token.  By default, to implement support for ranges, extend
-   its range to the last symbol.  */
+   are run).  */
 
 #ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)               \
-   Current.last_line   = Rhs[[N]].last_line;   \
-   Current.last_column = Rhs[[N]].last_column;
+# define YYLLOC_DEFAULT(Current, Rhs, N)           \
+  Current.first_line   = Rhs[[1]].first_line;      \
+  Current.first_column = Rhs[[1]].first_column;    \
+  Current.last_line    = Rhs[[N]].last_line;       \
+  Current.last_column  = Rhs[[N]].last_column;
 #endif
 
 /* YYLEX -- calling `yylex' with the right arguments.  */
@@ -956,9 +954,7 @@
   yyval = yyvsp[1-yylen];
 
 #if YYLSP_NEEDED
-  /* Similarly for the default location.  Let the user run additional
-     commands if for instance locations are ranges.  */
-  yyloc = yylsp[1-yylen];
+  /* Default location. */
   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
 #endif
 
Index: doc/bison.texinfo
===================================================================
RCS file: /cvsroot/bison/bison/doc/bison.texinfo,v
retrieving revision 1.59
diff -u -u -r1.59 bison.texinfo
--- doc/bison.texinfo 2 May 2002 15:06:46 -0000 1.59
+++ doc/bison.texinfo 2 May 2002 16:40:26 -0000
@@ -2886,9 +2886,11 @@
 
 @example
 @group
-#define YYLLOC_DEFAULT(Current, Rhs, N)         \
-  Current.last_line   = Rhs[N].last_line;       \
-  Current.last_column = Rhs[N].last_column;
+#define YYLLOC_DEFAULT(Current, Rhs, N)          \
+  Current.first_line   = Rhs[1].first_line;      \
+  Current.first_column = Rhs[1].first_column;    \
+  Current.last_line    = Rhs[N].last_line;       \
+  Current.last_column  = Rhs[N].last_column;
 @end group
 @end example
 
@@ -2900,12 +2902,8 @@
 result) should be modified by @code{YYLLOC_DEFAULT}.
 
 @item
-Before @code{YYLLOC_DEFAULT} is executed, the output parser sets @code{@@$}
-to @code{@@1}.
-
address@hidden
-For consistency with semantic actions, valid indexes for the location array
-range from 1 to @var{n}.
+For consistency with semantic actions, valid indexes for the location
+array range from 1 to @var{n}.
 @end itemize
 
 @node Declarations



reply via email to

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