Skip to content

Commit

Permalink
symbols: Parse empty key
Browse files Browse the repository at this point in the history
The following syntax does not parse in xkbcommon, but it does in xkbcomp:

```
xkb_symbols "x" {
    key <AD01> { };
};
```

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.
  • Loading branch information
wismill committed Dec 28, 2024
1 parent 09ae46d commit bf03b4b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/xkbcomp/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ resolve_keysym(struct parser_param *param, const char *name, xkb_keysym_t *sym_r
%type <expr> MultiKeySymList KeySymList MultiActionList ActionList Action Coord CoordList
%type <exprList> OptExprList ExprList
%type <var> VarDecl SymbolsVarDecl
%type <varList> VarDeclList SymbolsBody
%type <varList> VarDeclList SymbolsBody OptSymbolsBody
%type <vmod> VModDef
%type <vmodList> VModDefList VModDecl
%type <interp> InterpretDecl InterpretMatch
Expand Down Expand Up @@ -458,11 +458,15 @@ KeyTypeDecl : TYPE String OBRACE
;

SymbolsDecl : KEY KEYNAME OBRACE
SymbolsBody
OptSymbolsBody
CBRACE SEMI
{ $$ = SymbolsCreate($2, $4.head); }
;

OptSymbolsBody : SymbolsBody { $$ = $1; }
| { $$.head = $$.last = NULL; }
;

SymbolsBody : SymbolsBody COMMA SymbolsVarDecl
{ $$.head = $1.head; $$.last->common.next = &$3->common; $$.last = $3; }
| SymbolsVarDecl
Expand Down

0 comments on commit bf03b4b

Please sign in to comment.