bison-patches
[Top][All Lists]
Advanced

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

Re: Locations in bison itself are wrong


From: Akim Demaille
Subject: Re: Locations in bison itself are wrong
Date: Mon, 03 Mar 2003 12:10:25 +0100
User-agent: Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.2

| Akim Demaille <address@hidden> writes:
| > @@ -1069,6 +1073,7 @@
| >    yyssp = yyss;
| >    yyvsp = yyvs;
| >    yylsp = yyls;
| > +  *yylsp = b4_location_initial;
| >    goto yysetstate;
| >
| >  /*------------------------------------------------------------.
| >
| > with a bit more m4_ifdef so that only people specifying it will
| > trigger the code (any K&R portability issue with struct assignments?).
| 
| glr.c has this:
| 
| static YYLTYPE yyloc_default;

I don't think this is appropriate, as it prevents the user from
defining at the very least, the name of the file.
 
| and uses it unconditionally, without letting the user override it as
| far as I can see.  Is that the sort of thing you wanted to see?

We have the same objections.

| Hmm, how about something like this instead?  It would allow overriding.
| 
| #ifndef YYLOC_START_OF_INPUT
| # define YYLOC_START_OF_INPUT(loc) ((loc).last_line = 1, (loc).last_column = 
0)
| #endif
|
|     ...
|     yylsp = yyls;
|     YYLOC_START_OF_INPUT (*yylsp);
|     goto yysetstate;
| 
| That way, a user who overrides YYLLOC_DEFAULT can also override
| YYLOC_START_OF_INPUT consistently with YYLLOC_DEFAULT.

I'm not in favor of going further with cpp.  In his lalr1.cc, Robert
has decided to pass the initial location to the object.  I think he is
right.

Instead of a macro to set the fields of the initial location, I was
thinking of having a reference value, as in the piece of patch above.
But contrary to yyloc_default in GLR, the user would be able to
override the value, including using the name of a variable which
contents are set at runtime.




reply via email to

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