bug-bison
[Top][All Lists]
Advanced

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

Re: error-tokens and locations?


From: Paul Eggert
Subject: Re: error-tokens and locations?
Date: 11 Dec 2003 13:10:27 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

On 2003-11-19 Ian Badcoe <address@hidden> writes:

> So N == 0 is conceptually odd (how do you merge no tokens)

I would say that the result should be an "empty location", e.g., one
whose start position comes after its end position.

> and programmatically it accesses the zero-element of the rhs array,
> which is not supposed to be used (when built on another compiler, it
> looks uninitialised).

That problem has been addressed in Bison CVS.  You are now supposed
specify a default value for the rhs array's zero-element, if your
grammar can generate such actions.  The patch at the end of this
message will do that.

Savannah.gnu.org is currently in a messed-up state, so you need to
do the following to get the latest Bison CVS:

cvs -d:ext:address@hidden:/cvs-latest/bison co bison

Here's how to patch your example to specify an initial value for the
zero element of the rhs line number array.

--- .del/LowLevelParser.y       Tue Nov 18 13:30:49 2003
+++ LowLevelParser.y    Thu Dec 11 13:03:10 2003
@@ -12,6 +12,12 @@
 
 %}
 
+%initial-action
+{
+  @$.first_line   = @$.last_line   = 1;
+  @$.first_column = @$.last_column = 0;
+}
+
 %token NAME
 %token STRING
 %token BAD_CHARACTER




reply via email to

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