[Top][All Lists]

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


From: Akim Demaille
Subject: Re: FYI: yacc.c: YY_LOCATION_PRINT: Fix
Date: Thu, 30 Sep 2004 10:40:28 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

>>> "Paul" == Paul Eggert <address@hidden> writes:

 >> In the case above it would "accurately" consider that the empty
 >> reduction spans one character (the white space).

 > That sounds a bit counterintuitive from the user viewpoint.

I agree.

 > If empty locations contain characters, they won't seem empty.

But the user should be able to see the difference bw empty for the
syntax, and nothing for the lexical level.

Anyway, I agree, an empty location is a nice property.

 > More generally, if the parser identifies several empty locations
 > between "foo" and "bar", there is a constraint that the locations
 > should be in the correct left-to-right order required by the grammar.


 > Are you attempting to have the parser always keep track of the
 > maximal white space around every empty location?

No, that's not the origin of my question.  It started with trying to
fix the YY_DEFAULT_LOCATION computation for the empty rhs case.  The
easiest (and easiest to document) is to declare that in this case, the
location is empty, and set to the end of the previous symbol (which is
now also defined at the very start of the parsing).  But an constraint
I gave myself was to stick to the previous definition of the
locations, including the ill-designed YYLLOC_DEFAULT.

But with YYLLOC_DEFAULT as is today there is just no way to implement
that.  What you can implement though, is the location "between" the
previous symbol, and the lookahead.

 > However, if this is the goal,

My goal is to have the most accurate error messages as possible.  But
yet I never experienced a situation where an empty location would have
to be triggered and reported to the user.   Since I didn't live this
experience, I'm not really sure what the user would like to see.

The more I work on this location, the more I wish we'd design a nice
system, similar to what we have in, or what bison has for
itself.  That's much more logical, and such a situation would be easy
to fix.

Maybe it's time to introduce something like %new-locations.

reply via email to

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