From: Daniel Stone Date: Thu, 29 Mar 2012 00:57:06 +0000 (+0100) Subject: Parsing support for multiple keysyms per entry X-Git-Tag: xkbcommon-0.2.0~671 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9cdc1990fa5cf1de7d36de2e659ad7548d4e6a72;p=platform%2Fupstream%2Flibxkbcommon.git 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 { [ q, Q ] }; where the new syntax is: key { [ 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 --- diff --git a/src/xkbcomp/xkbparse.y b/src/xkbcomp/xkbparse.y index 230d24f..62ef3d4 100644 --- a/src/xkbcomp/xkbparse.y +++ b/src/xkbcomp/xkbparse.y @@ -145,7 +145,7 @@ extern int yylex(union YYSTYPE *val, struct YYLTYPE *loc, void *scanner); %type KeyName MapName OptMapName KeySym %type FieldSpec Ident Element String %type DeclList Decl -%type OptExprList ExprList Expr Term Lhs Terminal ArrayInit +%type OptExprList ExprList Expr Term Lhs Terminal ArrayInit KeySyms %type OptKeySymList KeySymList Action ActionList Coord CoordList %type VarDecl VarDeclList SymbolsBody SymbolsVarDecl %type VModDecl VModDefList VModDef @@ -722,10 +722,21 @@ OptKeySymList : KeySymList { $$= $1; } KeySymList : KeySymList COMMA KeySym { $$= AppendKeysymList($1,$3); } + | KeySymList COMMA KeySyms + { + $$= AppendKeysymList($1, strdup("NoSymbol")); + FreeStmt(&$3->common); + } | KeySym { $$= CreateKeysymList($1); } + | KeySyms + { $$= CreateKeysymList(strdup("NoSymbol")); } ; +KeySyms : OBRACE KeySymList CBRACE + { $$= $2; } + ; + KeySym : IDENT { $$= $1; } | SECTION { $$= strdup("section"); } | Integer