-KeyNameDecl : KeyName EQUALS KeyCode SEMI
- {
- KeycodeDef *def;
-
- def= KeycodeCreate($1,$3);
- free($1);
- $$= def;
- }
- ;
-
-KeyAliasDecl : ALIAS KeyName EQUALS KeyName SEMI
- {
- KeyAliasDef *def;
- def= KeyAliasCreate($2,$4);
- free($2);
- free($4);
- $$= def;
- }
- ;
-
-VModDecl : VIRTUAL_MODS VModDefList SEMI
- { $$= $2; }
- ;
-
-VModDefList : VModDefList COMMA VModDef
- { $$= (VModDef *)AppendStmt(&$1->common,&$3->common); }
- | VModDef
- { $$= $1; }
- ;
-
-VModDef : Ident
- { $$= VModCreate($1,NULL); }
- | Ident EQUALS Expr
- { $$= VModCreate($1,$3); }
- ;
-
-InterpretDecl : INTERPRET InterpretMatch OBRACE
- VarDeclList
- CBRACE SEMI
- {
- $2->def= $4;
- $$= $2;
- }
- ;
-
-InterpretMatch : KeySym PLUS Expr
- { $$= InterpCreate($1, $3); }
- | KeySym
- { $$= InterpCreate($1, NULL); }
- ;
-
-VarDeclList : VarDeclList VarDecl
- { $$= (VarDef *)AppendStmt(&$1->common,&$2->common); }
- | VarDecl
- { $$= $1; }
- ;
-
-KeyTypeDecl : TYPE String OBRACE
- VarDeclList
- CBRACE SEMI
- { $$= KeyTypeCreate($2,$4); }
- ;
-
-SymbolsDecl : KEY KeyName OBRACE
- SymbolsBody
- CBRACE SEMI
- { $$= SymbolsCreate($2,(ExprDef *)$4); free($2); }
- ;
-
-SymbolsBody : SymbolsBody COMMA SymbolsVarDecl
- { $$= (VarDef *)AppendStmt(&$1->common,&$3->common); }
- | SymbolsVarDecl
- { $$= $1; }
- | { $$= NULL; }
- ;
-
-SymbolsVarDecl : Lhs EQUALS Expr
- { $$= VarCreate($1,$3); }
- | Lhs EQUALS ArrayInit
- { $$= VarCreate($1,$3); }
- | Ident
- { $$= BoolVarCreate($1,1); }
- | EXCLAM Ident
- { $$= BoolVarCreate($2,0); }
- | ArrayInit
- { $$= VarCreate(NULL,$1); }
- ;
-
-ArrayInit : OBRACKET OptKeySymList CBRACKET
- { $$= $2; }
- | OBRACKET ActionList CBRACKET
- { $$= ExprCreateUnary(ExprActionList,TypeAction,$2); }
- ;
-
-GroupCompatDecl : GROUP Integer EQUALS Expr SEMI
- { $$= GroupCompatCreate($2,$4); }
- ;
-
-ModMapDecl : MODIFIER_MAP Ident OBRACE ExprList CBRACE SEMI
- { $$= ModMapCreate($2,$4); }
- ;
-
-IndicatorMapDecl: INDICATOR String OBRACE VarDeclList CBRACE SEMI
- { $$= IndicatorMapCreate($2,$4); }
- ;
-
-IndicatorNameDecl: INDICATOR Integer EQUALS Expr SEMI
- { $$= IndicatorNameCreate($2,$4,false); }
- | VIRTUAL INDICATOR Integer EQUALS Expr SEMI
- { $$= IndicatorNameCreate($3,$5,true); }
- ;
-
-ShapeDecl : SHAPE String OBRACE OutlineList CBRACE SEMI
- { $$= NULL; }
- | SHAPE String OBRACE CoordList CBRACE SEMI
- { $$= NULL; }
- ;
-
-SectionDecl : SECTION String OBRACE SectionBody CBRACE SEMI
- { $$= NULL; }
- ;
-
-SectionBody : SectionBody SectionBodyItem
- { $$= NULL;}
- | SectionBodyItem
- { $$= NULL; }
- ;
-
-SectionBodyItem : ROW OBRACE RowBody CBRACE SEMI
- { $$= NULL; }
- | VarDecl
- { FreeStmt(&$1->common); $$= NULL; }
- | DoodadDecl
- { $$= NULL; }
- | IndicatorMapDecl
- { FreeStmt(&$1->common); $$= NULL; }
- | OverlayDecl
- { $$= NULL; }
- ;
-
-RowBody : RowBody RowBodyItem
- { $$= NULL;}
- | RowBodyItem
- { $$= NULL; }
- ;
-
-RowBodyItem : KEYS OBRACE Keys CBRACE SEMI
- { $$= NULL; }
- | VarDecl
- { FreeStmt(&$1->common); $$= NULL; }
- ;
-
-Keys : Keys COMMA Key
- { $$= NULL; }
- | Key
- { $$= NULL; }
- ;
-
-Key : KeyName
- { free($1); $$= NULL; }
- | OBRACE ExprList CBRACE
- { FreeStmt(&$2->common); $$= NULL; }
- ;
-
-OverlayDecl : OVERLAY String OBRACE OverlayKeyList CBRACE SEMI
- { $$= NULL; }
- ;
-
-OverlayKeyList : OverlayKeyList COMMA OverlayKey
- { $$= NULL; }
- | OverlayKey
- { $$= NULL; }
- ;
-
-OverlayKey : KeyName EQUALS KeyName
- { free($1); free($3); $$= NULL; }
- ;
-
-OutlineList : OutlineList COMMA OutlineInList
- { $$= NULL;}
- | OutlineInList
- { $$= NULL; }
- ;
-
-OutlineInList : OBRACE CoordList CBRACE
- { $$= NULL; }
- | Ident EQUALS OBRACE CoordList CBRACE
- { $$= NULL; }
- | Ident EQUALS Expr
- { FreeStmt(&$3->common); $$= NULL; }
- ;
-
-CoordList : CoordList COMMA Coord
- { $$= NULL; }
- | Coord
- { $$= NULL; }
- ;
-
-Coord : OBRACKET SignedNumber COMMA SignedNumber CBRACKET
- { $$= NULL; }
- ;
-
-DoodadDecl : DoodadType String OBRACE VarDeclList CBRACE SEMI
- { FreeStmt(&$4->common); $$= NULL; }
- ;
-
-DoodadType : TEXT { $$= 0; }
- | OUTLINE { $$= 0; }
- | SOLID { $$= 0; }
- | LOGO { $$= 0; }
- ;
-
-FieldSpec : Ident { $$= $1; }
- | Element { $$= $1; }
- ;
-
-Element : ACTION_TOK
- { $$= xkb_atom_intern(param->ctx, "action"); }
- | INTERPRET
- { $$= xkb_atom_intern(param->ctx, "interpret"); }
- | TYPE
- { $$= xkb_atom_intern(param->ctx, "type"); }
- | KEY
- { $$= xkb_atom_intern(param->ctx, "key"); }
- | GROUP
- { $$= xkb_atom_intern(param->ctx, "group"); }
- | MODIFIER_MAP
- {$$= xkb_atom_intern(param->ctx, "modifier_map");}
- | INDICATOR
- { $$= xkb_atom_intern(param->ctx, "indicator"); }
- | SHAPE
- { $$= xkb_atom_intern(param->ctx, "shape"); }
- | ROW
- { $$= XKB_ATOM_NONE; }
- | SECTION
- { $$= XKB_ATOM_NONE; }
- | TEXT
- { $$= XKB_ATOM_NONE; }
- ;
-
-OptMergeMode : MergeMode { $$= $1; }
- | { $$= MergeDefault; }
- ;
-
-MergeMode : INCLUDE { $$= MergeDefault; }
- | AUGMENT { $$= MergeAugment; }
- | OVERRIDE { $$= MergeOverride; }
- | REPLACE { $$= MergeReplace; }
- | ALTERNATE { $$= MergeAltForm; }
- ;
-
-OptExprList : ExprList { $$= $1; }
- | { $$= NULL; }
- ;
-
-ExprList : ExprList COMMA Expr
- { $$= (ExprDef *)AppendStmt(&$1->common,&$3->common); }
- | Expr
- { $$= $1; }
- ;
-
-Expr : Expr DIVIDE Expr
- { $$= ExprCreateBinary(OpDivide,$1,$3); }
- | Expr PLUS Expr
- { $$= ExprCreateBinary(OpAdd,$1,$3); }
- | Expr MINUS Expr
- { $$= ExprCreateBinary(OpSubtract,$1,$3); }
- | Expr TIMES Expr
- { $$= ExprCreateBinary(OpMultiply,$1,$3); }
- | Lhs EQUALS Expr
- { $$= ExprCreateBinary(OpAssign,$1,$3); }
- | Term
- { $$= $1; }
- ;
-
-Term : MINUS Term
- { $$= ExprCreateUnary(OpNegate,$2->type,$2); }
- | PLUS Term
- { $$= ExprCreateUnary(OpUnaryPlus,$2->type,$2); }
- | EXCLAM Term
- { $$= ExprCreateUnary(OpNot,TypeBoolean,$2); }
- | INVERT Term
- { $$= ExprCreateUnary(OpInvert,$2->type,$2); }
- | Lhs
- { $$= $1; }
- | FieldSpec OPAREN OptExprList CPAREN %prec OPAREN
- { $$= ActionCreate($1,$3); }
- | Terminal
- { $$= $1; }
- | OPAREN Expr CPAREN
- { $$= $2; }
- ;
-
-ActionList : ActionList COMMA Action
- { $$= (ExprDef *)AppendStmt(&$1->common,&$3->common); }
- | Action
- { $$= $1; }
- ;
-
-Action : FieldSpec OPAREN OptExprList CPAREN
- { $$= ActionCreate($1,$3); }
- ;
-
-Lhs : FieldSpec
- {
- ExprDef *expr;
- expr= ExprCreate(ExprIdent,TypeUnknown);
- expr->value.str= $1;
- $$= expr;
- }
- | FieldSpec DOT FieldSpec
- {
- ExprDef *expr;
- expr= ExprCreate(ExprFieldRef,TypeUnknown);
- expr->value.field.element= $1;
- expr->value.field.field= $3;
- $$= expr;
- }
- | FieldSpec OBRACKET Expr CBRACKET
- {
- ExprDef *expr;
- expr= ExprCreate(ExprArrayRef,TypeUnknown);
- expr->value.array.element= XKB_ATOM_NONE;
- expr->value.array.field= $1;
- expr->value.array.entry= $3;
- $$= expr;
- }
- | FieldSpec DOT FieldSpec OBRACKET Expr CBRACKET
- {
- ExprDef *expr;
- expr= ExprCreate(ExprArrayRef,TypeUnknown);
- expr->value.array.element= $1;
- expr->value.array.field= $3;
- expr->value.array.entry= $5;
- $$= expr;
- }
- ;
-
-Terminal : String
- {
- ExprDef *expr;
- expr= ExprCreate(ExprValue,TypeString);
- expr->value.str= $1;
- $$= expr;
- }
- | Integer
- {
- ExprDef *expr;
- expr= ExprCreate(ExprValue,TypeInt);
- expr->value.ival= $1;
- $$= expr;
- }
- | Float
- {
- $$= NULL;
- }
- | KeyName
- {
- ExprDef *expr;
- expr= ExprCreate(ExprValue,TypeKeyName);
- memset(expr->value.keyName,0,5);
- strncpy(expr->value.keyName,$1,4);
- free($1);
- $$= expr;
- }
- ;
-
-OptKeySymList : KeySymList { $$= $1; }
- | { $$= NULL; }
- ;
-
-KeySymList : KeySymList COMMA KeySym
- { $$= AppendKeysymList($1,$3); }
- | KeySymList COMMA KeySyms
- { $$= AppendMultiKeysymList($1,$3); }
- | KeySym
- { $$= CreateKeysymList($1); }
- | KeySyms
- { $$= CreateMultiKeysymList($1); }
- ;