On May 10, 2019, at 5:21 AM, Hans Åberg <haber...@telia.com> wrote:
> 
> 
>> On 10 May 2019, at 07:24, Akim Demaille <a...@lrde.epita.fr> wrote:
>> 
>>> In practice you just need the symbol name as is. Nobody needs the 
>>> translation,
>> 
>> I beg to disagree.  Nobody should translate the keyword "break",
>> but
>> 
>>> # bison /tmp/foo.y
>>> /tmp/foo.y:1.7: erreur: erreur de syntaxe, : inattendu, attendait char ou 
>>> identifier ou <tag>
>>>   1 | %token: FOO
>>>     |       ^
>> 
>> looks stupid; "char", "identifier" and "<tag>" should be translated.
> 
> I think it should only output whatever is in the yytname_ table. Does not the 
> translation taking place dynamically of that in the error message?

I don’t think it’s worthwhile for bison to support internationalization in the 
generated parser.

In fact, I do not think error messages in the generated parser should be 
provided by bison, except as a trivial default. Instead, I’d like to see bison 
call a function (which I provide) when a syntax error occurs, with a list of 
what was expected along with what was encountered. Obviously, they should be 
provided without translation. That would be the most flexible.

BTW, I suggested this in a message dates 6 Feb 2019, with more details, about 
what such an API might look like.

Derek




_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to