parser: untabify

Run vim's :%retab and some resulting indention fixes.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-07-25 21:37:20 +03:00
parent 724f62c8e3
commit 01c81fa61e
2 changed files with 694 additions and 733 deletions

View File

@ -116,7 +116,9 @@ yyerror(struct YYLTYPE *loc, struct parser_param *param, const char *msg)
%left TIMES DIVIDE
%left EXCLAM INVERT
%left OPAREN
%start XkbFile
%union {
int ival;
unsigned uval;
@ -142,6 +144,7 @@ yyerror(struct YYLTYPE *loc, struct parser_param *param, const char *msg)
void *geom;
XkbFile *file;
}
%type <num> INTEGER FLOAT
%type <str> IDENT STRING
%type <keyName> KEYNAME KeyName
@ -170,58 +173,55 @@ yyerror(struct YYLTYPE *loc, struct parser_param *param, const char *msg)
%type <geom> DoodadDecl
%type <file> XkbFile XkbMapConfigList XkbMapConfig XkbConfig
%type <file> XkbCompositeMap XkbCompMapList
%%
XkbFile : XkbCompMapList
{ $$= param->rtrn= $1; }
{ $$ = param->rtrn = $1; }
| XkbMapConfigList
{ $$= param->rtrn= $1; }
{ $$ = param->rtrn = $1; }
| XkbConfig
{ $$= param->rtrn= $1; }
{ $$ = param->rtrn = $1; }
;
XkbCompMapList : XkbCompMapList XkbCompositeMap
{ $$= (XkbFile *)AppendStmt(&$1->common,&$2->common); }
{ $$ = (XkbFile *)AppendStmt(&$1->common, &$2->common); }
| XkbCompositeMap
{ $$= $1; }
{ $$ = $1; }
;
XkbCompositeMap : OptFlags XkbCompositeType OptMapName OBRACE
XkbMapConfigList
CBRACE SEMI
{
$$ = CreateXKBFile(param->ctx, $2, $3,
&$5->common, $1);
}
{ $$ = CreateXKBFile(param->ctx, $2, $3, &$5->common, $1); }
;
XkbCompositeType: XKB_KEYMAP { $$= FILE_TYPE_KEYMAP; }
| XKB_SEMANTICS { $$= FILE_TYPE_KEYMAP; }
| XKB_LAYOUT { $$= FILE_TYPE_KEYMAP; }
XkbCompositeType: XKB_KEYMAP { $$ = FILE_TYPE_KEYMAP; }
| XKB_SEMANTICS { $$ = FILE_TYPE_KEYMAP; }
| XKB_LAYOUT { $$ = FILE_TYPE_KEYMAP; }
;
XkbMapConfigList : XkbMapConfigList XkbMapConfig
{
if (!$2)
$$= $1;
$$ = $1;
else
$$= (XkbFile *)AppendStmt(&$1->common,&$2->common);
$$ = (XkbFile *)AppendStmt(&$1->common, &$2->common);
}
| XkbMapConfig
{ $$= $1; }
{ $$ = $1; }
;
XkbMapConfig : OptFlags FileType OptMapName OBRACE
DeclList
CBRACE SEMI
{
if ($2 == FILE_TYPE_GEOMETRY)
{
if ($2 == FILE_TYPE_GEOMETRY) {
free($3);
FreeStmt($5);
$$= NULL;
$$ = NULL;
}
else
{
else {
$$ = CreateXKBFile(param->ctx, $2, $3, $5, $1);
}
}
@ -229,369 +229,339 @@ XkbMapConfig : OptFlags FileType OptMapName OBRACE
XkbConfig : OptFlags FileType OptMapName DeclList
{
if ($2 == FILE_TYPE_GEOMETRY)
{
if ($2 == FILE_TYPE_GEOMETRY) {
free($3);
FreeStmt($4);
$$= NULL;
$$ = NULL;
}
else
{
else {
$$ = CreateXKBFile(param->ctx, $2, $3, $4, $1);
}
}
;
FileType : XKB_KEYCODES { $$= FILE_TYPE_KEYCODES; }
| XKB_TYPES { $$= FILE_TYPE_TYPES; }
| XKB_COMPATMAP { $$= FILE_TYPE_COMPAT; }
| XKB_SYMBOLS { $$= FILE_TYPE_SYMBOLS; }
| XKB_GEOMETRY { $$= FILE_TYPE_GEOMETRY; }
FileType : XKB_KEYCODES { $$ = FILE_TYPE_KEYCODES; }
| XKB_TYPES { $$ = FILE_TYPE_TYPES; }
| XKB_COMPATMAP { $$ = FILE_TYPE_COMPAT; }
| XKB_SYMBOLS { $$ = FILE_TYPE_SYMBOLS; }
| XKB_GEOMETRY { $$ = FILE_TYPE_GEOMETRY; }
;
OptFlags : Flags { $$= $1; }
| { $$= 0; }
OptFlags : Flags { $$ = $1; }
| { $$ = 0; }
;
Flags : Flags Flag { $$= (($1)|($2)); }
| Flag { $$= $1; }
Flags : Flags Flag { $$ = ($1 | $2); }
| Flag { $$ = $1; }
;
Flag : PARTIAL { $$= XkbLC_Partial; }
| DEFAULT { $$= XkbLC_Default; }
| HIDDEN { $$= XkbLC_Hidden; }
| ALPHANUMERIC_KEYS { $$= XkbLC_AlphanumericKeys; }
| MODIFIER_KEYS { $$= XkbLC_ModifierKeys; }
| KEYPAD_KEYS { $$= XkbLC_KeypadKeys; }
| FUNCTION_KEYS { $$= XkbLC_FunctionKeys; }
| ALTERNATE_GROUP { $$= XkbLC_AlternateGroup; }
Flag : PARTIAL { $$ = XkbLC_Partial; }
| DEFAULT { $$ = XkbLC_Default; }
| HIDDEN { $$ = XkbLC_Hidden; }
| ALPHANUMERIC_KEYS { $$ = XkbLC_AlphanumericKeys; }
| MODIFIER_KEYS { $$ = XkbLC_ModifierKeys; }
| KEYPAD_KEYS { $$ = XkbLC_KeypadKeys; }
| FUNCTION_KEYS { $$ = XkbLC_FunctionKeys; }
| ALTERNATE_GROUP { $$ = XkbLC_AlternateGroup; }
;
DeclList : DeclList Decl
{ $$= AppendStmt($1,$2); }
| { $$= NULL; }
{ $$ = AppendStmt($1, $2); }
| { $$ = NULL; }
;
Decl : OptMergeMode VarDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode VModDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode InterpretDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode KeyNameDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode KeyAliasDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode KeyTypeDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode SymbolsDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode ModMapDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode GroupCompatDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode IndicatorMapDecl
{
$2->merge= $1;
$$= &$2->common;
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode IndicatorNameDecl
{
$2->merge= $1;
$$= &$2->common;
}
| OptMergeMode ShapeDecl
{
}
| OptMergeMode SectionDecl
{
}
| OptMergeMode DoodadDecl
{
$2->merge = $1;
$$ = &$2->common;
}
| OptMergeMode ShapeDecl { }
| OptMergeMode SectionDecl { }
| OptMergeMode DoodadDecl { }
| MergeMode STRING
{
$$= &IncludeCreate(param->ctx, $2, $1)->common;
$$ = &IncludeCreate(param->ctx, $2, $1)->common;
free($2);
}
;
VarDecl : Lhs EQUALS Expr SEMI
{ $$= VarCreate($1,$3); }
{ $$ = VarCreate($1, $3); }
| Ident SEMI
{ $$= BoolVarCreate($1,1); }
{ $$ = BoolVarCreate($1, 1); }
| EXCLAM Ident SEMI
{ $$= BoolVarCreate($2,0); }
{ $$ = BoolVarCreate($2, 0); }
;
KeyNameDecl : KeyName EQUALS KeyCode SEMI
{
$$ = KeycodeCreate($1, $3);
}
{ $$ = KeycodeCreate($1, $3); }
;
KeyAliasDecl : ALIAS KeyName EQUALS KeyName SEMI
{
$$= KeyAliasCreate($2,$4);
}
{ $$ = KeyAliasCreate($2, $4); }
;
VModDecl : VIRTUAL_MODS VModDefList SEMI
{ $$= $2; }
{ $$ = $2; }
;
VModDefList : VModDefList COMMA VModDef
{ $$= (VModDef *)AppendStmt(&$1->common,&$3->common); }
{ $$ = (VModDef *)AppendStmt(&$1->common, &$3->common); }
| VModDef
{ $$= $1; }
{ $$ = $1; }
;
VModDef : Ident
{ $$= VModCreate($1,NULL); }
{ $$ = VModCreate($1, NULL); }
| Ident EQUALS Expr
{ $$= VModCreate($1,$3); }
{ $$ = VModCreate($1, $3); }
;
InterpretDecl : INTERPRET InterpretMatch OBRACE
VarDeclList
CBRACE SEMI
{
$2->def= $4;
$$= $2;
}
{ $2->def = $4; $$ = $2; }
;
InterpretMatch : KeySym PLUS Expr
{ $$= InterpCreate($1, $3); }
{ $$ = InterpCreate($1, $3); }
| KeySym
{ $$= InterpCreate($1, NULL); }
{ $$ = InterpCreate($1, NULL); }
;
VarDeclList : VarDeclList VarDecl
{ $$= (VarDef *)AppendStmt(&$1->common,&$2->common); }
{ $$ = (VarDef *)AppendStmt(&$1->common, &$2->common); }
| VarDecl
{ $$= $1; }
{ $$ = $1; }
;
KeyTypeDecl : TYPE String OBRACE
VarDeclList
CBRACE SEMI
{ $$= KeyTypeCreate($2,$4); }
{ $$ = KeyTypeCreate($2, $4); }
;
SymbolsDecl : KEY KeyName OBRACE
SymbolsBody
CBRACE SEMI
{ $$= SymbolsCreate($2,(ExprDef *)$4); }
{ $$ = SymbolsCreate($2, (ExprDef *)$4); }
;
SymbolsBody : SymbolsBody COMMA SymbolsVarDecl
{ $$= (VarDef *)AppendStmt(&$1->common,&$3->common); }
{ $$ = (VarDef *)AppendStmt(&$1->common, &$3->common); }
| SymbolsVarDecl
{ $$= $1; }
| { $$= NULL; }
{ $$ = $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); }
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; }
{ $$ = $2; }
| OBRACKET ActionList CBRACKET
{ $$= ExprCreateUnary(EXPR_ACTION_LIST, EXPR_TYPE_ACTION, $2); }
{ $$ = ExprCreateUnary(EXPR_ACTION_LIST, EXPR_TYPE_ACTION, $2); }
;
GroupCompatDecl : GROUP Integer EQUALS Expr SEMI
{ $$= GroupCompatCreate($2,$4); }
{ $$ = GroupCompatCreate($2, $4); }
;
ModMapDecl : MODIFIER_MAP Ident OBRACE ExprList CBRACE SEMI
{ $$= ModMapCreate($2,$4); }
{ $$ = ModMapCreate($2, $4); }
;
IndicatorMapDecl: INDICATOR String OBRACE VarDeclList CBRACE SEMI
{ $$= IndicatorMapCreate($2,$4); }
{ $$ = IndicatorMapCreate($2, $4); }
;
IndicatorNameDecl: INDICATOR Integer EQUALS Expr SEMI
{ $$= IndicatorNameCreate($2,$4,false); }
{ $$ = IndicatorNameCreate($2, $4, false); }
| VIRTUAL INDICATOR Integer EQUALS Expr SEMI
{ $$= IndicatorNameCreate($3,$5,true); }
{ $$ = IndicatorNameCreate($3, $5, true); }
;
ShapeDecl : SHAPE String OBRACE OutlineList CBRACE SEMI
{ $$= NULL; }
{ $$ = NULL; }
| SHAPE String OBRACE CoordList CBRACE SEMI
{ $$= NULL; }
{ $$ = NULL; }
;
SectionDecl : SECTION String OBRACE SectionBody CBRACE SEMI
{ $$= NULL; }
{ $$ = NULL; }
;
SectionBody : SectionBody SectionBodyItem
{ $$= NULL;}
| SectionBodyItem
{ $$= NULL; }
SectionBody : SectionBody SectionBodyItem { $$ = NULL;}
| SectionBodyItem { $$ = NULL; }
;
SectionBodyItem : ROW OBRACE RowBody CBRACE SEMI
{ $$= NULL; }
{ $$ = NULL; }
| VarDecl
{ FreeStmt(&$1->common); $$= NULL; }
{ FreeStmt(&$1->common); $$ = NULL; }
| DoodadDecl
{ $$= NULL; }
{ $$ = NULL; }
| IndicatorMapDecl
{ FreeStmt(&$1->common); $$= NULL; }
{ FreeStmt(&$1->common); $$ = NULL; }
| OverlayDecl
{ $$= NULL; }
{ $$ = NULL; }
;
RowBody : RowBody RowBodyItem
{ $$= NULL;}
| RowBodyItem
{ $$= NULL; }
RowBody : RowBody RowBodyItem { $$ = NULL;}
| RowBodyItem { $$ = NULL; }
;
RowBodyItem : KEYS OBRACE Keys CBRACE SEMI
{ $$= NULL; }
RowBodyItem : KEYS OBRACE Keys CBRACE SEMI { $$ = NULL; }
| VarDecl
{ FreeStmt(&$1->common); $$= NULL; }
{ FreeStmt(&$1->common); $$ = NULL; }
;
Keys : Keys COMMA Key
{ $$= NULL; }
| Key
{ $$= NULL; }
Keys : Keys COMMA Key { $$ = NULL; }
| Key { $$ = NULL; }
;
Key : KeyName
{ $$= NULL; }
{ $$ = NULL; }
| OBRACE ExprList CBRACE
{ FreeStmt(&$2->common); $$= NULL; }
{ FreeStmt(&$2->common); $$ = NULL; }
;
OverlayDecl : OVERLAY String OBRACE OverlayKeyList CBRACE SEMI
{ $$= NULL; }
{ $$ = NULL; }
;
OverlayKeyList : OverlayKeyList COMMA OverlayKey
{ $$= NULL; }
| OverlayKey
{ $$= NULL; }
OverlayKeyList : OverlayKeyList COMMA OverlayKey { $$ = NULL; }
| OverlayKey { $$ = NULL; }
;
OverlayKey : KeyName EQUALS KeyName
{ $$= NULL; }
OverlayKey : KeyName EQUALS KeyName { $$ = NULL; }
;
OutlineList : OutlineList COMMA OutlineInList
{ $$= NULL;}
{ $$ = NULL;}
| OutlineInList
{ $$= NULL; }
{ $$ = NULL; }
;
OutlineInList : OBRACE CoordList CBRACE
{ $$= NULL; }
{ $$ = NULL; }
| Ident EQUALS OBRACE CoordList CBRACE
{ $$= NULL; }
{ $$ = NULL; }
| Ident EQUALS Expr
{ FreeStmt(&$3->common); $$= NULL; }
{ FreeStmt(&$3->common); $$ = NULL; }
;
CoordList : CoordList COMMA Coord
{ $$= NULL; }
{ $$ = NULL; }
| Coord
{ $$= NULL; }
{ $$ = NULL; }
;
Coord : OBRACKET SignedNumber COMMA SignedNumber CBRACKET
{ $$= NULL; }
{ $$ = NULL; }
;
DoodadDecl : DoodadType String OBRACE VarDeclList CBRACE SEMI
{ FreeStmt(&$4->common); $$= NULL; }
{ FreeStmt(&$4->common); $$ = NULL; }
;
DoodadType : TEXT { $$= 0; }
| OUTLINE { $$= 0; }
| SOLID { $$= 0; }
| LOGO { $$= 0; }
DoodadType : TEXT { $$ = 0; }
| OUTLINE { $$ = 0; }
| SOLID { $$ = 0; }
| LOGO { $$ = 0; }
;
FieldSpec : Ident { $$= $1; }
| Element { $$= $1; }
FieldSpec : Ident { $$ = $1; }
| Element { $$ = $1; }
;
Element : ACTION_TOK
{ $$= xkb_atom_intern(param->ctx, "action"); }
{ $$ = xkb_atom_intern(param->ctx, "action"); }
| INTERPRET
{ $$= xkb_atom_intern(param->ctx, "interpret"); }
{ $$ = xkb_atom_intern(param->ctx, "interpret"); }
| TYPE
{ $$= xkb_atom_intern(param->ctx, "type"); }
{ $$ = xkb_atom_intern(param->ctx, "type"); }
| KEY
{ $$= xkb_atom_intern(param->ctx, "key"); }
{ $$ = xkb_atom_intern(param->ctx, "key"); }
| GROUP
{ $$= xkb_atom_intern(param->ctx, "group"); }
{ $$ = xkb_atom_intern(param->ctx, "group"); }
| MODIFIER_MAP
{$$= xkb_atom_intern(param->ctx, "modifier_map");}
{$$ = xkb_atom_intern(param->ctx, "modifier_map");}
| INDICATOR
{ $$= xkb_atom_intern(param->ctx, "indicator"); }
{ $$ = xkb_atom_intern(param->ctx, "indicator"); }
| SHAPE
{ $$= xkb_atom_intern(param->ctx, "shape"); }
{ $$ = xkb_atom_intern(param->ctx, "shape"); }
| ROW
{ $$= XKB_ATOM_NONE; }
{ $$ = XKB_ATOM_NONE; }
| SECTION
{ $$= XKB_ATOM_NONE; }
{ $$ = XKB_ATOM_NONE; }
| TEXT
{ $$= XKB_ATOM_NONE; }
{ $$ = XKB_ATOM_NONE; }
;
OptMergeMode : MergeMode { $$= $1; }
| { $$= MERGE_DEFAULT; }
OptMergeMode : MergeMode { $$ = $1; }
| { $$ = MERGE_DEFAULT; }
;
MergeMode : INCLUDE { $$= MERGE_DEFAULT; }
| AUGMENT { $$= MERGE_AUGMENT; }
| OVERRIDE { $$= MERGE_OVERRIDE; }
| REPLACE { $$= MERGE_REPLACE; }
MergeMode : INCLUDE { $$ = MERGE_DEFAULT; }
| AUGMENT { $$ = MERGE_AUGMENT; }
| OVERRIDE { $$ = MERGE_OVERRIDE; }
| REPLACE { $$ = MERGE_REPLACE; }
| ALTERNATE
{
/*
@ -602,195 +572,186 @@ MergeMode : INCLUDE { $$= MERGE_DEFAULT; }
}
;
OptExprList : ExprList { $$= $1; }
| { $$= NULL; }
OptExprList : ExprList { $$ = $1; }
| { $$ = NULL; }
;
ExprList : ExprList COMMA Expr
{ $$= (ExprDef *)AppendStmt(&$1->common,&$3->common); }
{ $$ = (ExprDef *)AppendStmt(&$1->common, &$3->common); }
| Expr
{ $$= $1; }
{ $$ = $1; }
;
Expr : Expr DIVIDE Expr
{ $$= ExprCreateBinary(EXPR_DIVIDE,$1,$3); }
{ $$ = ExprCreateBinary(EXPR_DIVIDE, $1, $3); }
| Expr PLUS Expr
{ $$= ExprCreateBinary(EXPR_ADD,$1,$3); }
{ $$ = ExprCreateBinary(EXPR_ADD, $1, $3); }
| Expr MINUS Expr
{ $$= ExprCreateBinary(EXPR_SUBTRACT,$1,$3); }
{ $$ = ExprCreateBinary(EXPR_SUBTRACT, $1, $3); }
| Expr TIMES Expr
{ $$= ExprCreateBinary(EXPR_MULTIPLY,$1,$3); }
{ $$ = ExprCreateBinary(EXPR_MULTIPLY, $1, $3); }
| Lhs EQUALS Expr
{ $$= ExprCreateBinary(EXPR_ASSIGN,$1,$3); }
{ $$ = ExprCreateBinary(EXPR_ASSIGN, $1, $3); }
| Term
{ $$= $1; }
{ $$ = $1; }
;
Term : MINUS Term
{ $$= ExprCreateUnary(EXPR_NEGATE,$2->value_type,$2); }
{ $$ = ExprCreateUnary(EXPR_NEGATE, $2->value_type, $2); }
| PLUS Term
{ $$= ExprCreateUnary(EXPR_UNARY_PLUS,$2->value_type,$2); }
{ $$ = ExprCreateUnary(EXPR_UNARY_PLUS, $2->value_type, $2); }
| EXCLAM Term
{ $$= ExprCreateUnary(EXPR_NOT,EXPR_TYPE_BOOLEAN,$2); }
{ $$ = ExprCreateUnary(EXPR_NOT, EXPR_TYPE_BOOLEAN, $2); }
| INVERT Term
{ $$= ExprCreateUnary(EXPR_INVERT,$2->value_type,$2); }
{ $$ = ExprCreateUnary(EXPR_INVERT, $2->value_type, $2); }
| Lhs
{ $$= $1; }
{ $$ = $1; }
| FieldSpec OPAREN OptExprList CPAREN %prec OPAREN
{ $$= ActionCreate($1,$3); }
{ $$ = ActionCreate($1, $3); }
| Terminal
{ $$= $1; }
{ $$ = $1; }
| OPAREN Expr CPAREN
{ $$= $2; }
{ $$ = $2; }
;
ActionList : ActionList COMMA Action
{ $$= (ExprDef *)AppendStmt(&$1->common,&$3->common); }
{ $$ = (ExprDef *)AppendStmt(&$1->common, &$3->common); }
| Action
{ $$= $1; }
{ $$ = $1; }
;
Action : FieldSpec OPAREN OptExprList CPAREN
{ $$= ActionCreate($1,$3); }
{ $$ = ActionCreate($1, $3); }
;
Lhs : FieldSpec
{
ExprDef *expr;
expr= ExprCreate(EXPR_IDENT, EXPR_TYPE_UNKNOWN);
expr->value.str= $1;
$$= expr;
expr = ExprCreate(EXPR_IDENT, EXPR_TYPE_UNKNOWN);
expr->value.str = $1;
$$ = expr;
}
| FieldSpec DOT FieldSpec
{
ExprDef *expr;
expr= ExprCreate(EXPR_FIELD_REF,EXPR_TYPE_UNKNOWN);
expr->value.field.element= $1;
expr->value.field.field= $3;
$$= expr;
expr = ExprCreate(EXPR_FIELD_REF, EXPR_TYPE_UNKNOWN);
expr->value.field.element = $1;
expr->value.field.field = $3;
$$ = expr;
}
| FieldSpec OBRACKET Expr CBRACKET
{
ExprDef *expr;
expr= ExprCreate(EXPR_ARRAY_REF,EXPR_TYPE_UNKNOWN);
expr->value.array.element= XKB_ATOM_NONE;
expr->value.array.field= $1;
expr->value.array.entry= $3;
$$= expr;
expr = ExprCreate(EXPR_ARRAY_REF, EXPR_TYPE_UNKNOWN);
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(EXPR_ARRAY_REF,EXPR_TYPE_UNKNOWN);
expr->value.array.element= $1;
expr->value.array.field= $3;
expr->value.array.entry= $5;
$$= expr;
expr = ExprCreate(EXPR_ARRAY_REF, EXPR_TYPE_UNKNOWN);
expr->value.array.element = $1;
expr->value.array.field = $3;
expr->value.array.entry = $5;
$$ = expr;
}
;
Terminal : String
{
ExprDef *expr;
expr= ExprCreate(EXPR_VALUE,EXPR_TYPE_STRING);
expr->value.str= $1;
$$= expr;
expr = ExprCreate(EXPR_VALUE, EXPR_TYPE_STRING);
expr->value.str = $1;
$$ = expr;
}
| Integer
{
ExprDef *expr;
expr= ExprCreate(EXPR_VALUE,EXPR_TYPE_INT);
expr->value.ival= $1;
$$= expr;
expr = ExprCreate(EXPR_VALUE, EXPR_TYPE_INT);
expr->value.ival = $1;
$$ = expr;
}
| Float
{
$$= NULL;
$$ = NULL;
}
| KeyName
{
ExprDef *expr;
expr= ExprCreate(EXPR_VALUE,EXPR_TYPE_KEYNAME);
strncpy(expr->value.keyName,$1,4);
$$= expr;
expr = ExprCreate(EXPR_VALUE, EXPR_TYPE_KEYNAME);
strncpy(expr->value.keyName, $1, 4);
$$ = expr;
}
;
OptKeySymList : KeySymList { $$= $1; }
| { $$= NULL; }
OptKeySymList : KeySymList { $$ = $1; }
| { $$ = NULL; }
;
KeySymList : KeySymList COMMA KeySym
{ $$= AppendKeysymList($1,$3); }
{ $$ = AppendKeysymList($1, $3); }
| KeySymList COMMA KeySyms
{ $$= AppendMultiKeysymList($1,$3); }
{ $$ = AppendMultiKeysymList($1, $3); }
| KeySym
{ $$= CreateKeysymList($1); }
{ $$ = CreateKeysymList($1); }
| KeySyms
{ $$= CreateMultiKeysymList($1); }
{ $$ = CreateMultiKeysymList($1); }
;
KeySyms : OBRACE KeySymList CBRACE
{ $$= $2; }
{ $$ = $2; }
;
KeySym : IDENT { $$= $1; }
| SECTION { $$= strdup("section"); }
KeySym : IDENT { $$ = $1; }
| SECTION { $$ = strdup("section"); }
| Integer
{
if ($1 < 10) { /* XK_0 .. XK_9 */
$$= malloc(2);
$$[0]= $1 + '0';
$$[1]= '\0';
$$ = malloc(2);
$$[0] = $1 + '0';
$$[1] = '\0';
}
else {
$$= malloc(17);
$$ = malloc(17);
snprintf($$, 17, "0x%x", $1);
}
}
;
SignedNumber : MINUS Number { $$= -$2; }
| Number { $$= $1; }
SignedNumber : MINUS Number { $$ = -$2; }
| Number { $$ = $1; }
;
Number : FLOAT { $$= $1; }
| INTEGER { $$= $1*XkbGeomPtsPerMM; }
Number : FLOAT { $$ = $1; }
| INTEGER { $$ = $1 * XkbGeomPtsPerMM; }
;
Float : FLOAT { $$= 0; }
Float : FLOAT { $$ = 0; }
;
Integer : INTEGER { $$= $1; }
Integer : INTEGER { $$ = $1; }
;
KeyCode : INTEGER { $$= $1; }
KeyCode : INTEGER { $$ = $1; }
;
KeyName : KEYNAME { strncpy($$, $1, XkbKeyNameLength); }
;
Ident : IDENT
{
$$ = xkb_atom_steal(param->ctx, $1);
}
| DEFAULT
{
$$ = xkb_atom_intern(param->ctx, "default");
}
Ident : IDENT { $$ = xkb_atom_steal(param->ctx, $1); }
| DEFAULT { $$ = xkb_atom_intern(param->ctx, "default"); }
;
String : STRING
{
$$ = xkb_atom_steal(param->ctx, $1);
}
String : STRING { $$ = xkb_atom_steal(param->ctx, $1); }
;
OptMapName : MapName { $$= $1; }
| { $$= NULL; }
OptMapName : MapName { $$ = $1; }
| { $$ = NULL; }
;
MapName : STRING { $$= $1; }
MapName : STRING { $$ = $1; }
;
%%