[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/4] gettext-tools: use %define api.prefix
From: |
Akim Demaille |
Subject: |
Re: [PATCH 4/4] gettext-tools: use %define api.prefix |
Date: |
Sat, 2 May 2020 06:43:29 +0200 |
> Le 1 mai 2020 à 22:07, Bruno Haible <address@hidden> a écrit :
>
> Hi Akim,
>
>> This was introduced in Bison 2.6.
>>
>> * gettext-tools/src/po-gram-gen.y: Use Bison's api.prefix instead of
>> handling renaming by hand. New symbols would have been not renamed.
>
> Thanks. One more thing I did not know about. Applied.
>
> Note that Bison 3.0, not 2.6, is the minimum required Bison version for
> this change. With Bison 2.7.1, I get
>
> po-gram-gen.y:22.20-29: erreur: erreur de syntaxe, {...} inattendu
Heck, you are right, I forgot about that.
At the beginning we only had one type of values for variables,
so they were all written like strings. So indeed in 2.6 we
introduced `%define api.prefix "foo_"`.
But in 3.0 we introduced variable types, so that in addition
of `"foo"` (now for strings), there is `{foo}` (for code or snippets)
and `foo` (for keywords, i.e., enums if you wish). Existing
variables such as api.prefix were "typed" appropriately, therefore
{foo_} rather than "foo_" in this case.
Of course we did not break compatibility: older variables are
"casted" when needed.
Therefore you have two options:
- require 3.0 and you're done
- require 2.6 and use api.prefix with `"foo_"`, but get warnings
from -Wdeprecated.
FWIW, bison --update should correctly fix grammar files using
the old syntax to the current one.
Cheers!