help-bison
[Top][All Lists]
Advanced

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

Re: Token value in custom error reporting


From: Akim Demaille
Subject: Re: Token value in custom error reporting
Date: Thu, 18 Jun 2020 18:53:04 +0200

Hi Adrian,

> Le 18 juin 2020 à 11:26, Adrian Vogelsgesang <avogelsgesang@tableau.com> a 
> écrit :
> 
> Hi Akim, hi Daniele,
> 
> It would probably help, if the error message would include something like
>> Hint: Did you mean to refer to table "MyTable" instead of the string-literal 
>> 'MyTable'?
>> If so, use double-quotes.

That does sound like a nice idea.

However, you might want to add a rule for this in your grammar: accept
identifiers where strings are expected, and generates the error message
there.  You could even register the error, and yet continue with the
identifier turned into a string.  Not just better diagnostics, but also
better error recovery.

It might be impractical if that generates tons of new conflicts, of course.

> That being said, this is clearly a nice-to-have and by no means necessary.
> Also, I guess I would run into different issues, first (e.g., when 
> encountering an error I would like to check "given the current state, would 
> an identifier be valid". I don't think bison currently offers the API to do 
> so)

Well, in a way it does: check if it's in the expected tokens.  Agreed,
it's more costly than it could be, but it's available.

I'm not opposed to extending the API, but it does frighten me:
API are really binding us, and make evolutions much more difficult.

Cheers!


reply via email to

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