bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] misleading references


From: Joel E. Denny
Subject: Re: [PATCH] misleading references
Date: Sat, 8 Aug 2009 19:18:31 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

Hi Alex.

On Sat, 8 Aug 2009, Alex Rozenman wrote:

> I pushed the attached commit to master and branch-2.5. This will convert
> "misleading references" errors into warnings.

Thanks.

> 1. Is there some way to keep sub-messages aligned ? For example if I have:
> test.y:51.51-60: warning: misleading reference: `$<ival>exp'
> test.y:42.1-3: warning:   refers to: $exp at $$
> test.y:51.7: warning:   possibly meant: $x, hiding $exp at $1
> test.y:51.41: warning:   possibly meant: $r, hiding $exp at $4
> Sub-messages change their position according to number of digits in location
> info. Is it acceptable to develop some mechanism in order to keep all this
> stuff aligned ?

I'd be fine with that.

> 2. In the previous example, in suggestions, bison prints "$exp" instead of
> $<ival>exp. I am going to fix it.

Agreed.

> 3. As it was reported by Akim, in cases of "symbol not found", bison
> currently prints all the reference including dots and dashes. For example:
> stat: sym_a sym_b { func($some_other.field); };
> bison prints:
> test1.y:5.8-21: invalid reference: `$some_other.field', symbol not found

If we really need a special message for the case of no suggestions, I feel 
that this is not the right message.

> In my opinion the message is correct, but keeping in mind that this is the
> most frequent error message, we can simplify it, for example:
> 
> test1.y:5.8-15: invalid reference: `$some_other', symbol not found

I call that a value reference not a symbol.

> or
> test1.y:5.9-15: symbol not found: some_other

Consider this example:

  start.x: { $start.x; }

for which Bison currently reports:

  tmp.y:2.12-19: invalid reference: `$start.x'
  tmp.y:2.1-7:   possibly meant: $[start.x] at $$

but, for consistency with your example, it seems like it should be:

  tmp.y:2.12-19: symbol not found: start
  tmp.y:2.1-7:   possibly meant: $[start.x] at $$

That is, in both of our examples, the symbol that the user actually 
specified in the reference wasn't found, but Bison currently reports 
"symbol not found" only in your case.  The difference is not really 
whether the specified symbol was found.  The difference is whether any 
suggestions for how to fix the reference were found, so maybe Bison should 
do this:

  start.x: { $start.x; }

  tmp.y:2.12-19: invalid reference: `$start.x'
  tmp.y:2.1-7:     possibly meant: $[start.x] at $$


  stat: sym_a sym_b { func($some_other.field); };

  test1.y:5.8-21: invalid reference: `$some_other.field'
  test1.y:5.8-21:   no suggestions found

But again, if no suggestions are printed, no suggestions are found, so it 
seems redundant to say so.

> or
> test1.y:5.8-21: invalid reference: `$some_other.field', symbol not found:
> some_other

Same argument as above.




reply via email to

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