Parsing support for multiple keysyms per entry

Instead of allowing only one keysym per level per group, do as the
external API indicates and allow multiples.  The existing syntax is:
    key <AD01> { [ q, Q ] };
where the new syntax is:
    key <AD01> { [ q, Q, { H, E, L, L, O },
                 { Y, E, S, space, T, H, I, S, space, I, S, space, D, O, G } };

to make the key in the extreme top left of the keyboard do pretty
surprising things in levels 3 and 4.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2012-03-29 01:57:06 +01:00
parent 36b8771e1f
commit 9cdc1990fa
1 changed files with 12 additions and 1 deletions

View File

@ -145,7 +145,7 @@ extern int yylex(union YYSTYPE *val, struct YYLTYPE *loc, void *scanner);
%type <str> KeyName MapName OptMapName KeySym %type <str> KeyName MapName OptMapName KeySym
%type <sval> FieldSpec Ident Element String %type <sval> FieldSpec Ident Element String
%type <any> DeclList Decl %type <any> DeclList Decl
%type <expr> OptExprList ExprList Expr Term Lhs Terminal ArrayInit %type <expr> OptExprList ExprList Expr Term Lhs Terminal ArrayInit KeySyms
%type <expr> OptKeySymList KeySymList Action ActionList Coord CoordList %type <expr> OptKeySymList KeySymList Action ActionList Coord CoordList
%type <var> VarDecl VarDeclList SymbolsBody SymbolsVarDecl %type <var> VarDecl VarDeclList SymbolsBody SymbolsVarDecl
%type <vmod> VModDecl VModDefList VModDef %type <vmod> VModDecl VModDefList VModDef
@ -722,8 +722,19 @@ OptKeySymList : KeySymList { $$= $1; }
KeySymList : KeySymList COMMA KeySym KeySymList : KeySymList COMMA KeySym
{ $$= AppendKeysymList($1,$3); } { $$= AppendKeysymList($1,$3); }
| KeySymList COMMA KeySyms
{
$$= AppendKeysymList($1, strdup("NoSymbol"));
FreeStmt(&$3->common);
}
| KeySym | KeySym
{ $$= CreateKeysymList($1); } { $$= CreateKeysymList($1); }
| KeySyms
{ $$= CreateKeysymList(strdup("NoSymbol")); }
;
KeySyms : OBRACE KeySymList CBRACE
{ $$= $2; }
; ;
KeySym : IDENT { $$= $1; } KeySym : IDENT { $$= $1; }