Commit 9cdc1990fa5cf1de7d36de2e659ad7548d4e6a72

Daniel Stone 2012-03-29T01:57:06

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>

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 <str>	KeyName MapName OptMapName KeySym
 %type <sval>	FieldSpec Ident Element String
 %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 <var>	VarDecl VarDeclList SymbolsBody SymbolsVarDecl
 %type <vmod>	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