-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xkbcomp: Some lists are not allow to be empty #565
Comments
Sorry that's not actually what I meant in that comment. I forgot that xkbcommon doesn't parse empty blocks so my example was a bit too simplified. And, in fact, keys are not affected at all by what I meant. What I meant is the following: static bool
UseNewInterpField(enum si_field field, SymInterpInfo *old, SymInterpInfo *new,
bool report, enum si_field *collide)
{
if (!(old->defined & field))
return true; but, correctly for keys: static bool
UseNewKeyField(enum key_field field, enum key_field old, enum key_field new,
bool clobber, bool report, enum key_field *collide)
{
if (!(old & field))
return (new & field); Example:
Output:
Removing the second interpret produces the correct output:
|
I believe this can be determined easily by looking at parser.y. I believe that most lists do not allow empty interiors. E.g.
requires at least 2 elements.
requires at least 1 element. |
@mahkoh Correct: We do not allow e.g.
I am not sure if there is a relevant use case for this, other than What list do you see relevant to allow to be empty, apart of #567? |
I allow all lists to be empty in my implementation. I believe that is simplest both for the implementation and users. |
There is no real use case then. Implementation-wise it is easier in our code base to work with non-empty lists. I think we allow empty lists in enough relevant places. People hacking the remaining places where empty lists are not supported should be considered experts and will know how to fix it. We may add support for this, but writing the corresponding tests will be most of the effort, so I am postponing this as very low priority. |
(Follow-up of this comment
The following syntax does not parse in xkbcommon, but it does in
xkbcomp
:While the usefulness of such statement is debatable, the fact that it does parse in
xkbcomp
and that tools may generate such keymap entry make it relevant to handle.There are other places we could allow empty lists as well.
CC @mahkoh who detected this issue
The text was updated successfully, but these errors were encountered: