diff options
Diffstat (limited to 'src/3rdparty/xkbcommon/src/xkbcomp')
20 files changed, 2229 insertions, 2375 deletions
diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/action.c b/src/3rdparty/xkbcommon/src/xkbcomp/action.c index eb3d37fbbe..f99a850083 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/action.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/action.c @@ -103,7 +103,7 @@ enum action_field { ActionsInfo * NewActionsInfo(void) { - unsigned type; + enum xkb_action_type type; ActionsInfo *info; info = calloc(1, sizeof(*info)); @@ -168,7 +168,7 @@ static const LookupEntry fieldStrings[] = { }; static bool -stringToAction(const char *str, unsigned *type_rtrn) +stringToAction(const char *str, enum xkb_action_type *type_rtrn) { return LookupString(actionTypeNames, str, type_rtrn); } @@ -221,9 +221,9 @@ ReportActionNotArray(struct xkb_context *ctx, enum xkb_action_type action, } static bool -HandleNoAction(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) +HandleNoAction(struct xkb_context *ctx, const struct xkb_mod_set *mods, + union xkb_action *action, enum action_field field, + const ExprDef *array_ndx, const ExprDef *value) { return true; @@ -252,16 +252,17 @@ CheckBooleanFlag(struct xkb_context *ctx, enum xkb_action_type action, } static bool -CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action, - const ExprDef *array_ndx, const ExprDef *value, - enum xkb_action_flags *flags_inout, xkb_mod_mask_t *mods_rtrn) +CheckModifierField(struct xkb_context *ctx, const struct xkb_mod_set *mods, + enum xkb_action_type action, const ExprDef *array_ndx, + const ExprDef *value, enum xkb_action_flags *flags_inout, + xkb_mod_mask_t *mods_rtrn) { if (array_ndx) - return ReportActionNotArray(keymap->ctx, action, ACTION_FIELD_MODIFIERS); + return ReportActionNotArray(ctx, action, ACTION_FIELD_MODIFIERS); if (value->expr.op == EXPR_IDENT) { const char *valStr; - valStr = xkb_atom_text(keymap->ctx, value->ident.ident); + valStr = xkb_atom_text(ctx, value->ident.ident); if (valStr && (istreq(valStr, "usemodmapmods") || istreq(valStr, "modmapmods"))) { *mods_rtrn = 0; @@ -270,8 +271,8 @@ CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action, } } - if (!ExprResolveModMask(keymap, value, MOD_BOTH, mods_rtrn)) - return ReportMismatch(keymap->ctx, action, + if (!ExprResolveModMask(ctx, value, MOD_BOTH, mods, mods_rtrn)) + return ReportMismatch(ctx, action, ACTION_FIELD_MODIFIERS, "modifier mask"); *flags_inout &= ~ACTION_MODS_LOOKUP_MODMAP; @@ -306,36 +307,36 @@ CheckAffectField(struct xkb_context *ctx, enum xkb_action_type action, } static bool -HandleSetLatchLockMods(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) +HandleSetLatchLockMods(struct xkb_context *ctx, const struct xkb_mod_set *mods, + union xkb_action *action, enum action_field field, + const ExprDef *array_ndx, const ExprDef *value) { struct xkb_mod_action *act = &action->mods; const enum xkb_action_type type = action->type; if (field == ACTION_FIELD_MODIFIERS) - return CheckModifierField(keymap, action->type, array_ndx, value, + return CheckModifierField(ctx, mods, action->type, array_ndx, value, &act->flags, &act->mods.mods); if ((type == ACTION_TYPE_MOD_SET || type == ACTION_TYPE_MOD_LATCH) && field == ACTION_FIELD_CLEAR_LOCKS) - return CheckBooleanFlag(keymap->ctx, action->type, field, + return CheckBooleanFlag(ctx, action->type, field, ACTION_LOCK_CLEAR, array_ndx, value, &act->flags); if (type == ACTION_TYPE_MOD_LATCH && field == ACTION_FIELD_LATCH_TO_LOCK) - return CheckBooleanFlag(keymap->ctx, action->type, field, + return CheckBooleanFlag(ctx, action->type, field, ACTION_LATCH_TO_LOCK, array_ndx, value, &act->flags); if (type == ACTION_TYPE_MOD_LOCK && field == ACTION_FIELD_AFFECT) - return CheckAffectField(keymap->ctx, action->type, array_ndx, value, + return CheckAffectField(ctx, action->type, array_ndx, value, &act->flags); - return ReportIllegal(keymap->ctx, action->type, field); + return ReportIllegal(ctx, action->type, field); } static bool -CheckGroupField(struct xkb_context *ctx, unsigned action, +CheckGroupField(struct xkb_context *ctx, enum xkb_action_type action, const ExprDef *array_ndx, const ExprDef *value, enum xkb_action_flags *flags_inout, int32_t *group_rtrn) { @@ -373,34 +374,34 @@ CheckGroupField(struct xkb_context *ctx, unsigned action, } static bool -HandleSetLatchLockGroup(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) +HandleSetLatchLockGroup(struct xkb_context *ctx, const struct xkb_mod_set *mods, + union xkb_action *action, enum action_field field, + const ExprDef *array_ndx, const ExprDef *value) { struct xkb_group_action *act = &action->group; const enum xkb_action_type type = action->type; if (field == ACTION_FIELD_GROUP) - return CheckGroupField(keymap->ctx, action->type, array_ndx, value, + return CheckGroupField(ctx, action->type, array_ndx, value, &act->flags, &act->group); if ((type == ACTION_TYPE_GROUP_SET || type == ACTION_TYPE_GROUP_LATCH) && field == ACTION_FIELD_CLEAR_LOCKS) - return CheckBooleanFlag(keymap->ctx, action->type, field, + return CheckBooleanFlag(ctx, action->type, field, ACTION_LOCK_CLEAR, array_ndx, value, &act->flags); if (type == ACTION_TYPE_GROUP_LATCH && field == ACTION_FIELD_LATCH_TO_LOCK) - return CheckBooleanFlag(keymap->ctx, action->type, field, + return CheckBooleanFlag(ctx, action->type, field, ACTION_LATCH_TO_LOCK, array_ndx, value, &act->flags); - return ReportIllegal(keymap->ctx, action->type, field); + return ReportIllegal(ctx, action->type, field); } static bool -HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) +HandleMovePtr(struct xkb_context *ctx, const struct xkb_mod_set *mods, + union xkb_action *action, enum action_field field, + const ExprDef *array_ndx, const ExprDef *value) { struct xkb_pointer_action *act = &action->ptr; @@ -410,13 +411,13 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action, value->expr.op != EXPR_UNARY_PLUS); if (array_ndx) - return ReportActionNotArray(keymap->ctx, action->type, field); + return ReportActionNotArray(ctx, action->type, field); - if (!ExprResolveInteger(keymap->ctx, value, &val)) - return ReportMismatch(keymap->ctx, action->type, field, "integer"); + if (!ExprResolveInteger(ctx, value, &val)) + return ReportMismatch(ctx, action->type, field, "integer"); if (val < INT16_MIN || val > INT16_MAX) { - log_err(keymap->ctx, + log_err(ctx, "The %s field in the %s action must be in range %d..%d; " "Action definition ignored\n", fieldText(field), ActionTypeText(action->type), @@ -438,17 +439,17 @@ HandleMovePtr(struct xkb_keymap *keymap, union xkb_action *action, return true; } else if (field == ACTION_FIELD_ACCEL) { - return CheckBooleanFlag(keymap->ctx, action->type, field, + return CheckBooleanFlag(ctx, action->type, field, ACTION_ACCEL, array_ndx, value, &act->flags); } - return ReportIllegal(keymap->ctx, action->type, field); + return ReportIllegal(ctx, action->type, field); } static bool -HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) +HandlePtrBtn(struct xkb_context *ctx, const struct xkb_mod_set *mods, + union xkb_action *action, enum action_field field, + const ExprDef *array_ndx, const ExprDef *value) { struct xkb_pointer_button_action *act = &action->btn; @@ -456,14 +457,14 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action, int btn; if (array_ndx) - return ReportActionNotArray(keymap->ctx, action->type, field); + return ReportActionNotArray(ctx, action->type, field); - if (!ExprResolveButton(keymap->ctx, value, &btn)) - return ReportMismatch(keymap->ctx, action->type, field, + if (!ExprResolveButton(ctx, value, &btn)) + return ReportMismatch(ctx, action->type, field, "integer (range 1..5)"); if (btn < 0 || btn > 5) { - log_err(keymap->ctx, + log_err(ctx, "Button must specify default or be in the range 1..5; " "Illegal button value %d ignored\n", btn); return false; @@ -474,20 +475,20 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action, } else if (action->type == ACTION_TYPE_PTR_LOCK && field == ACTION_FIELD_AFFECT) { - return CheckAffectField(keymap->ctx, action->type, array_ndx, value, + return CheckAffectField(ctx, action->type, array_ndx, value, &act->flags); } else if (field == ACTION_FIELD_COUNT) { int val; if (array_ndx) - return ReportActionNotArray(keymap->ctx, action->type, field); + return ReportActionNotArray(ctx, action->type, field); - if (!ExprResolveInteger(keymap->ctx, value, &val)) - return ReportMismatch(keymap->ctx, action->type, field, "integer"); + if (!ExprResolveInteger(ctx, value, &val)) + return ReportMismatch(ctx, action->type, field, "integer"); if (val < 0 || val > 255) { - log_err(keymap->ctx, + log_err(ctx, "The count field must have a value in the range 0..255; " "Illegal count %d ignored\n", val); return false; @@ -497,7 +498,7 @@ HandlePtrBtn(struct xkb_keymap *keymap, union xkb_action *action, return true; } - return ReportIllegal(keymap->ctx, action->type, field); + return ReportIllegal(ctx, action->type, field); } static const LookupEntry ptrDflts[] = { @@ -508,9 +509,9 @@ static const LookupEntry ptrDflts[] = { }; static bool -HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) +HandleSetPtrDflt(struct xkb_context *ctx, const struct xkb_mod_set *mods, + union xkb_action *action, enum action_field field, + const ExprDef *array_ndx, const ExprDef *value) { struct xkb_pointer_default_action *act = &action->dflt; @@ -518,10 +519,10 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action, unsigned int val; if (array_ndx) - return ReportActionNotArray(keymap->ctx, action->type, field); + return ReportActionNotArray(ctx, action->type, field); - if (!ExprResolveEnum(keymap->ctx, value, &val, ptrDflts)) - return ReportMismatch(keymap->ctx, action->type, field, + if (!ExprResolveEnum(ctx, value, &val, ptrDflts)) + return ReportMismatch(ctx, action->type, field, "pointer component"); return true; } @@ -530,7 +531,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action, int btn; if (array_ndx) - return ReportActionNotArray(keymap->ctx, action->type, field); + return ReportActionNotArray(ctx, action->type, field); if (value->expr.op == EXPR_NEGATE || value->expr.op == EXPR_UNARY_PLUS) { @@ -542,18 +543,18 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action, button = value; } - if (!ExprResolveButton(keymap->ctx, button, &btn)) - return ReportMismatch(keymap->ctx, action->type, field, + if (!ExprResolveButton(ctx, button, &btn)) + return ReportMismatch(ctx, action->type, field, "integer (range 1..5)"); if (btn < 0 || btn > 5) { - log_err(keymap->ctx, + log_err(ctx, "New default button value must be in the range 1..5; " "Illegal default button value %d ignored\n", btn); return false; } if (btn == 0) { - log_err(keymap->ctx, + log_err(ctx, "Cannot set default pointer button to \"default\"; " "Illegal default button setting ignored\n"); return false; @@ -563,13 +564,13 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, union xkb_action *action, return true; } - return ReportIllegal(keymap->ctx, action->type, field); + return ReportIllegal(ctx, action->type, field); } static bool -HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) +HandleSwitchScreen(struct xkb_context *ctx, const struct xkb_mod_set *mods, + union xkb_action *action, enum action_field field, + const ExprDef *array_ndx, const ExprDef *value) { struct xkb_switch_screen_action *act = &action->screen; @@ -578,7 +579,7 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action, int val; if (array_ndx) - return ReportActionNotArray(keymap->ctx, action->type, field); + return ReportActionNotArray(ctx, action->type, field); if (value->expr.op == EXPR_NEGATE || value->expr.op == EXPR_UNARY_PLUS) { @@ -590,12 +591,12 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action, scrn = value; } - if (!ExprResolveInteger(keymap->ctx, scrn, &val)) - return ReportMismatch(keymap->ctx, action->type, field, + if (!ExprResolveInteger(ctx, scrn, &val)) + return ReportMismatch(ctx, action->type, field, "integer (0..255)"); if (val < 0 || val > 255) { - log_err(keymap->ctx, + log_err(ctx, "Screen index must be in the range 1..255; " "Illegal screen value %d ignored\n", val); return false; @@ -605,46 +606,46 @@ HandleSwitchScreen(struct xkb_keymap *keymap, union xkb_action *action, return true; } else if (field == ACTION_FIELD_SAME) { - return CheckBooleanFlag(keymap->ctx, action->type, field, + return CheckBooleanFlag(ctx, action->type, field, ACTION_SAME_SCREEN, array_ndx, value, &act->flags); } - return ReportIllegal(keymap->ctx, action->type, field); + return ReportIllegal(ctx, action->type, field); } static bool -HandleSetLockControls(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) +HandleSetLockControls(struct xkb_context *ctx, const struct xkb_mod_set *mods, + union xkb_action *action, enum action_field field, + const ExprDef *array_ndx, const ExprDef *value) { struct xkb_controls_action *act = &action->ctrls; if (field == ACTION_FIELD_CONTROLS) { - unsigned int mask; + enum xkb_action_controls mask; if (array_ndx) - return ReportActionNotArray(keymap->ctx, action->type, field); + return ReportActionNotArray(ctx, action->type, field); - if (!ExprResolveMask(keymap->ctx, value, &mask, ctrlMaskNames)) - return ReportMismatch(keymap->ctx, action->type, field, + if (!ExprResolveMask(ctx, value, &mask, ctrlMaskNames)) + return ReportMismatch(ctx, action->type, field, "controls mask"); act->ctrls = mask; return true; } else if (field == ACTION_FIELD_AFFECT) { - return CheckAffectField(keymap->ctx, action->type, array_ndx, value, + return CheckAffectField(ctx, action->type, array_ndx, value, &act->flags); } - return ReportIllegal(keymap->ctx, action->type, field); + return ReportIllegal(ctx, action->type, field); } static bool -HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action, - enum action_field field, const ExprDef *array_ndx, - const ExprDef *value) +HandlePrivate(struct xkb_context *ctx, const struct xkb_mod_set *mods, + union xkb_action *action, enum action_field field, + const ExprDef *array_ndx, const ExprDef *value) { struct xkb_private_action *act = &action->priv; @@ -652,13 +653,13 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action, int type; if (array_ndx) - return ReportActionNotArray(keymap->ctx, action->type, field); + return ReportActionNotArray(ctx, action->type, field); - if (!ExprResolveInteger(keymap->ctx, value, &type)) - return ReportMismatch(keymap->ctx, ACTION_TYPE_PRIVATE, field, "integer"); + if (!ExprResolveInteger(ctx, value, &type)) + return ReportMismatch(ctx, ACTION_TYPE_PRIVATE, field, "integer"); if (type < 0 || type > 255) { - log_err(keymap->ctx, + log_err(ctx, "Private action type must be in the range 0..255; " "Illegal type %d ignored\n", type); return false; @@ -675,7 +676,7 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action, * make actions like these no-ops for now. */ if (type < ACTION_TYPE_PRIVATE) { - log_info(keymap->ctx, + log_info(ctx, "Private actions of type %s are not supported; Ignored\n", ActionTypeText(type)); act->type = ACTION_TYPE_NONE; @@ -692,44 +693,45 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action, const char *str; size_t len; - if (!ExprResolveString(keymap->ctx, value, &val)) - return ReportMismatch(keymap->ctx, action->type, field, "string"); + if (!ExprResolveString(ctx, value, &val)) + return ReportMismatch(ctx, action->type, field, "string"); - str = xkb_atom_text(keymap->ctx, val); + str = xkb_atom_text(ctx, val); len = strlen(str); if (len < 1 || len > 7) { - log_warn(keymap->ctx, + log_warn(ctx, "A private action has 7 data bytes; " "Illegal data ignored\n"); return false; } + /* act->data may not be null-terminated, this is intentional */ strncpy((char *) act->data, str, sizeof(act->data)); return true; } else { int ndx, datum; - if (!ExprResolveInteger(keymap->ctx, array_ndx, &ndx)) { - log_err(keymap->ctx, + if (!ExprResolveInteger(ctx, array_ndx, &ndx)) { + log_err(ctx, "Array subscript must be integer; " "Illegal subscript ignored\n"); return false; } if (ndx < 0 || (size_t) ndx >= sizeof(act->data)) { - log_err(keymap->ctx, + log_err(ctx, "The data for a private action is %lu bytes long; " "Attempt to use data[%d] ignored\n", (unsigned long) sizeof(act->data), ndx); return false; } - if (!ExprResolveInteger(keymap->ctx, value, &datum)) - return ReportMismatch(keymap->ctx, act->type, field, "integer"); + if (!ExprResolveInteger(ctx, value, &datum)) + return ReportMismatch(ctx, act->type, field, "integer"); if (datum < 0 || datum > 255) { - log_err(keymap->ctx, + log_err(ctx, "All data for a private action must be 0..255; " "Illegal datum %d ignored\n", datum); return false; @@ -740,10 +742,11 @@ HandlePrivate(struct xkb_keymap *keymap, union xkb_action *action, } } - return ReportIllegal(keymap->ctx, ACTION_TYPE_NONE, field); + return ReportIllegal(ctx, ACTION_TYPE_NONE, field); } -typedef bool (*actionHandler)(struct xkb_keymap *keymap, +typedef bool (*actionHandler)(struct xkb_context *ctx, + const struct xkb_mod_set *mods, union xkb_action *action, enum action_field field, const ExprDef *array_ndx, @@ -771,22 +774,23 @@ static const actionHandler handleAction[_ACTION_TYPE_NUM_ENTRIES] = { /***====================================================================***/ bool -HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, - union xkb_action *action, ActionsInfo *info) +HandleActionDef(struct xkb_context *ctx, ActionsInfo *info, + const struct xkb_mod_set *mods, ExprDef *def, + union xkb_action *action) { ExprDef *arg; const char *str; - unsigned handler_type; + enum xkb_action_type handler_type; if (def->expr.op != EXPR_ACTION_DECL) { - log_err(keymap->ctx, "Expected an action definition, found %s\n", + log_err(ctx, "Expected an action definition, found %s\n", expr_op_type_to_string(def->expr.op)); return false; } - str = xkb_atom_text(keymap->ctx, def->action.name); + str = xkb_atom_text(ctx, def->action.name); if (!stringToAction(str, &handler_type)) { - log_err(keymap->ctx, "Unknown action %s\n", str); + log_err(ctx, "Unknown action %s\n", str); return false; } @@ -822,12 +826,11 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, value = (const ExprDef *) &constTrue; } - if (!ExprResolveLhs(keymap->ctx, field, &elemRtrn, &fieldRtrn, - &arrayRtrn)) + if (!ExprResolveLhs(ctx, field, &elemRtrn, &fieldRtrn, &arrayRtrn)) return false; if (elemRtrn) { - log_err(keymap->ctx, + log_err(ctx, "Cannot change defaults in an action definition; " "Ignoring attempt to change %s.%s\n", elemRtrn, fieldRtrn); @@ -835,12 +838,12 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, } if (!stringToField(fieldRtrn, &fieldNdx)) { - log_err(keymap->ctx, "Unknown field name %s\n", fieldRtrn); + log_err(ctx, "Unknown field name %s\n", fieldRtrn); return false; } - if (!handleAction[handler_type](keymap, action, fieldNdx, arrayRtrn, - value)) + if (!handleAction[handler_type](ctx, mods, action, fieldNdx, + arrayRtrn, value)) return false; } @@ -848,20 +851,21 @@ HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, } bool -SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field, - ExprDef *array_ndx, ExprDef *value, ActionsInfo *info) +SetActionField(struct xkb_context *ctx, ActionsInfo *info, + struct xkb_mod_set *mods, const char *elem, + const char *field, ExprDef *array_ndx, ExprDef *value) { - unsigned action; + enum xkb_action_type action; enum action_field action_field; if (!stringToAction(elem, &action)) return false; if (!stringToField(field, &action_field)) { - log_err(keymap->ctx, "\"%s\" is not a legal field name\n", field); + log_err(ctx, "\"%s\" is not a legal field name\n", field); return false; } - return handleAction[action](keymap, &info->actions[action], + return handleAction[action](ctx, mods, &info->actions[action], action_field, array_ndx, value); } diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/action.h b/src/3rdparty/xkbcommon/src/xkbcomp/action.h index 82915ef57d..1f92e7b38e 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/action.h +++ b/src/3rdparty/xkbcommon/src/xkbcomp/action.h @@ -43,11 +43,14 @@ void FreeActionsInfo(ActionsInfo *info); bool -HandleActionDef(ExprDef *def, struct xkb_keymap *keymap, - union xkb_action *action, ActionsInfo *info); +HandleActionDef(struct xkb_context *ctx, ActionsInfo *info, + const struct xkb_mod_set *mods, ExprDef *def, + union xkb_action *action); bool -SetActionField(struct xkb_keymap *keymap, const char *elem, const char *field, - ExprDef *array_ndx, ExprDef *value, ActionsInfo *info); +SetActionField(struct xkb_context *ctx, ActionsInfo *info, + struct xkb_mod_set *mods, const char *elem, + const char *field, ExprDef *array_ndx, ExprDef *value); + #endif diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/ast-build.c b/src/3rdparty/xkbcommon/src/xkbcomp/ast-build.c index 11bc0912d1..365ff51c5f 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/ast-build.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/ast-build.c @@ -106,6 +106,13 @@ ExprCreateInteger(int ival) } ExprDef * +ExprCreateFloat(void) +{ + EXPR_CREATE(ExprFloat, expr, EXPR_VALUE, EXPR_TYPE_FLOAT); + return expr; +} + +ExprDef * ExprCreateBoolean(bool set) { EXPR_CREATE(ExprBoolean, expr, EXPR_VALUE, EXPR_TYPE_BOOLEAN); @@ -231,11 +238,9 @@ ExprAppendMultiKeysymList(ExprDef *expr, ExprDef *append) darray_append(expr->keysym_list.symsMapIndex, nSyms); darray_append(expr->keysym_list.symsNumEntries, numEntries); - darray_append_items(expr->keysym_list.syms, - darray_mem(append->keysym_list.syms, 0), numEntries); + darray_concat(expr->keysym_list.syms, append->keysym_list.syms); - darray_resize(append->keysym_list.syms, 0); - FreeStmt(&append->common); + FreeStmt((ParseCommon *) append); return expr; } @@ -303,8 +308,21 @@ VarCreate(ExprDef *name, ExprDef *value) VarDef * BoolVarCreate(xkb_atom_t ident, bool set) { - return VarCreate((ExprDef *) ExprCreateIdent(ident), - (ExprDef *) ExprCreateBoolean(set)); + ExprDef *name, *value; + VarDef *def; + if (!(name = ExprCreateIdent(ident))) { + return NULL; + } + if (!(value = ExprCreateBoolean(set))) { + FreeStmt((ParseCommon *) name); + return NULL; + } + if (!(def = VarCreate(name, value))) { + FreeStmt((ParseCommon *) name); + FreeStmt((ParseCommon *) value); + return NULL; + } + return def; } InterpDef * @@ -318,6 +336,7 @@ InterpCreate(xkb_keysym_t sym, ExprDef *match) def->common.next = NULL; def->sym = sym; def->match = match; + def->def = NULL; return def; } @@ -458,12 +477,8 @@ IncludeCreate(struct xkb_context *ctx, char *str, enum merge_mode merge) incl = incl->next_incl; } - if (!incl) { - log_wsgo(ctx, - "Allocation failure in IncludeCreate; " - "Using only part of the include\n"); + if (!incl) break; - } incl->common.type = STMT_INCLUDE; incl->common.next = NULL; @@ -506,8 +521,7 @@ XkbFileCreate(enum xkb_file_type type, char *name, ParseCommon *defs, XkbEscapeMapName(name); file->file_type = type; - file->topName = strdup_safe(name); - file->name = name; + file->name = name ? name : strdup("(unnamed)"); file->defs = defs; file->flags = flags; @@ -697,7 +711,6 @@ FreeXkbFile(XkbFile *file) } free(file->name); - free(file->topName); free(file); file = next; } @@ -716,7 +729,7 @@ static const char *xkb_file_type_strings[_FILE_TYPE_NUM_ENTRIES] = { const char * xkb_file_type_to_string(enum xkb_file_type type) { - if (type > _FILE_TYPE_NUM_ENTRIES) + if (type >= _FILE_TYPE_NUM_ENTRIES) return "unknown"; return xkb_file_type_strings[type]; } @@ -777,6 +790,7 @@ static const char *expr_value_type_strings[_EXPR_TYPE_NUM_VALUES] = { [EXPR_TYPE_UNKNOWN] = "unknown", [EXPR_TYPE_BOOLEAN] = "boolean", [EXPR_TYPE_INT] = "int", + [EXPR_TYPE_FLOAT] = "float", [EXPR_TYPE_STRING] = "string", [EXPR_TYPE_ACTION] = "action", [EXPR_TYPE_KEYNAME] = "keyname", diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/ast-build.h b/src/3rdparty/xkbcommon/src/xkbcomp/ast-build.h index b57e4cdce1..6c76f381ac 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/ast-build.h +++ b/src/3rdparty/xkbcommon/src/xkbcomp/ast-build.h @@ -37,6 +37,9 @@ ExprDef * ExprCreateInteger(int ival); ExprDef * +ExprCreateFloat(void); + +ExprDef * ExprCreateBoolean(bool set); ExprDef * diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/ast.h b/src/3rdparty/xkbcommon/src/xkbcomp/ast.h index 26cbb3a3e4..49c5ada457 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/ast.h +++ b/src/3rdparty/xkbcommon/src/xkbcomp/ast.h @@ -95,6 +95,7 @@ enum expr_value_type { EXPR_TYPE_UNKNOWN = 0, EXPR_TYPE_BOOLEAN, EXPR_TYPE_INT, + EXPR_TYPE_FLOAT, EXPR_TYPE_STRING, EXPR_TYPE_ACTION, EXPR_TYPE_KEYNAME, @@ -188,6 +189,12 @@ typedef struct { typedef struct { ExprCommon expr; + /* We don't support floats, but we still represnt them in the AST, in + * order to provide proper error messages. */ +} ExprFloat; + +typedef struct { + ExprCommon expr; xkb_atom_t key_name; } ExprKeyName; @@ -338,7 +345,6 @@ enum xkb_map_flags { typedef struct { ParseCommon common; enum xkb_file_type file_type; - char *topName; char *name; ParseCommon *defs; enum xkb_map_flags flags; diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/compat.c b/src/3rdparty/xkbcommon/src/xkbcomp/compat.c index 475895c6c1..bd587c8db9 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/compat.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/compat.c @@ -55,9 +55,9 @@ #include "include.h" enum si_field { - SI_FIELD_VIRTUAL_MOD = (1 << 0), - SI_FIELD_ACTION = (1 << 1), - SI_FIELD_AUTO_REPEAT = (1 << 2), + SI_FIELD_VIRTUAL_MOD = (1 << 0), + SI_FIELD_ACTION = (1 << 1), + SI_FIELD_AUTO_REPEAT = (1 << 2), SI_FIELD_LEVEL_ONE_ONLY = (1 << 3), }; @@ -69,9 +69,9 @@ typedef struct { } SymInterpInfo; enum led_field { - LED_FIELD_MODS = (1 << 0), - LED_FIELD_GROUPS = (1 << 1), - LED_FIELD_CTRLS = (1 << 2), + LED_FIELD_MODS = (1 << 0), + LED_FIELD_GROUPS = (1 << 1), + LED_FIELD_CTRLS = (1 << 2), }; typedef struct { @@ -87,23 +87,26 @@ typedef struct { SymInterpInfo default_interp; darray(SymInterpInfo) interps; LedInfo default_led; - darray(LedInfo) leds; + LedInfo leds[XKB_MAX_LEDS]; + unsigned int num_leds; ActionsInfo *actions; - struct xkb_keymap *keymap; + struct xkb_mod_set mods; + + struct xkb_context *ctx; } CompatInfo; static const char * siText(SymInterpInfo *si, CompatInfo *info) { - char *buf = xkb_context_get_buffer(info->keymap->ctx, 128); + char *buf = xkb_context_get_buffer(info->ctx, 128); if (si == &info->default_interp) return "default"; snprintf(buf, 128, "%s+%s(%s)", - KeysymText(info->keymap->ctx, si->interp.sym), + KeysymText(info->ctx, si->interp.sym), SIMatchText(si->interp.match), - ModMaskText(info->keymap, si->interp.mods)); + ModMaskText(info->ctx, &info->mods, si->interp.mods)); return buf; } @@ -111,7 +114,7 @@ siText(SymInterpInfo *si, CompatInfo *info) static inline bool ReportSINotArray(CompatInfo *info, SymInterpInfo *si, const char *field) { - return ReportNotArray(info->keymap->ctx, "symbol interpretation", field, + return ReportNotArray(info->ctx, "symbol interpretation", field, siText(si, info)); } @@ -119,7 +122,7 @@ static inline bool ReportSIBadType(CompatInfo *info, SymInterpInfo *si, const char *field, const char *wanted) { - return ReportBadType(info->keymap->ctx, "symbol interpretation", field, + return ReportBadType(info->ctx, "symbol interpretation", field, siText(si, info), wanted); } @@ -127,25 +130,26 @@ static inline bool ReportLedBadType(CompatInfo *info, LedInfo *ledi, const char *field, const char *wanted) { - return ReportBadType(info->keymap->ctx, "indicator map", field, - xkb_atom_text(info->keymap->ctx, ledi->led.name), + return ReportBadType(info->ctx, "indicator map", field, + xkb_atom_text(info->ctx, ledi->led.name), wanted); } static inline bool ReportLedNotArray(CompatInfo *info, LedInfo *ledi, const char *field) { - return ReportNotArray(info->keymap->ctx, "indicator map", field, - xkb_atom_text(info->keymap->ctx, ledi->led.name)); + return ReportNotArray(info->ctx, "indicator map", field, + xkb_atom_text(info->ctx, ledi->led.name)); } static void -InitCompatInfo(CompatInfo *info, struct xkb_keymap *keymap, - ActionsInfo *actions) +InitCompatInfo(CompatInfo *info, struct xkb_context *ctx, + ActionsInfo *actions, const struct xkb_mod_set *mods) { memset(info, 0, sizeof(*info)); - info->keymap = keymap; + info->ctx = ctx; info->actions = actions; + info->mods = *mods; info->default_interp.merge = MERGE_OVERRIDE; info->default_interp.interp.virtual_mod = XKB_MOD_INVALID; info->default_led.merge = MERGE_OVERRIDE; @@ -156,7 +160,6 @@ ClearCompatInfo(CompatInfo *info) { free(info->name); darray_free(info->interps); - darray_free(info->leds); } static SymInterpInfo * @@ -196,13 +199,13 @@ AddInterp(CompatInfo *info, SymInterpInfo *new, bool same_file) { SymInterpInfo *old = FindMatchingInterp(info, new); if (old) { - const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); + const int verbosity = xkb_context_get_log_verbosity(info->ctx); const bool report = (same_file && verbosity > 0) || verbosity > 9; enum si_field collide = 0; if (new->merge == MERGE_REPLACE) { if (report) - log_warn(info->keymap->ctx, + log_warn(info->ctx, "Multiple definitions for \"%s\"; " "Earlier interpretation ignored\n", siText(new, info)); @@ -232,7 +235,7 @@ AddInterp(CompatInfo *info, SymInterpInfo *new, bool same_file) } if (collide) { - log_warn(info->keymap->ctx, + log_warn(info->ctx, "Multiple interpretations of \"%s\"; " "Using %s definition for duplicate fields\n", siText(new, info), @@ -260,18 +263,17 @@ ResolveStateAndPredicate(ExprDef *expr, enum xkb_match_operation *pred_rtrn, *pred_rtrn = MATCH_EXACTLY; if (expr->expr.op == EXPR_ACTION_DECL) { - const char *pred_txt = xkb_atom_text(info->keymap->ctx, - expr->action.name); - if (!LookupString(symInterpretMatchMaskNames, pred_txt, pred_rtrn)) { - log_err(info->keymap->ctx, + const char *pred_txt = xkb_atom_text(info->ctx, expr->action.name); + if (!LookupString(symInterpretMatchMaskNames, pred_txt, pred_rtrn) || + !expr->action.args) { + log_err(info->ctx, "Illegal modifier predicate \"%s\"; Ignored\n", pred_txt); return false; } expr = expr->action.args; } else if (expr->expr.op == EXPR_IDENT) { - const char *pred_txt = xkb_atom_text(info->keymap->ctx, - expr->ident.ident); + const char *pred_txt = xkb_atom_text(info->ctx, expr->ident.ident); if (pred_txt && istreq(pred_txt, "any")) { *pred_rtrn = MATCH_ANY; *mods_rtrn = MOD_REAL_MASK_ALL; @@ -279,7 +281,8 @@ ResolveStateAndPredicate(ExprDef *expr, enum xkb_match_operation *pred_rtrn, } } - return ExprResolveModMask(info->keymap, expr, MOD_REAL, mods_rtrn); + return ExprResolveModMask(info->ctx, expr, MOD_REAL, &info->mods, + mods_rtrn); } /***====================================================================***/ @@ -305,13 +308,13 @@ UseNewLEDField(enum led_field field, LedInfo *old, LedInfo *new, static bool AddLedMap(CompatInfo *info, LedInfo *new, bool same_file) { - LedInfo *old; enum led_field collide; - struct xkb_context *ctx = info->keymap->ctx; - const int verbosity = xkb_context_get_log_verbosity(ctx); + const int verbosity = xkb_context_get_log_verbosity(info->ctx); const bool report = (same_file && verbosity > 0) || verbosity > 9; - darray_foreach(old, info->leds) { + for (xkb_led_index_t i = 0; i < info->num_leds; i++) { + LedInfo *old = &info->leds[i]; + if (old->led.name != new->led.name) continue; @@ -326,10 +329,10 @@ AddLedMap(CompatInfo *info, LedInfo *new, bool same_file) if (new->merge == MERGE_REPLACE) { if (report) - log_warn(info->keymap->ctx, + log_warn(info->ctx, "Map for indicator %s redefined; " "Earlier definition ignored\n", - xkb_atom_text(ctx, old->led.name)); + xkb_atom_text(info->ctx, old->led.name)); *old = *new; return true; } @@ -351,17 +354,23 @@ AddLedMap(CompatInfo *info, LedInfo *new, bool same_file) } if (collide) { - log_warn(info->keymap->ctx, + log_warn(info->ctx, "Map for indicator %s redefined; " "Using %s definition for duplicate fields\n", - xkb_atom_text(ctx, old->led.name), + xkb_atom_text(info->ctx, old->led.name), (new->merge == MERGE_AUGMENT ? "first" : "last")); } return true; } - darray_append(info->leds, *new); + if (info->num_leds >= XKB_MAX_LEDS) { + log_err(info->ctx, + "Too many LEDs defined (maximum %d)\n", + XKB_MAX_LEDS); + return false; + } + info->leds[info->num_leds++] = *new; return true; } @@ -369,14 +378,13 @@ static void MergeIncludedCompatMaps(CompatInfo *into, CompatInfo *from, enum merge_mode merge) { - SymInterpInfo *si; - LedInfo *ledi; - if (from->errorCount > 0) { into->errorCount += from->errorCount; return; } + into->mods = from->mods; + if (into->name == NULL) { into->name = from->name; from->name = NULL; @@ -387,6 +395,7 @@ MergeIncludedCompatMaps(CompatInfo *into, CompatInfo *from, darray_init(from->interps); } else { + SymInterpInfo *si; darray_foreach(si, from->interps) { si->merge = (merge == MERGE_DEFAULT ? si->merge : merge); if (!AddInterp(into, si, false)) @@ -394,12 +403,14 @@ MergeIncludedCompatMaps(CompatInfo *into, CompatInfo *from, } } - if (darray_empty(into->leds)) { - into->leds = from->leds; - darray_init(from->leds); + if (into->num_leds == 0) { + memcpy(into->leds, from->leds, sizeof(*from->leds) * from->num_leds); + into->num_leds = from->num_leds; + from->num_leds = 0; } else { - darray_foreach(ledi, from->leds) { + for (xkb_led_index_t i = 0; i < from->num_leds; i++) { + LedInfo *ledi = &from->leds[i]; ledi->merge = (merge == MERGE_DEFAULT ? ledi->merge : merge); if (!AddLedMap(into, ledi, false)) into->errorCount++; @@ -415,7 +426,7 @@ HandleIncludeCompatMap(CompatInfo *info, IncludeStmt *include) { CompatInfo included; - InitCompatInfo(&included, info->keymap, info->actions); + InitCompatInfo(&included, info->ctx, info->actions, &info->mods); included.name = include->stmt; include->stmt = NULL; @@ -423,14 +434,14 @@ HandleIncludeCompatMap(CompatInfo *info, IncludeStmt *include) CompatInfo next_incl; XkbFile *file; - file = ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_COMPAT); + file = ProcessIncludeFile(info->ctx, stmt, FILE_TYPE_COMPAT); if (!file) { info->errorCount += 10; ClearCompatInfo(&included); return false; } - InitCompatInfo(&next_incl, info->keymap, info->actions); + InitCompatInfo(&next_incl, info->ctx, info->actions, &included.mods); next_incl.default_interp = info->default_interp; next_incl.default_interp.merge = stmt->merge; next_incl.default_led = info->default_led; @@ -454,14 +465,14 @@ static bool SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field, ExprDef *arrayNdx, ExprDef *value) { - struct xkb_keymap *keymap = info->keymap; xkb_mod_index_t ndx; if (istreq(field, "action")) { if (arrayNdx) return ReportSINotArray(info, si, field); - if (!HandleActionDef(value, keymap, &si->interp.action, info->actions)) + if (!HandleActionDef(info->ctx, info->actions, &info->mods, + value, &si->interp.action)) return false; si->defined |= SI_FIELD_ACTION; @@ -471,7 +482,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field, if (arrayNdx) return ReportSINotArray(info, si, field); - if (!ExprResolveMod(keymap, value, MOD_VIRT, &ndx)) + if (!ExprResolveMod(info->ctx, value, MOD_VIRT, &info->mods, &ndx)) return ReportSIBadType(info, si, field, "virtual modifier"); si->interp.virtual_mod = ndx; @@ -483,7 +494,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field, if (arrayNdx) return ReportSINotArray(info, si, field); - if (!ExprResolveBoolean(keymap->ctx, value, &set)) + if (!ExprResolveBoolean(info->ctx, value, &set)) return ReportSIBadType(info, si, field, "boolean"); si->interp.repeat = set; @@ -491,7 +502,7 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field, si->defined |= SI_FIELD_AUTO_REPEAT; } else if (istreq(field, "locking")) { - log_dbg(info->keymap->ctx, + log_dbg(info->ctx, "The \"locking\" field in symbol interpretation is unsupported; " "Ignored\n"); } @@ -502,14 +513,14 @@ SetInterpField(CompatInfo *info, SymInterpInfo *si, const char *field, if (arrayNdx) return ReportSINotArray(info, si, field); - if (!ExprResolveEnum(keymap->ctx, value, &val, useModMapValueNames)) + if (!ExprResolveEnum(info->ctx, value, &val, useModMapValueNames)) return ReportSIBadType(info, si, field, "level specification"); - si->interp.level_one_only = !!val; + si->interp.level_one_only = val; si->defined |= SI_FIELD_LEVEL_ONE_ONLY; } else { - return ReportBadField(keymap->ctx, "symbol interpretation", field, + return ReportBadField(info->ctx, "symbol interpretation", field, siText(si, info)); } @@ -521,13 +532,13 @@ SetLedMapField(CompatInfo *info, LedInfo *ledi, const char *field, ExprDef *arrayNdx, ExprDef *value) { bool ok = true; - struct xkb_keymap *keymap = info->keymap; if (istreq(field, "modifiers") || istreq(field, "mods")) { if (arrayNdx) return ReportLedNotArray(info, ledi, field); - if (!ExprResolveModMask(keymap, value, MOD_BOTH, &ledi->led.mods.mods)) + if (!ExprResolveModMask(info->ctx, value, MOD_BOTH, + &info->mods, &ledi->led.mods.mods)) return ReportLedBadType(info, ledi, field, "modifier mask"); ledi->defined |= LED_FIELD_MODS; @@ -538,7 +549,7 @@ SetLedMapField(CompatInfo *info, LedInfo *ledi, const char *field, if (arrayNdx) return ReportLedNotArray(info, ledi, field); - if (!ExprResolveMask(keymap->ctx, value, &mask, groupMaskNames)) + if (!ExprResolveMask(info->ctx, value, &mask, groupMaskNames)) return ReportLedBadType(info, ledi, field, "group mask"); ledi->led.groups = mask; @@ -550,14 +561,14 @@ SetLedMapField(CompatInfo *info, LedInfo *ledi, const char *field, if (arrayNdx) return ReportLedNotArray(info, ledi, field); - if (!ExprResolveMask(keymap->ctx, value, &mask, ctrlMaskNames)) + if (!ExprResolveMask(info->ctx, value, &mask, ctrlMaskNames)) return ReportLedBadType(info, ledi, field, "controls mask"); ledi->led.ctrls = mask; ledi->defined |= LED_FIELD_CTRLS; } else if (istreq(field, "allowexplicit")) { - log_dbg(info->keymap->ctx, + log_dbg(info->ctx, "The \"allowExplicit\" field in indicator statements is unsupported; " "Ignored\n"); } @@ -568,7 +579,7 @@ SetLedMapField(CompatInfo *info, LedInfo *ledi, const char *field, if (arrayNdx) return ReportLedNotArray(info, ledi, field); - if (!ExprResolveMask(keymap->ctx, value, &mask, + if (!ExprResolveMask(info->ctx, value, &mask, modComponentMaskNames)) return ReportLedBadType(info, ledi, field, "mask of modifier state components"); @@ -581,7 +592,7 @@ SetLedMapField(CompatInfo *info, LedInfo *ledi, const char *field, if (arrayNdx) return ReportLedNotArray(info, ledi, field); - if (!ExprResolveMask(keymap->ctx, value, &mask, + if (!ExprResolveMask(info->ctx, value, &mask, groupComponentMaskNames)) return ReportLedBadType(info, ledi, field, "mask of group state components"); @@ -594,21 +605,21 @@ SetLedMapField(CompatInfo *info, LedInfo *ledi, const char *field, istreq(field, "leddriveskeyboard") || istreq(field, "indicatordriveskbd") || istreq(field, "indicatordriveskeyboard")) { - log_dbg(info->keymap->ctx, + log_dbg(info->ctx, "The \"%s\" field in indicator statements is unsupported; " "Ignored\n", field); } else if (istreq(field, "index")) { /* Users should see this, it might cause unexpected behavior. */ - log_err(info->keymap->ctx, + log_err(info->ctx, "The \"index\" field in indicator statements is unsupported; " "Ignored\n"); } else { - log_err(info->keymap->ctx, + log_err(info->ctx, "Unknown field %s in map for %s indicator; " "Definition ignored\n", - field, xkb_atom_text(keymap->ctx, ledi->led.name)); + field, xkb_atom_text(info->ctx, ledi->led.name)); ok = false; } @@ -622,7 +633,7 @@ HandleGlobalVar(CompatInfo *info, VarDef *stmt) ExprDef *ndx; bool ret; - if (!ExprResolveLhs(info->keymap->ctx, stmt->name, &elem, &field, &ndx)) + if (!ExprResolveLhs(info->ctx, stmt->name, &elem, &field, &ndx)) ret = false; else if (elem && istreq(elem, "interpret")) ret = SetInterpField(info, &info->default_interp, field, ndx, @@ -631,8 +642,8 @@ HandleGlobalVar(CompatInfo *info, VarDef *stmt) ret = SetLedMapField(info, &info->default_led, field, ndx, stmt->value); else - ret = SetActionField(info->keymap, elem, field, ndx, stmt->value, - info->actions); + ret = SetActionField(info->ctx, info->actions, &info->mods, + elem, field, ndx, stmt->value); return ret; } @@ -645,15 +656,14 @@ HandleInterpBody(CompatInfo *info, VarDef *def, SymInterpInfo *si) for (; def; def = (VarDef *) def->common.next) { if (def->name && def->name->expr.op == EXPR_FIELD_REF) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Cannot set a global default value from within an interpret statement; " "Move statements to the global file scope\n"); ok = false; continue; } - ok = ExprResolveLhs(info->keymap->ctx, def->name, &elem, &field, - &arrayNdx); + ok = ExprResolveLhs(info->ctx, def->name, &elem, &field, &arrayNdx); if (!ok) continue; @@ -671,7 +681,7 @@ HandleInterpDef(CompatInfo *info, InterpDef *def, enum merge_mode merge) SymInterpInfo si; if (!ResolveStateAndPredicate(def->match, &pred, &mods, info)) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Couldn't determine matching modifiers; " "Symbol interpretation ignored\n"); return false; @@ -714,14 +724,13 @@ HandleLedMapDef(CompatInfo *info, LedMapDef *def, enum merge_mode merge) for (var = def->body; var != NULL; var = (VarDef *) var->common.next) { const char *elem, *field; ExprDef *arrayNdx; - if (!ExprResolveLhs(info->keymap->ctx, var->name, &elem, &field, - &arrayNdx)) { + if (!ExprResolveLhs(info->ctx, var->name, &elem, &field, &arrayNdx)) { ok = false; continue; } if (elem) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Cannot set defaults for \"%s\" element in indicator map; " "Assignment to %s.%s ignored\n", elem, elem, field); ok = false; @@ -756,7 +765,7 @@ HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge) ok = HandleInterpDef(info, (InterpDef *) stmt, merge); break; case STMT_GROUP_COMPAT: - log_dbg(info->keymap->ctx, + log_dbg(info->ctx, "The \"group\" statement in compat is unsupported; " "Ignored\n"); ok = true; @@ -768,10 +777,10 @@ HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge) ok = HandleGlobalVar(info, (VarDef *) stmt); break; case STMT_VMOD: - ok = HandleVModDef(info->keymap, (VModDef *) stmt, merge); + ok = HandleVModDef(info->ctx, &info->mods, (VModDef *) stmt, merge); break; default: - log_err(info->keymap->ctx, + log_err(info->ctx, "Compat files may not include other types; " "Ignoring %s\n", stmt_type_to_string(stmt->type)); ok = false; @@ -782,8 +791,8 @@ HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge) info->errorCount++; if (info->errorCount > 10) { - log_err(info->keymap->ctx, - "Abandoning compatibility map \"%s\"\n", file->topName); + log_err(info->ctx, + "Abandoning compatibility map \"%s\"\n", file->name); break; } } @@ -807,34 +816,33 @@ CopyInterps(CompatInfo *info, bool needSymbol, enum xkb_match_operation pred, } static void -CopyLedMapDefs(CompatInfo *info) +CopyLedMapDefsToKeymap(struct xkb_keymap *keymap, CompatInfo *info) { - LedInfo *ledi; - xkb_led_index_t i; - struct xkb_led *led; - struct xkb_keymap *keymap = info->keymap; + for (xkb_led_index_t idx = 0; idx < info->num_leds; idx++) { + LedInfo *ledi = &info->leds[idx]; + xkb_led_index_t i; + struct xkb_led *led; - darray_foreach(ledi, info->leds) { /* * Find the LED with the given name, if it was already declared * in keycodes. */ - darray_enumerate(i, led, keymap->leds) + xkb_leds_enumerate(i, led, keymap) if (led->name == ledi->led.name) break; /* Not previously declared; create it with next free index. */ - if (i >= darray_size(keymap->leds)) { + if (i >= keymap->num_leds) { log_dbg(keymap->ctx, "Indicator name \"%s\" was not declared in the keycodes section; " "Adding new indicator\n", xkb_atom_text(keymap->ctx, ledi->led.name)); - darray_enumerate(i, led, keymap->leds) + xkb_leds_enumerate(i, led, keymap) if (led->name == XKB_ATOM_NONE) break; - if (i >= darray_size(keymap->leds)) { + if (i >= keymap->num_leds) { /* Not place to put it; ignore. */ if (i >= XKB_MAX_LEDS) { log_err(keymap->ctx, @@ -844,9 +852,9 @@ CopyLedMapDefs(CompatInfo *info) xkb_atom_text(keymap->ctx, ledi->led.name)); continue; } + /* Add a new LED. */ - darray_resize(keymap->leds, i + 1); - led = &darray_item(keymap->leds, i); + led = &keymap->leds[keymap->num_leds++]; } } @@ -864,6 +872,8 @@ CopyCompatToKeymap(struct xkb_keymap *keymap, CompatInfo *info) keymap->compat_section_name = strdup_safe(info->name); XkbEscapeMapName(keymap->compat_section_name); + keymap->mods = info->mods; + if (!darray_empty(info->interps)) { struct collect collect; darray_init(collect.sym_interprets); @@ -880,11 +890,11 @@ CopyCompatToKeymap(struct xkb_keymap *keymap, CompatInfo *info) CopyInterps(info, false, MATCH_ANY, &collect); CopyInterps(info, false, MATCH_ANY_OR_NONE, &collect); - keymap->num_sym_interprets = darray_size(collect.sym_interprets); - keymap->sym_interprets = darray_mem(collect.sym_interprets, 0); + darray_steal(collect.sym_interprets, + &keymap->sym_interprets, &keymap->num_sym_interprets); } - CopyLedMapDefs(info); + CopyLedMapDefsToKeymap(keymap, info); return true; } @@ -900,7 +910,7 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, if (!actions) return false; - InitCompatInfo(&info, keymap, actions); + InitCompatInfo(&info, keymap->ctx, actions, &keymap->mods); info.default_interp.merge = merge; info.default_led.merge = merge; diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/expr.c b/src/3rdparty/xkbcommon/src/xkbcomp/expr.c index c514f8d54c..b2567de3eb 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/expr.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/expr.c @@ -42,16 +42,20 @@ ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr, *elem_rtrn = NULL; *field_rtrn = xkb_atom_text(ctx, expr->ident.ident); *index_rtrn = NULL; - return true; + return (*field_rtrn != NULL); case EXPR_FIELD_REF: *elem_rtrn = xkb_atom_text(ctx, expr->field_ref.element); *field_rtrn = xkb_atom_text(ctx, expr->field_ref.field); *index_rtrn = NULL; - return true; + return (*elem_rtrn != NULL && *field_rtrn != NULL); case EXPR_ARRAY_REF: *elem_rtrn = xkb_atom_text(ctx, expr->array_ref.element); *field_rtrn = xkb_atom_text(ctx, expr->array_ref.field); *index_rtrn = expr->array_ref.entry; + if (expr->array_ref.element != XKB_ATOM_NONE && *elem_rtrn == NULL) + return false; + if (*field_rtrn == NULL) + return false; return true; default: break; @@ -83,7 +87,7 @@ SimpleLookup(struct xkb_context *ctx, const void *priv, xkb_atom_t field, /* Data passed in the *priv argument for LookupModMask. */ typedef struct { - const struct xkb_keymap *keymap; + const struct xkb_mod_set *mods; enum mod_type mod_type; } LookupModMaskPriv; @@ -94,13 +98,15 @@ LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field, const char *str; xkb_mod_index_t ndx; const LookupModMaskPriv *arg = priv; - const struct xkb_keymap *keymap = arg->keymap; + const struct xkb_mod_set *mods = arg->mods; enum mod_type mod_type = arg->mod_type; if (type != EXPR_TYPE_INT) return false; str = xkb_atom_text(ctx, field); + if (!str) + return false; if (istreq(str, "all")) { *val_rtrn = MOD_REAL_MASK_ALL; @@ -112,7 +118,7 @@ LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field, return true; } - ndx = ModNameToIndex(keymap, field, mod_type); + ndx = XkbModNameToIndex(mods, field, mod_type); if (ndx == XKB_MOD_INVALID) return false; @@ -165,7 +171,7 @@ ExprResolveBoolean(struct xkb_context *ctx, const ExprDef *expr, case EXPR_INVERT: case EXPR_NOT: - ok = ExprResolveBoolean(ctx, expr, set_rtrn); + ok = ExprResolveBoolean(ctx, expr->unary.child, set_rtrn); if (ok) *set_rtrn = !*set_rtrn; return ok; @@ -337,7 +343,9 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, const ExprDef *expr, *val_rtrn = l / r; break; default: - break; + log_err(ctx, "%s of integers not permitted\n", + expr_op_type_to_string(expr->expr.op)); + return false; } return true; @@ -508,8 +516,8 @@ ExprResolveMaskLookup(struct xkb_context *ctx, const ExprDef *expr, unsigned int *val_rtrn, IdentLookupFunc lookup, const void *lookupPriv) { - bool ok = 0; - unsigned int l, r; + bool ok = false; + unsigned int l = 0, r = 0; int v; ExprDef *left, *right; const char *bogus = NULL; @@ -541,7 +549,7 @@ ExprResolveMaskLookup(struct xkb_context *ctx, const ExprDef *expr, case EXPR_ARRAY_REF: bogus = "array reference"; - + /* fallthrough */ case EXPR_ACTION_DECL: if (bogus == NULL) bogus = "function use"; @@ -616,12 +624,12 @@ ExprResolveMask(struct xkb_context *ctx, const ExprDef *expr, } bool -ExprResolveModMask(struct xkb_keymap *keymap, const ExprDef *expr, - enum mod_type mod_type, xkb_mod_mask_t *mask_rtrn) +ExprResolveModMask(struct xkb_context *ctx, const ExprDef *expr, + enum mod_type mod_type, const struct xkb_mod_set *mods, + xkb_mod_mask_t *mask_rtrn) { - LookupModMaskPriv priv = { .keymap = keymap, .mod_type = mod_type }; - return ExprResolveMaskLookup(keymap->ctx, expr, mask_rtrn, LookupModMask, - &priv); + LookupModMaskPriv priv = { .mods = mods, .mod_type = mod_type }; + return ExprResolveMaskLookup(ctx, expr, mask_rtrn, LookupModMask, &priv); } bool @@ -648,14 +656,15 @@ ExprResolveKeySym(struct xkb_context *ctx, const ExprDef *expr, } bool -ExprResolveMod(struct xkb_keymap *keymap, const ExprDef *def, - enum mod_type mod_type, xkb_mod_index_t *ndx_rtrn) +ExprResolveMod(struct xkb_context *ctx, const ExprDef *def, + enum mod_type mod_type, const struct xkb_mod_set *mods, + xkb_mod_index_t *ndx_rtrn) { xkb_mod_index_t ndx; xkb_atom_t name; if (def->expr.op != EXPR_IDENT) { - log_err(keymap->ctx, + log_err(ctx, "Cannot resolve virtual modifier: " "found %s where a virtual modifier name was expected\n", expr_op_type_to_string(def->expr.op)); @@ -663,12 +672,12 @@ ExprResolveMod(struct xkb_keymap *keymap, const ExprDef *def, } name = def->ident.ident; - ndx = ModNameToIndex(keymap, name, mod_type); + ndx = XkbModNameToIndex(mods, name, mod_type); if (ndx == XKB_MOD_INVALID) { - log_err(keymap->ctx, + log_err(ctx, "Cannot resolve virtual modifier: " "\"%s\" was not previously declared\n", - xkb_atom_text(keymap->ctx, name)); + xkb_atom_text(ctx, name)); return false; } diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/expr.h b/src/3rdparty/xkbcommon/src/xkbcomp/expr.h index 5434ad199e..9882b8cce5 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/expr.h +++ b/src/3rdparty/xkbcommon/src/xkbcomp/expr.h @@ -33,12 +33,14 @@ ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr, ExprDef **index_rtrn); bool -ExprResolveModMask(struct xkb_keymap *keymap, const ExprDef *expr, - enum mod_type mod_type, xkb_mod_mask_t *mask_rtrn); +ExprResolveModMask(struct xkb_context *ctx, const ExprDef *expr, + enum mod_type mod_type, const struct xkb_mod_set *mods, + xkb_mod_mask_t *mask_rtrn); bool -ExprResolveMod(struct xkb_keymap *keymap, const ExprDef *def, - enum mod_type mod_type, xkb_mod_index_t *ndx_rtrn); +ExprResolveMod(struct xkb_context *ctx, const ExprDef *def, + enum mod_type mod_type, const struct xkb_mod_set *mods, + xkb_mod_index_t *ndx_rtrn); bool ExprResolveBoolean(struct xkb_context *ctx, const ExprDef *expr, diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c b/src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c index d90f6a4465..491da51067 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/keycodes.c @@ -49,7 +49,8 @@ typedef struct { xkb_keycode_t min_key_code; xkb_keycode_t max_key_code; darray(xkb_atom_t) key_names; - darray(LedNameInfo) led_names; + LedNameInfo led_names[XKB_MAX_LEDS]; + unsigned int num_led_names; darray(AliasInfo) aliases; struct xkb_context *ctx; @@ -71,10 +72,8 @@ static LedNameInfo * FindLedByName(KeyNamesInfo *info, xkb_atom_t name, xkb_led_index_t *idx_out) { - LedNameInfo *ledi; - xkb_led_index_t idx; - - darray_enumerate(idx, ledi, info->led_names) { + for (xkb_led_index_t idx = 0; idx < info->num_led_names; idx++) { + LedNameInfo *ledi = &info->led_names[idx]; if (ledi->name == name) { *idx_out = idx; return ledi; @@ -119,11 +118,11 @@ AddLedName(KeyNamesInfo *info, enum merge_mode merge, bool same_file, return true; } - if (new_idx >= darray_size(info->led_names)) - darray_resize0(info->led_names, new_idx + 1); + if (new_idx >= info->num_led_names) + info->num_led_names = new_idx + 1; /* LED with the same index already exists. */ - old = &darray_item(info->led_names, new_idx); + old = &info->led_names[new_idx]; if (old->name != XKB_ATOM_NONE) { if (report) { const xkb_atom_t use = (replace ? new->name : old->name); @@ -140,7 +139,7 @@ AddLedName(KeyNamesInfo *info, enum merge_mode merge, bool same_file, return true; } - darray_item(info->led_names, new_idx) = *new; + *old = *new; return true; } @@ -150,7 +149,6 @@ ClearKeyNamesInfo(KeyNamesInfo *info) free(info->name); darray_free(info->key_names); darray_free(info->aliases); - darray_free(info->led_names); } static void @@ -308,15 +306,16 @@ MergeIncludedKeycodes(KeyNamesInfo *into, KeyNamesInfo *from, } /* Merge LED names. */ - if (darray_empty(into->led_names)) { - into->led_names = from->led_names; - darray_init(from->led_names); + if (into->num_led_names == 0) { + memcpy(into->led_names, from->led_names, + sizeof(*from->led_names) * from->num_led_names); + into->num_led_names = from->num_led_names; + from->num_led_names = 0; } else { - xkb_led_index_t idx; - LedNameInfo *ledi; + for (xkb_led_index_t idx = 0; idx < from->num_led_names; idx++) { + LedNameInfo *ledi = &from->led_names[idx]; - darray_enumerate(idx, ledi, from->led_names) { if (ledi->name == XKB_ATOM_NONE) continue; @@ -468,7 +467,7 @@ HandleLedNameDef(KeyNamesInfo *info, LedNameDef *def, if (!ExprResolveString(info->ctx, def->name, &name)) { char buf[20]; - snprintf(buf, sizeof(buf), "%d", def->ndx); + snprintf(buf, sizeof(buf), "%u", def->ndx); info->errorCount++; return ReportBadType(info->ctx, "indicator", "name", buf, "string"); } @@ -516,7 +515,7 @@ HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge) if (info->errorCount > 10) { log_err(info->ctx, "Abandoning keycodes file \"%s\"\n", - file->topName); + file->name); break; } } @@ -527,41 +526,45 @@ HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge) static bool CopyKeyNamesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info) { - xkb_keycode_t kc; - xkb_led_index_t idx; - LedNameInfo *ledi; - AliasInfo *alias; - unsigned i; - - keymap->keycodes_section_name = strdup_safe(info->name); - XkbEscapeMapName(keymap->keycodes_section_name); - - if (info->min_key_code != XKB_KEYCODE_INVALID) { - keymap->min_key_code = info->min_key_code; - keymap->max_key_code = info->max_key_code; - } - else { - /* - * If the keymap has no keys, let's just use the safest pair - * we know. - */ - keymap->min_key_code = 8; - keymap->max_key_code = 255; + struct xkb_key *keys; + xkb_keycode_t min_key_code, max_key_code, kc; + + min_key_code = info->min_key_code; + max_key_code = info->max_key_code; + /* If the keymap has no keys, let's just use the safest pair we know. */ + if (min_key_code == XKB_KEYCODE_INVALID) { + min_key_code = 8; + max_key_code = 255; } - keymap->keys = calloc(keymap->max_key_code + 1, sizeof(*keymap->keys)); - for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) - keymap->keys[kc].keycode = kc; + keys = calloc(max_key_code + 1, sizeof(*keys)); + if (!keys) + return false; + + for (kc = min_key_code; kc <= max_key_code; kc++) + keys[kc].keycode = kc; - /* Copy key names. */ for (kc = info->min_key_code; kc <= info->max_key_code; kc++) - keymap->keys[kc].name = darray_item(info->key_names, kc); + keys[kc].name = darray_item(info->key_names, kc); + + keymap->min_key_code = min_key_code; + keymap->max_key_code = max_key_code; + keymap->keys = keys; + return true; +} + +static bool +CopyKeyAliasesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info) +{ + AliasInfo *alias; + unsigned i, num_key_aliases; + struct xkb_key_alias *key_aliases; /* * Do some sanity checking on the aliases. We can't do it before * because keys and their aliases may be added out-of-order. */ - keymap->num_key_aliases = 0; + num_key_aliases = 0; darray_foreach(alias, info->aliases) { /* Check that ->real is a key. */ if (!XkbKeyByName(keymap, alias->real, false)) { @@ -584,30 +587,61 @@ CopyKeyNamesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info) continue; } - keymap->num_key_aliases++; + num_key_aliases++; } /* Copy key aliases. */ - keymap->key_aliases = calloc(keymap->num_key_aliases, - sizeof(*keymap->key_aliases)); - i = 0; - darray_foreach(alias, info->aliases) { - if (alias->real != XKB_ATOM_NONE) { - keymap->key_aliases[i].alias = alias->alias; - keymap->key_aliases[i].real = alias->real; - i++; + key_aliases = NULL; + if (num_key_aliases > 0) { + key_aliases = calloc(num_key_aliases, sizeof(*key_aliases)); + if (!key_aliases) + return false; + + i = 0; + darray_foreach(alias, info->aliases) { + if (alias->real != XKB_ATOM_NONE) { + key_aliases[i].alias = alias->alias; + key_aliases[i].real = alias->real; + i++; + } } } - /* Copy LED names. */ - darray_resize0(keymap->leds, darray_size(info->led_names)); - darray_enumerate(idx, ledi, info->led_names) - if (ledi->name != XKB_ATOM_NONE) - darray_item(keymap->leds, idx).name = ledi->name; + keymap->num_key_aliases = num_key_aliases; + keymap->key_aliases = key_aliases; + return true; +} + +static bool +CopyLedNamesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info) +{ + keymap->num_leds = info->num_led_names; + for (xkb_led_index_t idx = 0; idx < info->num_led_names; idx++) { + LedNameInfo *ledi = &info->led_names[idx]; + + if (ledi->name == XKB_ATOM_NONE) + continue; + + keymap->leds[idx].name = ledi->name; + } return true; } +static bool +CopyKeyNamesInfoToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info) +{ + /* This function trashes keymap on error, but that's OK. */ + if (!CopyKeyNamesToKeymap(keymap, info) || + !CopyKeyAliasesToKeymap(keymap, info) || + !CopyLedNamesToKeymap(keymap, info)) + return false; + + keymap->keycodes_section_name = strdup_safe(info->name); + XkbEscapeMapName(keymap->keycodes_section_name); + return true; +} + /***====================================================================***/ bool @@ -622,7 +656,7 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, if (info.errorCount != 0) goto err_info; - if (!CopyKeyNamesToKeymap(keymap, &info)) + if (!CopyKeyNamesInfoToKeymap(keymap, &info)) goto err_info; ClearKeyNamesInfo(&info); diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/keymap-dump.c b/src/3rdparty/xkbcommon/src/xkbcomp/keymap-dump.c index 7f70ca3481..2ed591c661 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/keymap-dump.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/keymap-dump.c @@ -126,7 +126,7 @@ write_vmods(struct xkb_keymap *keymap, struct buf *buf) const struct xkb_mod *mod; xkb_mod_index_t num_vmods = 0; - darray_foreach(mod, keymap->mods) { + xkb_mods_foreach(mod, &keymap->mods) { if (mod->type != MOD_VIRT) continue; @@ -164,7 +164,7 @@ write_keycodes(struct xkb_keymap *keymap, struct buf *buf) write_buf(buf, "\tminimum = %u;\n", min(keymap->min_key_code, 8)); write_buf(buf, "\tmaximum = %u;\n", max(keymap->max_key_code, 255)); - xkb_foreach_key(key, keymap) { + xkb_keys_foreach(key, keymap) { if (key->name == XKB_ATOM_NONE) continue; @@ -172,7 +172,7 @@ write_keycodes(struct xkb_keymap *keymap, struct buf *buf) KeyNameText(keymap->ctx, key->name), key->keycode); } - darray_enumerate(idx, led, keymap->leds) + xkb_leds_enumerate(idx, led, keymap) if (led->name != XKB_ATOM_NONE) write_buf(buf, "\tindicator %u = \"%s\";\n", idx + 1, xkb_atom_text(keymap->ctx, led->name)); @@ -205,7 +205,7 @@ write_types(struct xkb_keymap *keymap, struct buf *buf) xkb_atom_text(keymap->ctx, type->name)); write_buf(buf, "\t\tmodifiers= %s;\n", - ModMaskText(keymap, type->mods.mods)); + ModMaskText(keymap->ctx, &keymap->mods, type->mods.mods)); for (unsigned j = 0; j < type->num_entries; j++) { const char *str; @@ -218,16 +218,17 @@ write_types(struct xkb_keymap *keymap, struct buf *buf) if (entry->level == 0 && entry->preserve.mods == 0) continue; - str = ModMaskText(keymap, entry->mods.mods); + str = ModMaskText(keymap->ctx, &keymap->mods, entry->mods.mods); write_buf(buf, "\t\tmap[%s]= Level%u;\n", str, entry->level + 1); if (entry->preserve.mods) write_buf(buf, "\t\tpreserve[%s]= %s;\n", - str, ModMaskText(keymap, entry->preserve.mods)); + str, ModMaskText(keymap->ctx, &keymap->mods, + entry->preserve.mods)); } - for (xkb_level_index_t n = 0; n < type->num_levels; n++) + for (xkb_level_index_t n = 0; n < type->num_level_names; n++) if (type->level_names[n]) write_buf(buf, "\t\tlevel_name[Level%u]= \"%s\";\n", n + 1, xkb_atom_text(keymap->ctx, type->level_names[n])); @@ -261,7 +262,7 @@ write_led_map(struct xkb_keymap *keymap, struct buf *buf, LedStateMaskText(keymap->ctx, led->which_mods)); } write_buf(buf, "\t\tmodifiers= %s;\n", - ModMaskText(keymap, led->mods.mods)); + ModMaskText(keymap->ctx, &keymap->mods, led->mods.mods)); } if (led->ctrls) { @@ -303,13 +304,14 @@ write_action(struct xkb_keymap *keymap, struct buf *buf, type = ActionTypeText(action->type); switch (action->type) { - case ACTION_TYPE_MOD_LOCK: case ACTION_TYPE_MOD_SET: case ACTION_TYPE_MOD_LATCH: + case ACTION_TYPE_MOD_LOCK: if (action->mods.flags & ACTION_MODS_LOOKUP_MODMAP) args = "modMapMods"; else - args = ModMaskText(keymap, action->mods.mods.mods); + args = ModMaskText(keymap->ctx, &keymap->mods, + action->mods.mods.mods); write_buf(buf, "%s%s(modifiers=%s%s%s%s)%s", prefix, type, args, (action->type != ACTION_TYPE_MOD_LOCK && (action->mods.flags & ACTION_LOCK_CLEAR)) ? ",clearLocks" : "", (action->type != ACTION_TYPE_MOD_LOCK && (action->mods.flags & ACTION_LATCH_TO_LOCK)) ? ",latchToLock" : "", @@ -422,11 +424,12 @@ write_compat(struct xkb_keymap *keymap, struct buf *buf) write_buf(buf, "\tinterpret %s+%s(%s) {\n", si->sym ? KeysymText(keymap->ctx, si->sym) : "Any", SIMatchText(si->match), - ModMaskText(keymap, si->mods)); + ModMaskText(keymap->ctx, &keymap->mods, si->mods)); if (si->virtual_mod != XKB_MOD_INVALID) write_buf(buf, "\t\tvirtualModifier= %s;\n", - ModIndexText(keymap, si->virtual_mod)); + ModIndexText(keymap->ctx, &keymap->mods, + si->virtual_mod)); if (si->level_one_only) write_buf(buf, "\t\tuseModMapMods=level1;\n"); @@ -438,7 +441,7 @@ write_compat(struct xkb_keymap *keymap, struct buf *buf) write_buf(buf, "\t};\n"); } - darray_foreach(led, keymap->leds) + xkb_leds_foreach(led, keymap) if (led->which_groups || led->groups || led->which_mods || led->mods.mods || led->ctrls) write_led_map(keymap, buf, led); @@ -452,7 +455,7 @@ static bool write_keysyms(struct xkb_keymap *keymap, struct buf *buf, const struct xkb_key *key, xkb_layout_index_t group) { - for (xkb_level_index_t level = 0; level < XkbKeyGroupWidth(key, group); + for (xkb_level_index_t level = 0; level < XkbKeyNumLevels(key, group); level++) { const xkb_keysym_t *syms; int num_syms; @@ -534,7 +537,7 @@ write_key(struct xkb_keymap *keymap, struct buf *buf, if (key->vmodmap && (key->explicit & EXPLICIT_VMODMAP)) write_buf(buf, "\n\t\tvirtualMods= %s,", - ModMaskText(keymap, key->vmodmap)); + ModMaskText(keymap->ctx, &keymap->mods, key->vmodmap)); switch (key->out_of_range_group_action) { case RANGE_SATURATE: @@ -550,7 +553,7 @@ write_key(struct xkb_keymap *keymap, struct buf *buf, break; } - show_actions = !!(key->explicit & EXPLICIT_INTERP); + show_actions = (key->explicit & EXPLICIT_INTERP); if (key->num_groups > 1 || show_actions) simple = false; @@ -573,8 +576,7 @@ write_key(struct xkb_keymap *keymap, struct buf *buf, write_buf(buf, " ]"); if (show_actions) { write_buf(buf, ",\n\t\tactions[Group%u]= [ ", group + 1); - for (level = 0; - level < XkbKeyGroupWidth(key, group); level++) { + for (level = 0; level < XkbKeyNumLevels(key, group); level++) { if (level != 0) write_buf(buf, ", "); write_action(keymap, buf, @@ -595,6 +597,8 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) { const struct xkb_key *key; xkb_layout_index_t group; + xkb_mod_index_t i; + const struct xkb_mod *mod; if (keymap->symbols_section_name) write_buf(buf, "xkb_symbols \"%s\" {\n", @@ -610,22 +614,25 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf) if (group > 0) write_buf(buf, "\n"); - xkb_foreach_key(key, keymap) + xkb_keys_foreach(key, keymap) if (key->num_groups > 0) write_key(keymap, buf, key); - xkb_foreach_key(key, keymap) { - xkb_mod_index_t i; - const struct xkb_mod *mod; - - if (key->modmap == 0) - continue; - - darray_enumerate(i, mod, keymap->mods) - if (key->modmap & (1u << i)) - write_buf(buf, "\tmodifier_map %s { %s };\n", - xkb_atom_text(keymap->ctx, mod->name), + xkb_mods_enumerate(i, mod, &keymap->mods) { + bool had_any = false; + xkb_keys_foreach(key, keymap) { + if (key->modmap & (1u << i)) { + if (!had_any) + write_buf(buf, "\tmodifier_map %s { ", + xkb_atom_text(keymap->ctx, mod->name)); + write_buf(buf, "%s%s", + had_any ? ", " : "", KeyNameText(keymap->ctx, key->name)); + had_any = true; + } + } + if (had_any) + write_buf(buf, " };\n"); } write_buf(buf, "};\n\n"); diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/parser-priv.h b/src/3rdparty/xkbcommon/src/xkbcomp/parser-priv.h index 0675e55a8f..76b5047eb6 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/parser-priv.h +++ b/src/3rdparty/xkbcommon/src/xkbcomp/parser-priv.h @@ -28,8 +28,8 @@ #define XKBCOMP_PARSER_PRIV_H struct parser_param; +struct scanner; -#include "scanner-utils.h" #include "parser.h" int diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/parser.h b/src/3rdparty/xkbcommon/src/xkbcomp/parser.h index ee9b4468b5..655eca3133 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/parser.h +++ b/src/3rdparty/xkbcommon/src/xkbcomp/parser.h @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -26,162 +26,103 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ +#ifndef YY__XKBCOMMON_XKBCOMMON_INTERNAL_STA_PARSER_H_INCLUDED +# define YY__XKBCOMMON_XKBCOMMON_INTERNAL_STA_PARSER_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int _xkbcommon_debug; +#endif -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - END_OF_FILE = 0, - ERROR_TOK = 255, - XKB_KEYMAP = 1, - XKB_KEYCODES = 2, - XKB_TYPES = 3, - XKB_SYMBOLS = 4, - XKB_COMPATMAP = 5, - XKB_GEOMETRY = 6, - XKB_SEMANTICS = 7, - XKB_LAYOUT = 8, - INCLUDE = 10, - OVERRIDE = 11, - AUGMENT = 12, - REPLACE = 13, - ALTERNATE = 14, - VIRTUAL_MODS = 20, - TYPE = 21, - INTERPRET = 22, - ACTION_TOK = 23, - KEY = 24, - ALIAS = 25, - GROUP = 26, - MODIFIER_MAP = 27, - INDICATOR = 28, - SHAPE = 29, - KEYS = 30, - ROW = 31, - SECTION = 32, - OVERLAY = 33, - TEXT = 34, - OUTLINE = 35, - SOLID = 36, - LOGO = 37, - VIRTUAL = 38, - EQUALS = 40, - PLUS = 41, - MINUS = 42, - DIVIDE = 43, - TIMES = 44, - OBRACE = 45, - CBRACE = 46, - OPAREN = 47, - CPAREN = 48, - OBRACKET = 49, - CBRACKET = 50, - DOT = 51, - COMMA = 52, - SEMI = 53, - EXCLAM = 54, - INVERT = 55, - STRING = 60, - INTEGER = 61, - FLOAT = 62, - IDENT = 63, - KEYNAME = 64, - PARTIAL = 70, - DEFAULT = 71, - HIDDEN = 72, - ALPHANUMERIC_KEYS = 73, - MODIFIER_KEYS = 74, - KEYPAD_KEYS = 75, - FUNCTION_KEYS = 76, - ALTERNATE_GROUP = 77 - }; + enum yytokentype + { + END_OF_FILE = 0, + ERROR_TOK = 255, + XKB_KEYMAP = 1, + XKB_KEYCODES = 2, + XKB_TYPES = 3, + XKB_SYMBOLS = 4, + XKB_COMPATMAP = 5, + XKB_GEOMETRY = 6, + XKB_SEMANTICS = 7, + XKB_LAYOUT = 8, + INCLUDE = 10, + OVERRIDE = 11, + AUGMENT = 12, + REPLACE = 13, + ALTERNATE = 14, + VIRTUAL_MODS = 20, + TYPE = 21, + INTERPRET = 22, + ACTION_TOK = 23, + KEY = 24, + ALIAS = 25, + GROUP = 26, + MODIFIER_MAP = 27, + INDICATOR = 28, + SHAPE = 29, + KEYS = 30, + ROW = 31, + SECTION = 32, + OVERLAY = 33, + TEXT = 34, + OUTLINE = 35, + SOLID = 36, + LOGO = 37, + VIRTUAL = 38, + EQUALS = 40, + PLUS = 41, + MINUS = 42, + DIVIDE = 43, + TIMES = 44, + OBRACE = 45, + CBRACE = 46, + OPAREN = 47, + CPAREN = 48, + OBRACKET = 49, + CBRACKET = 50, + DOT = 51, + COMMA = 52, + SEMI = 53, + EXCLAM = 54, + INVERT = 55, + STRING = 60, + INTEGER = 61, + FLOAT = 62, + IDENT = 63, + KEYNAME = 64, + PARTIAL = 70, + DEFAULT = 71, + HIDDEN = 72, + ALPHANUMERIC_KEYS = 73, + MODIFIER_KEYS = 74, + KEYPAD_KEYS = 75, + FUNCTION_KEYS = 76, + ALTERNATE_GROUP = 77 + }; #endif -/* Tokens. */ -#define END_OF_FILE 0 -#define ERROR_TOK 255 -#define XKB_KEYMAP 1 -#define XKB_KEYCODES 2 -#define XKB_TYPES 3 -#define XKB_SYMBOLS 4 -#define XKB_COMPATMAP 5 -#define XKB_GEOMETRY 6 -#define XKB_SEMANTICS 7 -#define XKB_LAYOUT 8 -#define INCLUDE 10 -#define OVERRIDE 11 -#define AUGMENT 12 -#define REPLACE 13 -#define ALTERNATE 14 -#define VIRTUAL_MODS 20 -#define TYPE 21 -#define INTERPRET 22 -#define ACTION_TOK 23 -#define KEY 24 -#define ALIAS 25 -#define GROUP 26 -#define MODIFIER_MAP 27 -#define INDICATOR 28 -#define SHAPE 29 -#define KEYS 30 -#define ROW 31 -#define SECTION 32 -#define OVERLAY 33 -#define TEXT 34 -#define OUTLINE 35 -#define SOLID 36 -#define LOGO 37 -#define VIRTUAL 38 -#define EQUALS 40 -#define PLUS 41 -#define MINUS 42 -#define DIVIDE 43 -#define TIMES 44 -#define OBRACE 45 -#define CBRACE 46 -#define OPAREN 47 -#define CPAREN 48 -#define OBRACKET 49 -#define CBRACKET 50 -#define DOT 51 -#define COMMA 52 -#define SEMI 53 -#define EXCLAM 54 -#define INVERT 55 -#define STRING 60 -#define INTEGER 61 -#define FLOAT 62 -#define IDENT 63 -#define KEYNAME 64 -#define PARTIAL 70 -#define DEFAULT 71 -#define HIDDEN 72 -#define ALPHANUMERIC_KEYS 73 -#define MODIFIER_KEYS 74 -#define KEYPAD_KEYS 75 -#define FUNCTION_KEYS 76 -#define ALTERNATE_GROUP 77 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ -/* Line 2068 of yacc.c */ -#line 161 "parser.y" +union YYSTYPE +{ +#line 162 "../src/xkbcomp/parser.y" /* yacc.c:1909 */ int ival; int64_t num; enum xkb_file_type file_type; char *str; - xkb_atom_t sval; + xkb_atom_t atom; enum merge_mode merge; enum xkb_map_flags mapFlags; xkb_keysym_t keysym; @@ -201,16 +142,16 @@ typedef union YYSTYPE void *geom; XkbFile *file; +#line 146 "xkbcommon-internal@sta/parser.h" /* yacc.c:1909 */ +}; - -/* Line 2068 of yacc.c */ -#line 208 "src/xkbcomp/parser.h" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif +int _xkbcommon_parse (struct parser_param *param); +#endif /* !YY__XKBCOMMON_XKBCOMMON_INTERNAL_STA_PARSER_H_INCLUDED */ diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/rules.c b/src/3rdparty/xkbcommon/src/xkbcomp/rules.c index 61799e7059..2a364c8aed 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/rules.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/rules.c @@ -85,7 +85,7 @@ skip_more_whitespace_and_comments: /* Skip comments. */ if (lit(s, "//")) { - while (!eof(s) && !eol(s)) next(s); + skip_to_eol(s); } /* New line. */ @@ -182,15 +182,23 @@ static const struct sval rules_kccgst_svals[_KCCGST_NUM_ENTRIES] = { [KCCGST_GEOMETRY] = SVAL_LIT("geometry"), }; +/* We use this to keep score whether an mlvo was matched or not; if not, + * we warn the user that his preference was ignored. */ +struct matched_sval { + struct sval sval; + bool matched; +}; +typedef darray(struct matched_sval) darray_matched_sval; + /* * A broken-down version of xkb_rule_names (without the rules, * obviously). */ struct rule_names { - struct sval model; - darray_sval layouts; - darray_sval variants; - darray_sval options; + struct matched_sval model; + darray_matched_sval layouts; + darray_matched_sval variants; + darray_matched_sval options; }; struct group { @@ -253,10 +261,10 @@ strip_spaces(struct sval v) return v; } -static darray_sval -split_comma_separated_string(const char *s) +static darray_matched_sval +split_comma_separated_mlvo(const char *s) { - darray_sval arr = darray_new(); + darray_matched_sval arr = darray_new(); /* * Make sure the array returned by this function always includes at @@ -264,15 +272,16 @@ split_comma_separated_string(const char *s) */ if (!s) { - struct sval val = { NULL, 0 }; + struct matched_sval val = { .sval = { NULL, 0 } }; darray_append(arr, val); return arr; } while (true) { - struct sval val = { s, 0 }; - while (*s != '\0' && *s != ',') { s++; val.len++; } - darray_append(arr, strip_spaces(val)); + struct matched_sval val = { .sval = { s, 0 } }; + while (*s != '\0' && *s != ',') { s++; val.sval.len++; } + val.sval = strip_spaces(val.sval); + darray_append(arr, val); if (*s == '\0') break; if (*s == ',') s++; } @@ -289,11 +298,11 @@ matcher_new(struct xkb_context *ctx, return NULL; m->ctx = ctx; - m->rmlvo.model.start = rmlvo->model; - m->rmlvo.model.len = strlen_safe(rmlvo->model); - m->rmlvo.layouts = split_comma_separated_string(rmlvo->layout); - m->rmlvo.variants = split_comma_separated_string(rmlvo->variant); - m->rmlvo.options = split_comma_separated_string(rmlvo->options); + m->rmlvo.model.sval.start = rmlvo->model; + m->rmlvo.model.sval.len = strlen_safe(rmlvo->model); + m->rmlvo.layouts = split_comma_separated_mlvo(rmlvo->layout); + m->rmlvo.variants = split_comma_separated_mlvo(rmlvo->variant); + m->rmlvo.options = split_comma_separated_mlvo(rmlvo->options); return m; } @@ -309,6 +318,8 @@ matcher_free(struct matcher *m) darray_free(m->rmlvo.options); darray_foreach(group, m->groups) darray_free(group->elements); + for (int i = 0; i < _KCCGST_NUM_ENTRIES; i++) + darray_free(m->kccgst[i]); darray_free(m->groups); free(m); } @@ -584,7 +595,7 @@ match_group(struct matcher *m, struct sval group_name, struct sval to) static bool match_value(struct matcher *m, struct sval val, struct sval to, - enum mlvo_match_type match_type) + enum mlvo_match_type match_type) { if (match_type == MLVO_MATCH_WILDCARD) return true; @@ -593,6 +604,16 @@ match_value(struct matcher *m, struct sval val, struct sval to, return svaleq(val, to); } +static bool +match_value_and_mark(struct matcher *m, struct sval val, + struct matched_sval *to, enum mlvo_match_type match_type) +{ + bool matched = match_value(m, val, to->sval, match_type); + if (matched) + to->matched = true; + return matched; +} + /* * This function performs %-expansion on @value (see overview above), * and appends the result to @to. @@ -614,7 +635,7 @@ append_expanded_kccgst_value(struct matcher *m, darray_char *to, enum rules_mlvo mlv; xkb_layout_index_t idx; char pfx, sfx; - struct sval expanded_value; + struct matched_sval *expanded_value; /* Check if that's a start of an expansion. */ if (s[i] != '%') { @@ -664,40 +685,42 @@ append_expanded_kccgst_value(struct matcher *m, darray_char *to, } /* Get the expanded value. */ - expanded_value.len = 0; + expanded_value = NULL; if (mlv == MLVO_LAYOUT) { if (idx != XKB_LAYOUT_INVALID && idx < darray_size(m->rmlvo.layouts) && darray_size(m->rmlvo.layouts) > 1) - expanded_value = darray_item(m->rmlvo.layouts, idx); + expanded_value = &darray_item(m->rmlvo.layouts, idx); else if (idx == XKB_LAYOUT_INVALID && darray_size(m->rmlvo.layouts) == 1) - expanded_value = darray_item(m->rmlvo.layouts, 0); + expanded_value = &darray_item(m->rmlvo.layouts, 0); } else if (mlv == MLVO_VARIANT) { if (idx != XKB_LAYOUT_INVALID && idx < darray_size(m->rmlvo.variants) && darray_size(m->rmlvo.variants) > 1) - expanded_value = darray_item(m->rmlvo.variants, idx); + expanded_value = &darray_item(m->rmlvo.variants, idx); else if (idx == XKB_LAYOUT_INVALID && darray_size(m->rmlvo.variants) == 1) - expanded_value = darray_item(m->rmlvo.variants, 0); + expanded_value = &darray_item(m->rmlvo.variants, 0); } else if (mlv == MLVO_MODEL) { - expanded_value = m->rmlvo.model; + expanded_value = &m->rmlvo.model; } /* If we didn't get one, skip silently. */ - if (expanded_value.len <= 0) + if (!expanded_value || expanded_value->sval.len == 0) continue; if (pfx != 0) darray_appends_nullterminate(expanded, &pfx, 1); darray_appends_nullterminate(expanded, - expanded_value.start, expanded_value.len); + expanded_value->sval.start, + expanded_value->sval.len); if (sfx != 0) darray_appends_nullterminate(expanded, &sfx, 1); + expanded_value->matched = true; } /* @@ -743,29 +766,28 @@ matcher_rule_apply_if_matches(struct matcher *m) enum rules_mlvo mlvo = m->mapping.mlvo_at_pos[i]; struct sval value = m->rule.mlvo_value_at_pos[i]; enum mlvo_match_type match_type = m->rule.match_type_at_pos[i]; + struct matched_sval *to; bool matched = false; if (mlvo == MLVO_MODEL) { - matched = match_value(m, value, m->rmlvo.model, match_type); + to = &m->rmlvo.model; + matched = match_value_and_mark(m, value, to, match_type); } else if (mlvo == MLVO_LAYOUT) { xkb_layout_index_t idx = m->mapping.layout_idx; idx = (idx == XKB_LAYOUT_INVALID ? 0 : idx); - matched = match_value(m, value, - darray_item(m->rmlvo.layouts, idx), - match_type); + to = &darray_item(m->rmlvo.layouts, idx); + matched = match_value_and_mark(m, value, to, match_type); } else if (mlvo == MLVO_VARIANT) { xkb_layout_index_t idx = m->mapping.layout_idx; idx = (idx == XKB_LAYOUT_INVALID ? 0 : idx); - matched = match_value(m, value, - darray_item(m->rmlvo.variants, idx), - match_type); + to = &darray_item(m->rmlvo.variants, idx); + matched = match_value_and_mark(m, value, to, match_type); } else if (mlvo == MLVO_OPTION) { - struct sval *option; - darray_foreach(option, m->rmlvo.options) { - matched = match_value(m, value, *option, match_type); + darray_foreach(to, m->rmlvo.options) { + matched = match_value_and_mark(m, value, to, match_type); if (matched) break; } @@ -801,11 +823,12 @@ matcher_match(struct matcher *m, const char *string, size_t len, const char *file_name, struct xkb_component_names *out) { enum rules_token tok; + struct matched_sval *mval; if (!m) return false; - scanner_init(&m->scanner, m->ctx, string, len, file_name); + scanner_init(&m->scanner, m->ctx, string, len, file_name, NULL); initial: switch (tok = gettok(m)) { @@ -944,12 +967,29 @@ finish: darray_empty(m->kccgst[KCCGST_SYMBOLS])) goto error; - out->keycodes = darray_mem(m->kccgst[KCCGST_KEYCODES], 0); - out->types = darray_mem(m->kccgst[KCCGST_TYPES], 0); - out->compat = darray_mem(m->kccgst[KCCGST_COMPAT], 0); - /* out->geometry = darray_mem(m->kccgst[KCCGST_GEOMETRY], 0); */ + darray_steal(m->kccgst[KCCGST_KEYCODES], &out->keycodes, NULL); + darray_steal(m->kccgst[KCCGST_TYPES], &out->types, NULL); + darray_steal(m->kccgst[KCCGST_COMPAT], &out->compat, NULL); + darray_steal(m->kccgst[KCCGST_SYMBOLS], &out->symbols, NULL); darray_free(m->kccgst[KCCGST_GEOMETRY]); - out->symbols = darray_mem(m->kccgst[KCCGST_SYMBOLS], 0); + + + mval = &m->rmlvo.model; + if (!mval->matched && mval->sval.len > 0) + log_err(m->ctx, "Unrecognized RMLVO model \"%.*s\" was ignored\n", + mval->sval.len, mval->sval.start); + darray_foreach(mval, m->rmlvo.layouts) + if (!mval->matched && mval->sval.len > 0) + log_err(m->ctx, "Unrecognized RMLVO layout \"%.*s\" was ignored\n", + mval->sval.len, mval->sval.start); + darray_foreach(mval, m->rmlvo.variants) + if (!mval->matched && mval->sval.len > 0) + log_err(m->ctx, "Unrecognized RMLVO variant \"%.*s\" was ignored\n", + mval->sval.len, mval->sval.start); + darray_foreach(mval, m->rmlvo.options) + if (!mval->matched && mval->sval.len > 0) + log_err(m->ctx, "Unrecognized RMLVO option \"%.*s\" was ignored\n", + mval->sval.len, mval->sval.start); return true; @@ -967,7 +1007,7 @@ xkb_components_from_rules(struct xkb_context *ctx, bool ret = false; FILE *file; char *path; - const char *string; + char *string; size_t size; struct matcher *matcher; diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/scanner.c b/src/3rdparty/xkbcommon/src/xkbcomp/scanner.c index 9f200bbec4..1ce6137bf3 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/scanner.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/scanner.c @@ -23,6 +23,7 @@ #include "xkbcomp-priv.h" #include "parser-priv.h" +#include "scanner-utils.h" static bool number(struct scanner *s, int64_t *out, int *out_tok) @@ -68,7 +69,7 @@ skip_more_whitespace_and_comments: /* Skip comments. */ if (lit(s, "//") || chr(s, '#')) { - while (!eof(s) && !eol(s)) next(s); + skip_to_eol(s); goto skip_more_whitespace_and_comments; } @@ -121,7 +122,7 @@ skip_more_whitespace_and_comments: return ERROR_TOK; } /* Empty key name literals are allowed. */ - yylval->sval = xkb_atom_intern(s->ctx, s->buf, s->buf_pos - 1); + yylval->atom = xkb_atom_intern(s->ctx, s->buf, s->buf_pos - 1); return KEYNAME; } @@ -181,7 +182,7 @@ XkbParseString(struct xkb_context *ctx, const char *string, size_t len, const char *file_name, const char *map) { struct scanner scanner; - scanner_init(&scanner, ctx, string, len, file_name); + scanner_init(&scanner, ctx, string, len, file_name, NULL); return parse(ctx, &scanner, map); } @@ -191,7 +192,7 @@ XkbParseFile(struct xkb_context *ctx, FILE *file, { bool ok; XkbFile *xkb_file; - const char *string; + char *string; size_t size; ok = map_file(file, &string, &size); diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/symbols.c b/src/3rdparty/xkbcommon/src/xkbcomp/symbols.c index bd7f73d4f1..9b05ec924f 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/symbols.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/symbols.c @@ -72,10 +72,10 @@ enum group_field { }; enum key_field { - KEY_FIELD_REPEAT = (1 << 0), + KEY_FIELD_REPEAT = (1 << 0), KEY_FIELD_DEFAULT_TYPE = (1 << 1), KEY_FIELD_GROUPINFO = (1 << 2), - KEY_FIELD_VMODMAP = (1 << 3), + KEY_FIELD_VMODMAP = (1 << 3), }; typedef struct { @@ -177,19 +177,24 @@ typedef struct { ActionsInfo *actions; darray(xkb_atom_t) group_names; darray(ModMapEntry) modmaps; + struct xkb_mod_set mods; - struct xkb_keymap *keymap; + struct xkb_context *ctx; + /* Needed for AddKeySymbols. */ + const struct xkb_keymap *keymap; } SymbolsInfo; static void -InitSymbolsInfo(SymbolsInfo *info, struct xkb_keymap *keymap, - ActionsInfo *actions) +InitSymbolsInfo(SymbolsInfo *info, const struct xkb_keymap *keymap, + ActionsInfo *actions, const struct xkb_mod_set *mods) { memset(info, 0, sizeof(*info)); + info->ctx = keymap->ctx; info->keymap = keymap; info->merge = MERGE_OVERRIDE; InitKeyInfo(keymap->ctx, &info->default_key); info->actions = actions; + info->mods = *mods; info->explicit_group = XKB_LAYOUT_INVALID; } @@ -209,7 +214,7 @@ ClearSymbolsInfo(SymbolsInfo *info) static const char * KeyInfoText(SymbolsInfo *info, KeyInfo *keyi) { - return KeyNameText(info->keymap->ctx, keyi->name); + return KeyNameText(info->ctx, keyi->name); } static bool @@ -217,7 +222,7 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber, bool report, xkb_layout_index_t group, xkb_atom_t key_name) { xkb_level_index_t i, levels_in_both; - struct xkb_context *ctx = info->keymap->ctx; + struct xkb_level *level; /* First find the type of the merged group. */ if (into->type != from->type) { @@ -231,11 +236,12 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber, xkb_atom_t ignore = (clobber ? into->type : from->type); if (report) - log_warn(info->keymap->ctx, + log_warn(info->ctx, "Multiple definitions for group %d type of key %s; " "Using %s, ignoring %s\n", - group + 1, KeyNameText(ctx, key_name), - xkb_atom_text(ctx, use), xkb_atom_text(ctx, ignore)); + group + 1, KeyNameText(info->ctx, key_name), + xkb_atom_text(info->ctx, use), + xkb_atom_text(info->ctx, ignore)); into->type = use; } @@ -273,10 +279,10 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber, ignore = (clobber ? &intoLevel->action : &fromLevel->action); if (report) - log_warn(ctx, + log_warn(info->ctx, "Multiple actions for level %d/group %u on key %s; " "Using %s, ignoring %s\n", - i + 1, group + 1, KeyNameText(ctx, key_name), + i + 1, group + 1, KeyNameText(info->ctx, key_name), ActionTypeText(use->type), ActionTypeText(ignore->type)); @@ -293,12 +299,12 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber, intoLevel->u.sym = fromLevel->u.sym; fromLevel->num_syms = 0; } - else { + else if (!XkbLevelsSameSyms(fromLevel, intoLevel)) { if (report) - log_warn(ctx, + log_warn(info->ctx, "Multiple symbols for level %d/group %u on key %s; " "Using %s, ignoring %s\n", - i + 1, group + 1, KeyNameText(ctx, key_name), + i + 1, group + 1, KeyNameText(info->ctx, key_name), (clobber ? "from" : "to"), (clobber ? "to" : "from")); @@ -314,9 +320,9 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber, } } /* If @from has extra levels, get them as well. */ - for (i = levels_in_both; i < darray_size(from->levels); i++) { - darray_append(into->levels, darray_item(from->levels, i)); - darray_item(from->levels, i).num_syms = 0; + darray_foreach_from(level, from->levels, levels_in_both) { + darray_append(into->levels, *level); + level->num_syms = 0; } into->defined |= (from->defined & GROUP_FIELD_ACTS); into->defined |= (from->defined & GROUP_FIELD_SYMS); @@ -348,14 +354,14 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from, bool same_file) xkb_layout_index_t i; xkb_layout_index_t groups_in_both; enum key_field collide = 0; - const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); + const int verbosity = xkb_context_get_log_verbosity(info->ctx); const bool clobber = (from->merge != MERGE_AUGMENT); const bool report = (same_file && verbosity > 0) || verbosity > 9; if (from->merge == MERGE_REPLACE) { ClearKeyInfo(into); *into = *from; - InitKeyInfo(info->keymap->ctx, from); + InitKeyInfo(info->ctx, from); return true; } @@ -394,17 +400,18 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from, bool same_file) } if (collide) - log_warn(info->keymap->ctx, + log_warn(info->ctx, "Symbol map for key %s redefined; " "Using %s definition for conflicting fields\n", - KeyNameText(info->keymap->ctx, into->name), + KeyNameText(info->ctx, into->name), (clobber ? "first" : "last")); ClearKeyInfo(from); - InitKeyInfo(info->keymap->ctx, from); + InitKeyInfo(info->ctx, from); return true; } +/* TODO: Make it so this function doesn't need the entire keymap. */ static bool AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi, bool same_file) { @@ -426,7 +433,7 @@ AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi, bool same_file) return MergeKeys(info, iter, keyi, same_file); darray_append(info->keys, *keyi); - InitKeyInfo(info->keymap->ctx, keyi); + InitKeyInfo(info->ctx, keyi); return true; } @@ -451,19 +458,19 @@ AddModMapEntry(SymbolsInfo *info, ModMapEntry *new) ignore = (clobber ? old->modifier : new->modifier); if (new->haveSymbol) - log_err(info->keymap->ctx, + log_err(info->ctx, "Symbol \"%s\" added to modifier map for multiple modifiers; " "Using %s, ignoring %s\n", - KeysymText(info->keymap->ctx, new->u.keySym), - ModIndexText(info->keymap, use), - ModIndexText(info->keymap, ignore)); + KeysymText(info->ctx, new->u.keySym), + ModIndexText(info->ctx, &info->mods, use), + ModIndexText(info->ctx, &info->mods, ignore)); else - log_err(info->keymap->ctx, + log_err(info->ctx, "Key \"%s\" added to modifier map for multiple modifiers; " "Using %s, ignoring %s\n", - KeyNameText(info->keymap->ctx, new->u.keyName), - ModIndexText(info->keymap, use), - ModIndexText(info->keymap, ignore)); + KeyNameText(info->ctx, new->u.keyName), + ModIndexText(info->ctx, &info->mods, use), + ModIndexText(info->ctx, &info->mods, ignore)); old->modifier = use; return true; @@ -479,8 +486,6 @@ static void MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from, enum merge_mode merge) { - KeyInfo *keyi; - ModMapEntry *mm; xkb_atom_t *group_name; xkb_layout_index_t group_names_in_both; @@ -489,6 +494,8 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from, return; } + into->mods = from->mods; + if (into->name == NULL) { into->name = from->name; from->name = NULL; @@ -514,6 +521,7 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from, darray_init(from->keys); } else { + KeyInfo *keyi; darray_foreach(keyi, from->keys) { keyi->merge = (merge == MERGE_DEFAULT ? keyi->merge : merge); if (!AddKeySymbols(into, keyi, false)) @@ -526,6 +534,7 @@ MergeIncludedSymbols(SymbolsInfo *into, SymbolsInfo *from, darray_init(from->modmaps); } else { + ModMapEntry *mm; darray_foreach(mm, from->modmaps) { mm->merge = (merge == MERGE_DEFAULT ? mm->merge : merge); if (!AddModMapEntry(into, mm)) @@ -542,7 +551,7 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *include) { SymbolsInfo included; - InitSymbolsInfo(&included, info->keymap, info->actions); + InitSymbolsInfo(&included, info->keymap, info->actions, &info->mods); included.name = include->stmt; include->stmt = NULL; @@ -550,18 +559,19 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *include) SymbolsInfo next_incl; XkbFile *file; - file = ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_SYMBOLS); + file = ProcessIncludeFile(info->ctx, stmt, FILE_TYPE_SYMBOLS); if (!file) { info->errorCount += 10; ClearSymbolsInfo(&included); return false; } - InitSymbolsInfo(&next_incl, info->keymap, info->actions); + InitSymbolsInfo(&next_incl, info->keymap, info->actions, + &included.mods); if (stmt->modifier) { next_incl.explicit_group = atoi(stmt->modifier) - 1; if (next_incl.explicit_group >= XKB_MAX_GROUPS) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Cannot set explicit group to %d - must be between 1..%d; " "Ignoring group number\n", next_incl.explicit_group + 1, XKB_MAX_GROUPS); @@ -609,7 +619,7 @@ GetGroupIndex(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, } if (i >= XKB_MAX_GROUPS) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Too many groups of %s for key %s (max %u); " "Ignoring %s defined for extra groups\n", name, KeyInfoText(info, keyi), XKB_MAX_GROUPS, name); @@ -621,8 +631,8 @@ GetGroupIndex(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, return true; } - if (!ExprResolveGroup(info->keymap->ctx, arrayNdx, ndx_rtrn)) { - log_err(info->keymap->ctx, + if (!ExprResolveGroup(info->ctx, arrayNdx, ndx_rtrn)) { + log_err(info->ctx, "Illegal group index for %s of key %s\n" "Definition with non-integer array index ignored\n", name, KeyInfoText(info, keyi)); @@ -655,7 +665,7 @@ AddSymbolsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, } if (value->expr.op != EXPR_KEYSYM_LIST) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Expected a list of symbols, found %s; " "Ignoring symbols for group %u of %s\n", expr_op_type_to_string(value->expr.op), ndx + 1, @@ -664,7 +674,7 @@ AddSymbolsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, } if (groupi->defined & GROUP_FIELD_SYMS) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Symbols for key %s, group %u already defined; " "Ignoring duplicate definition\n", KeyInfoText(info, keyi), ndx + 1); @@ -725,7 +735,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, } if (value->expr.op != EXPR_ACTION_LIST) { - log_wsgo(info->keymap->ctx, + log_wsgo(info->ctx, "Bad expression type (%d) for action list value; " "Ignoring actions for group %u of %s\n", value->expr.op, ndx, KeyInfoText(info, keyi)); @@ -733,7 +743,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, } if (groupi->defined & GROUP_FIELD_ACTS) { - log_wsgo(info->keymap->ctx, + log_wsgo(info->ctx, "Actions for key %s, group %u already defined\n", KeyInfoText(info, keyi), ndx); return false; @@ -752,8 +762,8 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx, for (unsigned i = 0; i < nActs; i++) { union xkb_action *toAct = &darray_item(groupi->levels, i).action; - if (!HandleActionDef(act, info->keymap, toAct, info->actions)) - log_err(info->keymap->ctx, + if (!HandleActionDef(info->ctx, info->actions, &info->mods, act, toAct)) + log_err(info->ctx, "Illegal action definition for %s; " "Action for group %u/level %u ignored\n", KeyInfoText(info, keyi), ndx + 1, i + 1); @@ -779,14 +789,12 @@ static bool SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, ExprDef *arrayNdx, ExprDef *value) { - struct xkb_context *ctx = info->keymap->ctx; - if (istreq(field, "type")) { xkb_layout_index_t ndx; xkb_atom_t val; - if (!ExprResolveString(ctx, value, &val)) { - log_err(ctx, + if (!ExprResolveString(info->ctx, value, &val)) { + log_err(info->ctx, "The type field of a key symbol map must be a string; " "Ignoring illegal type definition\n"); return false; @@ -796,8 +804,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, keyi->default_type = val; keyi->defined |= KEY_FIELD_DEFAULT_TYPE; } - else if (!ExprResolveGroup(ctx, arrayNdx, &ndx)) { - log_err(ctx, + else if (!ExprResolveGroup(info->ctx, arrayNdx, &ndx)) { + log_err(info->ctx, "Illegal group index for type of key %s; " "Definition with non-integer array index ignored\n", KeyInfoText(info, keyi)); @@ -822,8 +830,9 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, istreq(field, "virtualmodifiers")) { xkb_mod_mask_t mask; - if (!ExprResolveModMask(info->keymap, value, MOD_VIRT, &mask)) { - log_err(ctx, + if (!ExprResolveModMask(info->ctx, value, MOD_VIRT, &info->mods, + &mask)) { + log_err(info->ctx, "Expected a virtual modifier mask, found %s; " "Ignoring virtual modifiers definition for key %s\n", expr_op_type_to_string(value->expr.op), @@ -837,7 +846,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, else if (istreq(field, "locking") || istreq(field, "lock") || istreq(field, "locks")) { - log_vrb(ctx, 1, + log_vrb(info->ctx, 1, "Key behaviors not supported; " "Ignoring locking specification for key %s\n", KeyInfoText(info, keyi)); @@ -845,14 +854,14 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, else if (istreq(field, "radiogroup") || istreq(field, "permanentradiogroup") || istreq(field, "allownone")) { - log_vrb(ctx, 1, + log_vrb(info->ctx, 1, "Radio groups not supported; " "Ignoring radio group specification for key %s\n", KeyInfoText(info, keyi)); } else if (istreq_prefix("overlay", field) || istreq_prefix("permanentoverlay", field)) { - log_vrb(ctx, 1, + log_vrb(info->ctx, 1, "Overlays not supported; " "Ignoring overlay specification for key %s\n", KeyInfoText(info, keyi)); @@ -862,8 +871,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, istreq(field, "repeat")) { unsigned int val; - if (!ExprResolveEnum(ctx, value, &val, repeatEntries)) { - log_err(ctx, + if (!ExprResolveEnum(info->ctx, value, &val, repeatEntries)) { + log_err(info->ctx, "Illegal repeat setting for %s; " "Non-boolean repeat setting ignored\n", KeyInfoText(info, keyi)); @@ -877,8 +886,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, istreq(field, "wrapgroups")) { bool set; - if (!ExprResolveBoolean(ctx, value, &set)) { - log_err(ctx, + if (!ExprResolveBoolean(info->ctx, value, &set)) { + log_err(info->ctx, "Illegal groupsWrap setting for %s; " "Non-boolean value ignored\n", KeyInfoText(info, keyi)); @@ -892,8 +901,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, istreq(field, "clampgroups")) { bool set; - if (!ExprResolveBoolean(ctx, value, &set)) { - log_err(ctx, + if (!ExprResolveBoolean(info->ctx, value, &set)) { + log_err(info->ctx, "Illegal groupsClamp setting for %s; " "Non-boolean value ignored\n", KeyInfoText(info, keyi)); @@ -907,8 +916,8 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, istreq(field, "redirectgroups")) { xkb_layout_index_t grp; - if (!ExprResolveGroup(ctx, value, &grp)) { - log_err(ctx, + if (!ExprResolveGroup(info->ctx, value, &grp)) { + log_err(info->ctx, "Illegal group index for redirect of key %s; " "Definition with non-integer group ignored\n", KeyInfoText(info, keyi)); @@ -920,7 +929,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field, keyi->defined |= KEY_FIELD_GROUPINFO; } else { - log_err(ctx, + log_err(info->ctx, "Unknown field %s in a symbol interpretation; " "Definition ignored\n", field); @@ -937,21 +946,21 @@ SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value) xkb_atom_t name; if (!arrayNdx) { - log_vrb(info->keymap->ctx, 1, + log_vrb(info->ctx, 1, "You must specify an index when specifying a group name; " "Group name definition without array subscript ignored\n"); return false; } - if (!ExprResolveGroup(info->keymap->ctx, arrayNdx, &group)) { - log_err(info->keymap->ctx, + if (!ExprResolveGroup(info->ctx, arrayNdx, &group)) { + log_err(info->ctx, "Illegal index in group name definition; " "Definition with non-integer array index ignored\n"); return false; } - if (!ExprResolveString(info->keymap->ctx, value, &name)) { - log_err(info->keymap->ctx, + if (!ExprResolveString(info->ctx, value, &name)) { + log_err(info->ctx, "Group name must be a string; " "Illegal name for group %d ignored\n", group); return false; @@ -964,12 +973,12 @@ SetGroupName(SymbolsInfo *info, ExprDef *arrayNdx, ExprDef *value) group_to_use = info->explicit_group; } else { - log_warn(info->keymap->ctx, + log_warn(info->ctx, "An explicit group was specified for the '%s' map, " "but it provides a name for a group other than Group1 (%d); " "Ignoring group name '%s'\n", info->name, group, - xkb_atom_text(info->keymap->ctx, name)); + xkb_atom_text(info->ctx, name)); return false; } @@ -987,7 +996,7 @@ HandleGlobalVar(SymbolsInfo *info, VarDef *stmt) ExprDef *arrayNdx; bool ret; - if (!ExprResolveLhs(info->keymap->ctx, stmt->name, &elem, &field, &arrayNdx)) + if (!ExprResolveLhs(info->ctx, stmt->name, &elem, &field, &arrayNdx)) return false; if (elem && istreq(elem, "key")) { @@ -1000,31 +1009,31 @@ HandleGlobalVar(SymbolsInfo *info, VarDef *stmt) } else if (!elem && (istreq(field, "groupswrap") || istreq(field, "wrapgroups"))) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Global \"groupswrap\" not supported; Ignored\n"); ret = true; } else if (!elem && (istreq(field, "groupsclamp") || istreq(field, "clampgroups"))) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Global \"groupsclamp\" not supported; Ignored\n"); ret = true; } else if (!elem && (istreq(field, "groupsredirect") || istreq(field, "redirectgroups"))) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Global \"groupsredirect\" not supported; Ignored\n"); ret = true; } else if (!elem && istreq(field, "allownone")) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Radio groups not supported; " "Ignoring \"allownone\" specification\n"); ret = true; } else { - ret = SetActionField(info->keymap, elem, field, arrayNdx, stmt->value, - info->actions); + ret = SetActionField(info->ctx, info->actions, &info->mods, + elem, field, arrayNdx, stmt->value); } return ret; @@ -1039,7 +1048,7 @@ HandleSymbolsBody(SymbolsInfo *info, VarDef *def, KeyInfo *keyi) for (; def; def = (VarDef *) def->common.next) { if (def->name && def->name->expr.op == EXPR_FIELD_REF) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Cannot set a global default value from within a key statement; " "Move statements to the global file scope\n"); continue; @@ -1053,7 +1062,7 @@ HandleSymbolsBody(SymbolsInfo *info, VarDef *def, KeyInfo *keyi) arrayNdx = NULL; } else { - ok = ExprResolveLhs(info->keymap->ctx, def->name, &elem, &field, + ok = ExprResolveLhs(info->ctx, def->name, &elem, &field, &arrayNdx); } @@ -1083,7 +1092,7 @@ SetExplicitGroup(SymbolsInfo *info, KeyInfo *keyi) } if (warn) - log_warn(info->keymap->ctx, + log_warn(info->ctx, "For the map %s an explicit group specified, " "but key %s has more than one group defined; " "All groups except first one will be ignored\n", @@ -1137,11 +1146,11 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def) ModMapEntry tmp; xkb_mod_index_t ndx; bool ok; - struct xkb_context *ctx = info->keymap->ctx; + struct xkb_context *ctx = info->ctx; - ndx = ModNameToIndex(info->keymap, def->modifier, MOD_REAL); + ndx = XkbModNameToIndex(&info->mods, def->modifier, MOD_REAL); if (ndx == XKB_MOD_INVALID) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Illegal modifier map definition; " "Ignoring map for non-modifier \"%s\"\n", xkb_atom_text(ctx, def->modifier)); @@ -1165,10 +1174,10 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def) tmp.u.keySym = sym; } else { - log_err(info->keymap->ctx, + log_err(info->ctx, "Modmap entries may contain only key names or keysyms; " "Illegal definition for %s modifier ignored\n", - ModIndexText(info->keymap, tmp.modifier)); + ModIndexText(info->ctx, &info->mods, tmp.modifier)); continue; } @@ -1197,13 +1206,13 @@ HandleSymbolsFile(SymbolsInfo *info, XkbFile *file, enum merge_mode merge) ok = HandleGlobalVar(info, (VarDef *) stmt); break; case STMT_VMOD: - ok = HandleVModDef(info->keymap, (VModDef *) stmt, merge); + ok = HandleVModDef(info->ctx, &info->mods, (VModDef *) stmt, merge); break; case STMT_MODMAP: ok = HandleModMapDef(info, (ModMapDef *) stmt); break; default: - log_err(info->keymap->ctx, + log_err(info->ctx, "Symbols files may not include other types; " "Ignoring %s\n", stmt_type_to_string(stmt->type)); ok = false; @@ -1214,8 +1223,8 @@ HandleSymbolsFile(SymbolsInfo *info, XkbFile *file, enum merge_mode merge) info->errorCount++; if (info->errorCount > 10) { - log_err(info->keymap->ctx, "Abandoning symbols file \"%s\"\n", - file->topName); + log_err(info->ctx, "Abandoning symbols file \"%s\"\n", + file->name); break; } } @@ -1234,38 +1243,31 @@ HandleSymbolsFile(SymbolsInfo *info, XkbFile *file, enum merge_mode merge) static struct xkb_key * FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym) { - struct xkb_key *key, *ret = NULL; - xkb_layout_index_t group, min_group = UINT32_MAX; - xkb_level_index_t level, min_level = UINT16_MAX; - - xkb_foreach_key(key, keymap) { - for (group = 0; group < key->num_groups; group++) { - for (level = 0; level < XkbKeyGroupWidth(key, group); level++) { - if (key->groups[group].levels[level].num_syms != 1 || - key->groups[group].levels[level].u.sym != sym) - continue; - - /* - * If the keysym was found in a group or level > 0, we must - * keep looking since we might find a key in which the keysym - * is in a lower group or level. - */ - if (group < min_group || - (group == min_group && level < min_level)) { - ret = key; - if (group == 0 && level == 0) { - return ret; - } - else { - min_group = group; - min_level = level; - } + struct xkb_key *key; + xkb_layout_index_t group; + bool got_one_group, got_one_level; + + group = 0; + do { + xkb_level_index_t level = 0; + got_one_group = false; + do { + got_one_level = false; + xkb_keys_foreach(key, keymap) { + if (group < key->num_groups && + level < XkbKeyNumLevels(key, group)) { + got_one_group = got_one_level = true; + if (key->groups[group].levels[level].num_syms == 1 && + key->groups[group].levels[level].u.sym == sym) + return key; } } - } - } + level++; + } while (got_one_level); + group++; + } while (got_one_group); - return ret; + return NULL; } /* @@ -1283,8 +1285,8 @@ FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym) static xkb_atom_t FindAutomaticType(struct xkb_context *ctx, GroupInfo *groupi) { - xkb_keysym_t sym0, sym1, sym2, sym3; - xkb_level_index_t width = darray_size(groupi->levels); + xkb_keysym_t sym0, sym1; + const xkb_level_index_t width = darray_size(groupi->levels); #define GET_SYM(level) \ (darray_item(groupi->levels, level).num_syms == 0 ? \ @@ -1312,6 +1314,7 @@ FindAutomaticType(struct xkb_context *ctx, GroupInfo *groupi) if (width <= 4) { if (xkb_keysym_is_lower(sym0) && xkb_keysym_is_upper(sym1)) { + xkb_keysym_t sym2, sym3; sym2 = GET_SYM(2); sym3 = (width == 4 ? GET_SYM(3) : XKB_KEY_NoSymbol); @@ -1386,9 +1389,9 @@ use_default: } static bool -CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi) +CopySymbolsDefToKeymap(struct xkb_keymap *keymap, SymbolsInfo *info, + KeyInfo *keyi) { - struct xkb_keymap *keymap = info->keymap; struct xkb_key *key; GroupInfo *groupi; const GroupInfo *group0; @@ -1400,7 +1403,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi) */ key = XkbKeyByName(keymap, keyi->name, false); if (!key) { - log_vrb(info->keymap->ctx, 5, + log_vrb(info->ctx, 5, "Key %s not found in keycodes; Symbols ignored\n", KeyInfoText(info, keyi)); return false; @@ -1443,7 +1446,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi) if (type->num_levels < darray_size(groupi->levels)) { struct xkb_level *leveli; - log_vrb(info->keymap->ctx, 1, + log_vrb(info->ctx, 1, "Type \"%s\" has %d levels, but %s has %d levels; " "Ignoring extra symbols\n", xkb_atom_text(keymap->ctx, type->name), type->num_levels, @@ -1460,10 +1463,8 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi) } /* Copy levels. */ - darray_enumerate(i, groupi, keyi->groups) { - key->groups[i].levels = darray_mem(groupi->levels, 0); - darray_init(groupi->levels); - } + darray_enumerate(i, groupi, keyi->groups) + darray_steal(groupi->levels, &key->groups[i].levels, NULL); key->out_of_range_group_number = keyi->out_of_range_group_number; key->out_of_range_group_action = keyi->out_of_range_group_action; @@ -1489,30 +1490,30 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi) } static bool -CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry) +CopyModMapDefToKeymap(struct xkb_keymap *keymap, SymbolsInfo *info, + ModMapEntry *entry) { struct xkb_key *key; - struct xkb_keymap *keymap = info->keymap; if (!entry->haveSymbol) { key = XkbKeyByName(keymap, entry->u.keyName, true); if (!key) { - log_vrb(info->keymap->ctx, 5, + log_vrb(info->ctx, 5, "Key %s not found in keycodes; " "Modifier map entry for %s not updated\n", - KeyNameText(keymap->ctx, entry->u.keyName), - ModIndexText(info->keymap, entry->modifier)); + KeyNameText(info->ctx, entry->u.keyName), + ModIndexText(info->ctx, &info->mods, entry->modifier)); return false; } } else { key = FindKeyForSymbol(keymap, entry->u.keySym); if (!key) { - log_vrb(info->keymap->ctx, 5, + log_vrb(info->ctx, 5, "Key \"%s\" not found in symbol map; " "Modifier map entry for %s not updated\n", - KeysymText(info->keymap->ctx, entry->u.keySym), - ModIndexText(info->keymap, entry->modifier)); + KeysymText(info->ctx, entry->u.keySym), + ModIndexText(info->ctx, &info->mods, entry->modifier)); return false; } } @@ -1530,30 +1531,31 @@ CopySymbolsToKeymap(struct xkb_keymap *keymap, SymbolsInfo *info) keymap->symbols_section_name = strdup_safe(info->name); XkbEscapeMapName(keymap->symbols_section_name); - keymap->num_group_names = darray_size(info->group_names); - keymap->group_names = darray_mem(info->group_names, 0); - darray_init(info->group_names); + keymap->mods = info->mods; + + darray_steal(info->group_names, + &keymap->group_names, &keymap->num_group_names); darray_foreach(keyi, info->keys) - if (!CopySymbolsDef(info, keyi)) + if (!CopySymbolsDefToKeymap(keymap, info, keyi)) info->errorCount++; if (xkb_context_get_log_verbosity(keymap->ctx) > 3) { struct xkb_key *key; - xkb_foreach_key(key, keymap) { + xkb_keys_foreach(key, keymap) { if (key->name == XKB_ATOM_NONE) continue; if (key->num_groups < 1) - log_info(keymap->ctx, + log_info(info->ctx, "No symbols defined for %s\n", - KeyNameText(keymap->ctx, key->name)); + KeyNameText(info->ctx, key->name)); } } darray_foreach(mm, info->modmaps) - if (!CopyModMapDef(info, mm)) + if (!CopyModMapDefToKeymap(keymap, info, mm)) info->errorCount++; /* XXX: If we don't ignore errorCount, things break. */ @@ -1571,7 +1573,7 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, if (!actions) return false; - InitSymbolsInfo(&info, keymap, actions); + InitSymbolsInfo(&info, keymap, actions, &keymap->mods); info.default_key.merge = merge; HandleSymbolsFile(&info, file, merge); diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/types.c b/src/3rdparty/xkbcommon/src/xkbcomp/types.c index 7708da3882..e85b67e893 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/types.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/types.c @@ -31,9 +31,9 @@ #include "include.h" enum type_field { - TYPE_FIELD_MASK = (1 << 0), - TYPE_FIELD_MAP = (1 << 1), - TYPE_FIELD_PRESERVE = (1 << 2), + TYPE_FIELD_MASK = (1 << 0), + TYPE_FIELD_MAP = (1 << 1), + TYPE_FIELD_PRESERVE = (1 << 2), TYPE_FIELD_LEVEL_NAME = (1 << 3), }; @@ -53,7 +53,9 @@ typedef struct { int errorCount; darray(KeyTypeInfo) types; - struct xkb_keymap *keymap; + struct xkb_mod_set mods; + + struct xkb_context *ctx; } KeyTypesInfo; /***====================================================================***/ @@ -61,26 +63,26 @@ typedef struct { static inline const char * MapEntryTxt(KeyTypesInfo *info, struct xkb_key_type_entry *entry) { - return ModMaskText(info->keymap, entry->mods.mods); + return ModMaskText(info->ctx, &info->mods, entry->mods.mods); } static inline const char * TypeTxt(KeyTypesInfo *info, KeyTypeInfo *type) { - return xkb_atom_text(info->keymap->ctx, type->name); + return xkb_atom_text(info->ctx, type->name); } static inline const char * TypeMaskTxt(KeyTypesInfo *info, KeyTypeInfo *type) { - return ModMaskText(info->keymap, type->mods); + return ModMaskText(info->ctx, &info->mods, type->mods); } static inline bool ReportTypeShouldBeArray(KeyTypesInfo *info, KeyTypeInfo *type, const char *field) { - return ReportShouldBeArray(info->keymap->ctx, "key type", field, + return ReportShouldBeArray(info->ctx, "key type", field, TypeTxt(info, type)); } @@ -88,17 +90,19 @@ static inline bool ReportTypeBadType(KeyTypesInfo *info, KeyTypeInfo *type, const char *field, const char *wanted) { - return ReportBadType(info->keymap->ctx, "key type", field, + return ReportBadType(info->ctx, "key type", field, TypeTxt(info, type), wanted); } /***====================================================================***/ static void -InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap) +InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_context *ctx, + const struct xkb_mod_set *mods) { memset(info, 0, sizeof(*info)); - info->keymap = keymap; + info->ctx = ctx; + info->mods = *mods; } static void @@ -131,16 +135,16 @@ static bool AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new, bool same_file) { KeyTypeInfo *old; - const int verbosity = xkb_context_get_log_verbosity(info->keymap->ctx); + const int verbosity = xkb_context_get_log_verbosity(info->ctx); old = FindMatchingKeyType(info, new->name); if (old) { if (new->merge == MERGE_REPLACE || new->merge == MERGE_OVERRIDE) { if ((same_file && verbosity > 0) || verbosity > 9) { - log_warn(info->keymap->ctx, + log_warn(info->ctx, "Multiple definitions of the %s key type; " "Earlier definition ignored\n", - xkb_atom_text(info->keymap->ctx, new->name)); + xkb_atom_text(info->ctx, new->name)); } ClearKeyTypeInfo(old); @@ -151,10 +155,10 @@ AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new, bool same_file) } if (same_file) - log_vrb(info->keymap->ctx, 4, + log_vrb(info->ctx, 4, "Multiple definitions of the %s key type; " "Later definition ignored\n", - xkb_atom_text(info->keymap->ctx, new->name)); + xkb_atom_text(info->ctx, new->name)); ClearKeyTypeInfo(new); return true; @@ -170,13 +174,13 @@ static void MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from, enum merge_mode merge) { - KeyTypeInfo *type; - if (from->errorCount > 0) { into->errorCount += from->errorCount; return; } + into->mods = from->mods; + if (into->name == NULL) { into->name = from->name; from->name = NULL; @@ -187,6 +191,7 @@ MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from, darray_init(from->types); } else { + KeyTypeInfo *type; darray_foreach(type, from->types) { type->merge = (merge == MERGE_DEFAULT ? type->merge : merge); if (!AddKeyType(into, type, false)) @@ -203,7 +208,7 @@ HandleIncludeKeyTypes(KeyTypesInfo *info, IncludeStmt *include) { KeyTypesInfo included; - InitKeyTypesInfo(&included, info->keymap); + InitKeyTypesInfo(&included, info->ctx, &info->mods); included.name = include->stmt; include->stmt = NULL; @@ -211,14 +216,14 @@ HandleIncludeKeyTypes(KeyTypesInfo *info, IncludeStmt *include) KeyTypesInfo next_incl; XkbFile *file; - file = ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_TYPES); + file = ProcessIncludeFile(info->ctx, stmt, FILE_TYPE_TYPES); if (!file) { info->errorCount += 10; ClearKeyTypesInfo(&included); return false; } - InitKeyTypesInfo(&next_incl, info->keymap); + InitKeyTypesInfo(&next_incl, info->ctx, &included.mods); HandleKeyTypesFile(&next_incl, file, stmt->merge); @@ -243,24 +248,24 @@ SetModifiers(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx, xkb_mod_mask_t mods; if (arrayNdx) - log_warn(info->keymap->ctx, + log_warn(info->ctx, "The modifiers field of a key type is not an array; " "Illegal array subscript ignored\n"); - if (!ExprResolveModMask(info->keymap, value, MOD_BOTH, &mods)) { - log_err(info->keymap->ctx, + if (!ExprResolveModMask(info->ctx, value, MOD_BOTH, &info->mods, &mods)) { + log_err(info->ctx, "Key type mask field must be a modifier mask; " "Key type definition ignored\n"); return false; } if (type->defined & TYPE_FIELD_MASK) { - log_warn(info->keymap->ctx, + log_warn(info->ctx, "Multiple modifier mask definitions for key type %s; " "Using %s, ignoring %s\n", - xkb_atom_text(info->keymap->ctx, type->name), + xkb_atom_text(info->ctx, type->name), TypeMaskTxt(info, type), - ModMaskText(info->keymap, mods)); + ModMaskText(info->ctx, &info->mods, mods)); return false; } @@ -291,7 +296,7 @@ AddMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, old = FindMatchingMapEntry(type, new->mods.mods); if (old) { if (report && old->level != new->level) { - log_warn(info->keymap->ctx, + log_warn(info->ctx, "Multiple map entries for %s in %s; " "Using %d, ignoring %d\n", MapEntryTxt(info, new), TypeTxt(info, type), @@ -299,7 +304,7 @@ AddMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, (clobber ? old->level : new->level) + 1); } else { - log_vrb(info->keymap->ctx, 10, + log_vrb(info->ctx, 10, "Multiple occurrences of map[%s]= %d in %s; Ignored\n", MapEntryTxt(info, new), new->level + 1, TypeTxt(info, type)); @@ -331,21 +336,23 @@ SetMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx, if (arrayNdx == NULL) return ReportTypeShouldBeArray(info, type, "map entry"); - if (!ExprResolveModMask(info->keymap, arrayNdx, MOD_BOTH, &entry.mods.mods)) + if (!ExprResolveModMask(info->ctx, arrayNdx, MOD_BOTH, &info->mods, + &entry.mods.mods)) return ReportTypeBadType(info, type, "map entry", "modifier mask"); if (entry.mods.mods & (~type->mods)) { - log_vrb(info->keymap->ctx, 1, + log_vrb(info->ctx, 1, "Map entry for unused modifiers in %s; " "Using %s instead of %s\n", TypeTxt(info, type), - ModMaskText(info->keymap, entry.mods.mods & type->mods), + ModMaskText(info->ctx, &info->mods, + entry.mods.mods & type->mods), MapEntryTxt(info, &entry)); entry.mods.mods &= type->mods; } - if (!ExprResolveLevel(info->keymap->ctx, value, &entry.level)) { - log_err(info->keymap->ctx, + if (!ExprResolveLevel(info->ctx, value, &entry.level)) { + log_err(info->ctx, "Level specifications in a key type must be integer; " "Ignoring malformed level specification\n"); return false; @@ -377,22 +384,22 @@ AddPreserve(KeyTypesInfo *info, KeyTypeInfo *type, /* Map exists with same preserve; do nothing. */ if (entry->preserve.mods == preserve_mods) { - log_vrb(info->keymap->ctx, 10, + log_vrb(info->ctx, 10, "Identical definitions for preserve[%s] in %s; " "Ignored\n", - ModMaskText(info->keymap, mods), + ModMaskText(info->ctx, &info->mods, mods), TypeTxt(info, type)); return true; } /* Map exists with different preserve; latter wins. */ - log_vrb(info->keymap->ctx, 1, + log_vrb(info->ctx, 1, "Multiple definitions for preserve[%s] in %s; " "Using %s, ignoring %s\n", - ModMaskText(info->keymap, mods), + ModMaskText(info->ctx, &info->mods, mods), TypeTxt(info, type), - ModMaskText(info->keymap, preserve_mods), - ModMaskText(info->keymap, entry->preserve.mods)); + ModMaskText(info->ctx, &info->mods, preserve_mods), + ModMaskText(info->ctx, &info->mods, entry->preserve.mods)); entry->preserve.mods = preserve_mods; return true; @@ -419,28 +426,29 @@ SetPreserve(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx, if (arrayNdx == NULL) return ReportTypeShouldBeArray(info, type, "preserve entry"); - if (!ExprResolveModMask(info->keymap, arrayNdx, MOD_BOTH, &mods)) + if (!ExprResolveModMask(info->ctx, arrayNdx, MOD_BOTH, &info->mods, &mods)) return ReportTypeBadType(info, type, "preserve entry", "modifier mask"); if (mods & ~type->mods) { const char *before, *after; - before = ModMaskText(info->keymap, mods); + before = ModMaskText(info->ctx, &info->mods, mods); mods &= type->mods; - after = ModMaskText(info->keymap, mods); + after = ModMaskText(info->ctx, &info->mods, mods); - log_vrb(info->keymap->ctx, 1, + log_vrb(info->ctx, 1, "Preserve for modifiers not used by the %s type; " "Index %s converted to %s\n", TypeTxt(info, type), before, after); } - if (!ExprResolveModMask(info->keymap, value, MOD_BOTH, &preserve_mods)) { - log_err(info->keymap->ctx, + if (!ExprResolveModMask(info->ctx, value, MOD_BOTH, &info->mods, + &preserve_mods)) { + log_err(info->ctx, "Preserve value in a key type is not a modifier mask; " "Ignoring preserve[%s] in type %s\n", - ModMaskText(info->keymap, mods), + ModMaskText(info->ctx, &info->mods, mods), TypeTxt(info, type)); return false; } @@ -448,14 +456,14 @@ SetPreserve(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx, if (preserve_mods & ~mods) { const char *before, *after; - before = ModMaskText(info->keymap, preserve_mods); + before = ModMaskText(info->ctx, &info->mods, preserve_mods); preserve_mods &= mods; - after = ModMaskText(info->keymap, preserve_mods); + after = ModMaskText(info->ctx, &info->mods, preserve_mods); - log_vrb(info->keymap->ctx, 1, + log_vrb(info->ctx, 1, "Illegal value for preserve[%s] in type %s; " "Converted %s to %s\n", - ModMaskText(info->keymap, mods), + ModMaskText(info->ctx, &info->mods, mods), TypeTxt(info, type), before, after); } @@ -476,7 +484,7 @@ AddLevelName(KeyTypesInfo *info, KeyTypeInfo *type, /* Same level, same name. */ if (darray_item(type->level_names, level) == name) { - log_vrb(info->keymap->ctx, 10, + log_vrb(info->ctx, 10, "Duplicate names for level %d of key type %s; Ignored\n", level + 1, TypeTxt(info, type)); return true; @@ -485,10 +493,10 @@ AddLevelName(KeyTypesInfo *info, KeyTypeInfo *type, /* Same level, different name. */ if (darray_item(type->level_names, level) != XKB_ATOM_NONE) { const char *old, *new; - old = xkb_atom_text(info->keymap->ctx, + old = xkb_atom_text(info->ctx, darray_item(type->level_names, level)); - new = xkb_atom_text(info->keymap->ctx, name); - log_vrb(info->keymap->ctx, 1, + new = xkb_atom_text(info->ctx, name); + log_vrb(info->ctx, 1, "Multiple names for level %d of key type %s; " "Using %s, ignoring %s\n", level + 1, TypeTxt(info, type), @@ -511,19 +519,18 @@ SetLevelName(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx, { xkb_level_index_t level; xkb_atom_t level_name; - struct xkb_context *ctx = info->keymap->ctx; if (arrayNdx == NULL) return ReportTypeShouldBeArray(info, type, "level name"); - if (!ExprResolveLevel(ctx, arrayNdx, &level)) + if (!ExprResolveLevel(info->ctx, arrayNdx, &level)) return ReportTypeBadType(info, type, "level name", "integer"); - if (!ExprResolveString(ctx, value, &level_name)) { - log_err(info->keymap->ctx, + if (!ExprResolveString(info->ctx, value, &level_name)) { + log_err(info->ctx, "Non-string name for level %d in key type %s; " "Ignoring illegal level name definition\n", - level + 1, xkb_atom_text(ctx, type->name)); + level + 1, xkb_atom_text(info->ctx, type->name)); return false; } @@ -555,7 +562,7 @@ SetKeyTypeField(KeyTypesInfo *info, KeyTypeInfo *type, type_field = TYPE_FIELD_LEVEL_NAME; ok = SetLevelName(info, type, arrayNdx, value); } else { - log_err(info->keymap->ctx, + log_err(info->ctx, "Unknown field %s in key type %s; Definition ignored\n", field, TypeTxt(info, type)); } @@ -572,13 +579,13 @@ HandleKeyTypeBody(KeyTypesInfo *info, VarDef *def, KeyTypeInfo *type) ExprDef *arrayNdx; for (; def; def = (VarDef *) def->common.next) { - ok = ExprResolveLhs(info->keymap->ctx, def->name, &elem, &field, + ok = ExprResolveLhs(info->ctx, def->name, &elem, &field, &arrayNdx); if (!ok) continue; if (elem && istreq(elem, "type")) { - log_err(info->keymap->ctx, + log_err(info->ctx, "Support for changing the default type has been removed; " "Statement ignored\n"); continue; @@ -633,16 +640,16 @@ HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge) ok = HandleKeyTypeDef(info, (KeyTypeDef *) stmt, merge); break; case STMT_VAR: - log_err(info->keymap->ctx, + log_err(info->ctx, "Support for changing the default type has been removed; " "Statement ignored\n"); ok = true; break; case STMT_VMOD: - ok = HandleVModDef(info->keymap, (VModDef *) stmt, merge); + ok = HandleVModDef(info->ctx, &info->mods, (VModDef *) stmt, merge); break; default: - log_err(info->keymap->ctx, + log_err(info->ctx, "Key type files may not include other declarations; " "Ignoring %s\n", stmt_type_to_string(stmt->type)); ok = false; @@ -653,8 +660,8 @@ HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge) info->errorCount++; if (info->errorCount > 10) { - log_err(info->keymap->ctx, - "Abandoning keytypes file \"%s\"\n", file->topName); + log_err(info->ctx, + "Abandoning keytypes file \"%s\"\n", file->name); break; } } @@ -665,21 +672,20 @@ HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge) static bool CopyKeyTypesToKeymap(struct xkb_keymap *keymap, KeyTypesInfo *info) { - keymap->types_section_name = strdup_safe(info->name); - XkbEscapeMapName(keymap->types_section_name); - - keymap->num_types = darray_size(info->types); - if (keymap->num_types == 0) - keymap->num_types = 1; + unsigned num_types; + struct xkb_key_type *types; - keymap->types = calloc(keymap->num_types, sizeof(*keymap->types)); + num_types = darray_empty(info->types) ? 1 : darray_size(info->types); + types = calloc(num_types, sizeof(*types)); + if (!types) + return false; /* * If no types were specified, a default unnamed one-level type is * used for all keys. */ if (darray_empty(info->types)) { - struct xkb_key_type *type = &keymap->types[0]; + struct xkb_key_type *type = &types[0]; type->mods.mods = 0; type->num_levels = 1; @@ -687,24 +693,26 @@ CopyKeyTypesToKeymap(struct xkb_keymap *keymap, KeyTypesInfo *info) type->num_entries = 0; type->name = xkb_atom_intern_literal(keymap->ctx, "default"); type->level_names = NULL; - - return true; + type->num_level_names = 0; } - - for (unsigned i = 0; i < keymap->num_types; i++) { - KeyTypeInfo *def = &darray_item(info->types, i); - struct xkb_key_type *type = &keymap->types[i]; - - type->mods.mods = def->mods; - type->num_levels = def->num_levels; - type->entries = darray_mem(def->entries, 0); - type->num_entries = darray_size(def->entries); - darray_init(def->entries); - type->name = def->name; - type->level_names = darray_mem(def->level_names, 0); - darray_init(def->level_names); + else { + for (unsigned i = 0; i < num_types; i++) { + KeyTypeInfo *def = &darray_item(info->types, i); + struct xkb_key_type *type = &types[i]; + + type->name = def->name; + type->mods.mods = def->mods; + type->num_levels = def->num_levels; + darray_steal(def->level_names, &type->level_names, &type->num_level_names); + darray_steal(def->entries, &type->entries, &type->num_entries); + } } + keymap->types_section_name = strdup_safe(info->name); + XkbEscapeMapName(keymap->types_section_name); + keymap->num_types = num_types; + keymap->types = types; + keymap->mods = info->mods; return true; } @@ -716,7 +724,7 @@ CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, { KeyTypesInfo info; - InitKeyTypesInfo(&info, keymap); + InitKeyTypesInfo(&info, keymap->ctx, &keymap->mods); HandleKeyTypesFile(&info, file, merge); if (info.errorCount != 0) diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/vmod.c b/src/3rdparty/xkbcommon/src/xkbcomp/vmod.c index 86e7bec786..a0b029af4f 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/vmod.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/vmod.c @@ -30,13 +30,12 @@ #include "vmod.h" bool -HandleVModDef(struct xkb_keymap *keymap, VModDef *stmt, - enum merge_mode merge) +HandleVModDef(struct xkb_context *ctx, struct xkb_mod_set *mods, + VModDef *stmt, enum merge_mode merge) { xkb_mod_index_t i; struct xkb_mod *mod; xkb_mod_mask_t mapping; - struct xkb_mod new; merge = (merge == MERGE_DEFAULT ? stmt->merge : merge); @@ -46,10 +45,10 @@ HandleVModDef(struct xkb_keymap *keymap, VModDef *stmt, * it sets the vmod-to-real-mod[s] mapping directly instead of going * through modifier_map or some such. */ - if (!ExprResolveModMask(keymap, stmt->value, MOD_REAL, &mapping)) { - log_err(keymap->ctx, + if (!ExprResolveModMask(ctx, stmt->value, MOD_REAL, mods, &mapping)) { + log_err(ctx, "Declaration of %s ignored\n", - xkb_atom_text(keymap->ctx, stmt->name)); + xkb_atom_text(ctx, stmt->name)); return false; } } @@ -57,13 +56,13 @@ HandleVModDef(struct xkb_keymap *keymap, VModDef *stmt, mapping = 0; } - darray_enumerate(i, mod, keymap->mods) { + xkb_mods_enumerate(i, mod, mods) { if (mod->name == stmt->name) { if (mod->type != MOD_VIRT) { - log_err(keymap->ctx, + log_err(ctx, "Can't add a virtual modifier named \"%s\"; " "there is already a non-virtual modifier with this name! Ignored\n", - xkb_atom_text(keymap->ctx, mod->name)); + xkb_atom_text(ctx, mod->name)); return false; } @@ -76,12 +75,12 @@ HandleVModDef(struct xkb_keymap *keymap, VModDef *stmt, use = (merge == MERGE_OVERRIDE ? mapping : mod->mapping); ignore = (merge == MERGE_OVERRIDE ? mod->mapping : mapping); - log_warn(keymap->ctx, + log_warn(ctx, "Virtual modifier %s defined multiple times; " "Using %s, ignoring %s\n", - xkb_atom_text(keymap->ctx, stmt->name), - ModMaskText(keymap, use), - ModMaskText(keymap, ignore)); + xkb_atom_text(ctx, stmt->name), + ModMaskText(ctx, mods, use), + ModMaskText(ctx, mods, ignore)); mapping = use; } @@ -91,16 +90,16 @@ HandleVModDef(struct xkb_keymap *keymap, VModDef *stmt, } } - if (darray_size(keymap->mods) >= XKB_MAX_MODS) { - log_err(keymap->ctx, + if (mods->num_mods >= XKB_MAX_MODS) { + log_err(ctx, "Too many modifiers defined (maximum %d)\n", XKB_MAX_MODS); return false; } - new.name = stmt->name; - new.mapping = mapping; - new.type = MOD_VIRT; - darray_append(keymap->mods, new); + mods->mods[mods->num_mods].name = stmt->name; + mods->mods[mods->num_mods].type = MOD_VIRT; + mods->mods[mods->num_mods].mapping = mapping; + mods->num_mods++; return true; } diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/vmod.h b/src/3rdparty/xkbcommon/src/xkbcomp/vmod.h index 1ba59f73cd..546cf7ee42 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/vmod.h +++ b/src/3rdparty/xkbcommon/src/xkbcomp/vmod.h @@ -28,7 +28,7 @@ #define XKBCOMP_VMOD_H bool -HandleVModDef(struct xkb_keymap *keymap, VModDef *stmt, - enum merge_mode merge); +HandleVModDef(struct xkb_context *ctx, struct xkb_mod_set *mods, + VModDef *stmt, enum merge_mode merge); #endif diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/keymap.c b/src/3rdparty/xkbcommon/src/xkbcomp/xkbcomp-keymap.c index 8a70577faf..e95e50c371 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/keymap.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/xkbcomp-keymap.c @@ -32,15 +32,7 @@ static void ComputeEffectiveMask(struct xkb_keymap *keymap, struct xkb_mods *mods) { - const struct xkb_mod *mod; - xkb_mod_index_t i; - - /* The effective mask is only real mods for now. */ - mods->mask = mods->mods & MOD_REAL_MASK_ALL; - - darray_enumerate(i, mod, keymap->mods) - if (mods->mods & (1u << i)) - mods->mask |= mod->mapping; + mods->mask = mod_mask_get_effective(keymap, mods->mods); } static void @@ -115,7 +107,7 @@ FindInterpForKey(struct xkb_keymap *keymap, const struct xkb_key *key, found = (!mods || (interp->mods & mods)); break; case MATCH_ANY: - found = !!(interp->mods & mods); + found = (interp->mods & mods); break; case MATCH_ALL: found = ((interp->mods & mods) == interp->mods); @@ -144,7 +136,7 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, struct xkb_key *key) return true; for (group = 0; group < key->num_groups; group++) { - for (level = 0; level < XkbKeyGroupWidth(key, group); level++) { + for (level = 0; level < XkbKeyNumLevels(key, group); level++) { const struct xkb_sym_interpret *interp; interp = FindInterpForKey(keymap, key, group, level); @@ -180,20 +172,20 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, struct xkb_key *key) static bool UpdateDerivedKeymapFields(struct xkb_keymap *keymap) { + struct xkb_key *key; struct xkb_mod *mod; struct xkb_led *led; unsigned int i, j; - struct xkb_key *key; /* Find all the interprets for the key and bind them to actions, * which will also update the vmodmap. */ - xkb_foreach_key(key, keymap) + xkb_keys_foreach(key, keymap) if (!ApplyInterpsToKey(keymap, key)) return false; /* Update keymap->mods, the virtual -> real mod mapping. */ - xkb_foreach_key(key, keymap) - darray_enumerate(i, mod, keymap->mods) + xkb_keys_foreach(key, keymap) + xkb_mods_enumerate(i, mod, &keymap->mods) if (key->vmodmap & (1u << i)) mod->mapping |= key->modmap; @@ -208,18 +200,18 @@ UpdateDerivedKeymapFields(struct xkb_keymap *keymap) } /* Update action modifiers. */ - xkb_foreach_key(key, keymap) + xkb_keys_foreach(key, keymap) for (i = 0; i < key->num_groups; i++) - for (j = 0; j < XkbKeyGroupWidth(key, i); j++) + for (j = 0; j < XkbKeyNumLevels(key, i); j++) UpdateActionMods(keymap, &key->groups[i].levels[j].action, key->modmap); /* Update vmod -> led maps. */ - darray_foreach(led, keymap->leds) + xkb_leds_foreach(led, keymap) ComputeEffectiveMask(keymap, &led->mods); /* Find maximum number of groups out of all keys in the keymap. */ - xkb_foreach_key(key, keymap) + xkb_keys_foreach(key, keymap) keymap->num_groups = MAX(keymap->num_groups, key->num_groups); return true; @@ -240,20 +232,22 @@ bool CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) { bool ok; - const char *main_name; XkbFile *files[LAST_KEYMAP_FILE_TYPE + 1] = { NULL }; enum xkb_file_type type; struct xkb_context *ctx = keymap->ctx; - main_name = file->name ? file->name : "(unnamed)"; - /* Collect section files and check for duplicates. */ for (file = (XkbFile *) file->defs; file; file = (XkbFile *) file->common.next) { if (file->file_type < FIRST_KEYMAP_FILE_TYPE || file->file_type > LAST_KEYMAP_FILE_TYPE) { - log_err(ctx, "Cannot define %s in a keymap file\n", - xkb_file_type_to_string(file->file_type)); + if (file->file_type == FILE_TYPE_GEOMETRY) { + log_vrb(ctx, 1, + "Geometry sections are not supported; ignoring\n"); + } else { + log_err(ctx, "Cannot define %s in a keymap file\n", + xkb_file_type_to_string(file->file_type)); + } continue; } @@ -265,11 +259,6 @@ CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) continue; } - if (!file->topName) { - free(file->topName); - file->topName = strdup(main_name); - } - files[file->file_type] = file; } @@ -295,7 +284,7 @@ CompileKeymap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge) type <= LAST_KEYMAP_FILE_TYPE; type++) { log_dbg(ctx, "Compiling %s \"%s\"\n", - xkb_file_type_to_string(type), files[type]->topName); + xkb_file_type_to_string(type), files[type]->name); ok = compile_file_fns[type](files[type], keymap, merge); if (!ok) { diff --git a/src/3rdparty/xkbcommon/src/xkbcomp/parser.c b/src/3rdparty/xkbcommon/src/xkbcomp/xkbcomp-parser.c index eaa7384369..520cc5b9c5 100644 --- a/src/3rdparty/xkbcommon/src/xkbcomp/parser.c +++ b/src/3rdparty/xkbcommon/src/xkbcomp/xkbcomp-parser.c @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.5. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. - + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -26,7 +26,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.5" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -58,27 +58,22 @@ /* Pull parsers. */ #define YYPULL 1 -/* Using locations. */ -#define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse _xkbcommon_parse -#define yylex _xkbcommon_lex -#define yyerror _xkbcommon_error -#define yylval _xkbcommon_lval -#define yychar _xkbcommon_char -#define yydebug _xkbcommon_debug -#define yynerrs _xkbcommon_nerrs +#define yyparse _xkbcommon_parse +#define yylex _xkbcommon_lex +#define yyerror _xkbcommon_error +#define yydebug _xkbcommon_debug +#define yynerrs _xkbcommon_nerrs /* Copy the first part of user declarations. */ +#line 33 "../src/xkbcomp/parser.y" /* yacc.c:339 */ -/* Line 268 of yacc.c */ -#line 33 "parser.y" - -#include "xkbcomp-priv.h" -#include "ast-build.h" -#include "parser-priv.h" +#include "xkbcomp/xkbcomp-priv.h" +#include "xkbcomp/ast-build.h" +#include "xkbcomp/parser-priv.h" +#include "scanner-utils.h" struct parser_param { struct xkb_context *ctx; @@ -100,21 +95,21 @@ _xkbcommon_error(struct parser_param *param, const char *msg) } static bool -resolve_keysym(const char *str, xkb_keysym_t *sym_rtrn) +resolve_keysym(const char *name, xkb_keysym_t *sym_rtrn) { xkb_keysym_t sym; - if (!str || istreq(str, "any") || istreq(str, "nosymbol")) { + if (!name || istreq(name, "any") || istreq(name, "nosymbol")) { *sym_rtrn = XKB_KEY_NoSymbol; return true; } - if (istreq(str, "none") || istreq(str, "voidsymbol")) { + if (istreq(name, "none") || istreq(name, "voidsymbol")) { *sym_rtrn = XKB_KEY_VoidSymbol; return true; } - sym = xkb_keysym_from_name(str, XKB_KEYSYM_NO_FLAGS); + sym = xkb_keysym_from_name(name, XKB_KEYSYM_NO_FLAGS); if (sym != XKB_KEY_NoSymbol) { *sym_rtrn = sym; return true; @@ -125,14 +120,15 @@ resolve_keysym(const char *str, xkb_keysym_t *sym_rtrn) #define param_scanner param->scanner +#line 124 "xkbcommon-internal@sta/parser.c" /* yacc.c:339 */ -/* Line 268 of yacc.c */ -#line 131 "src/xkbcomp/parser.c" - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE @@ -142,163 +138,101 @@ resolve_keysym(const char *str, xkb_keysym_t *sym_rtrn) # define YYERROR_VERBOSE 0 #endif -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 +/* In a future release of Bison, this section will be replaced + by #include "parser.h". */ +#ifndef YY__XKBCOMMON_XKBCOMMON_INTERNAL_STA_PARSER_H_INCLUDED +# define YY__XKBCOMMON_XKBCOMMON_INTERNAL_STA_PARSER_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int _xkbcommon_debug; #endif - -/* Tokens. */ +/* Token type. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - END_OF_FILE = 0, - ERROR_TOK = 255, - XKB_KEYMAP = 1, - XKB_KEYCODES = 2, - XKB_TYPES = 3, - XKB_SYMBOLS = 4, - XKB_COMPATMAP = 5, - XKB_GEOMETRY = 6, - XKB_SEMANTICS = 7, - XKB_LAYOUT = 8, - INCLUDE = 10, - OVERRIDE = 11, - AUGMENT = 12, - REPLACE = 13, - ALTERNATE = 14, - VIRTUAL_MODS = 20, - TYPE = 21, - INTERPRET = 22, - ACTION_TOK = 23, - KEY = 24, - ALIAS = 25, - GROUP = 26, - MODIFIER_MAP = 27, - INDICATOR = 28, - SHAPE = 29, - KEYS = 30, - ROW = 31, - SECTION = 32, - OVERLAY = 33, - TEXT = 34, - OUTLINE = 35, - SOLID = 36, - LOGO = 37, - VIRTUAL = 38, - EQUALS = 40, - PLUS = 41, - MINUS = 42, - DIVIDE = 43, - TIMES = 44, - OBRACE = 45, - CBRACE = 46, - OPAREN = 47, - CPAREN = 48, - OBRACKET = 49, - CBRACKET = 50, - DOT = 51, - COMMA = 52, - SEMI = 53, - EXCLAM = 54, - INVERT = 55, - STRING = 60, - INTEGER = 61, - FLOAT = 62, - IDENT = 63, - KEYNAME = 64, - PARTIAL = 70, - DEFAULT = 71, - HIDDEN = 72, - ALPHANUMERIC_KEYS = 73, - MODIFIER_KEYS = 74, - KEYPAD_KEYS = 75, - FUNCTION_KEYS = 76, - ALTERNATE_GROUP = 77 - }; + enum yytokentype + { + END_OF_FILE = 0, + ERROR_TOK = 255, + XKB_KEYMAP = 1, + XKB_KEYCODES = 2, + XKB_TYPES = 3, + XKB_SYMBOLS = 4, + XKB_COMPATMAP = 5, + XKB_GEOMETRY = 6, + XKB_SEMANTICS = 7, + XKB_LAYOUT = 8, + INCLUDE = 10, + OVERRIDE = 11, + AUGMENT = 12, + REPLACE = 13, + ALTERNATE = 14, + VIRTUAL_MODS = 20, + TYPE = 21, + INTERPRET = 22, + ACTION_TOK = 23, + KEY = 24, + ALIAS = 25, + GROUP = 26, + MODIFIER_MAP = 27, + INDICATOR = 28, + SHAPE = 29, + KEYS = 30, + ROW = 31, + SECTION = 32, + OVERLAY = 33, + TEXT = 34, + OUTLINE = 35, + SOLID = 36, + LOGO = 37, + VIRTUAL = 38, + EQUALS = 40, + PLUS = 41, + MINUS = 42, + DIVIDE = 43, + TIMES = 44, + OBRACE = 45, + CBRACE = 46, + OPAREN = 47, + CPAREN = 48, + OBRACKET = 49, + CBRACKET = 50, + DOT = 51, + COMMA = 52, + SEMI = 53, + EXCLAM = 54, + INVERT = 55, + STRING = 60, + INTEGER = 61, + FLOAT = 62, + IDENT = 63, + KEYNAME = 64, + PARTIAL = 70, + DEFAULT = 71, + HIDDEN = 72, + ALPHANUMERIC_KEYS = 73, + MODIFIER_KEYS = 74, + KEYPAD_KEYS = 75, + FUNCTION_KEYS = 76, + ALTERNATE_GROUP = 77 + }; #endif -/* Tokens. */ -#define END_OF_FILE 0 -#define ERROR_TOK 255 -#define XKB_KEYMAP 1 -#define XKB_KEYCODES 2 -#define XKB_TYPES 3 -#define XKB_SYMBOLS 4 -#define XKB_COMPATMAP 5 -#define XKB_GEOMETRY 6 -#define XKB_SEMANTICS 7 -#define XKB_LAYOUT 8 -#define INCLUDE 10 -#define OVERRIDE 11 -#define AUGMENT 12 -#define REPLACE 13 -#define ALTERNATE 14 -#define VIRTUAL_MODS 20 -#define TYPE 21 -#define INTERPRET 22 -#define ACTION_TOK 23 -#define KEY 24 -#define ALIAS 25 -#define GROUP 26 -#define MODIFIER_MAP 27 -#define INDICATOR 28 -#define SHAPE 29 -#define KEYS 30 -#define ROW 31 -#define SECTION 32 -#define OVERLAY 33 -#define TEXT 34 -#define OUTLINE 35 -#define SOLID 36 -#define LOGO 37 -#define VIRTUAL 38 -#define EQUALS 40 -#define PLUS 41 -#define MINUS 42 -#define DIVIDE 43 -#define TIMES 44 -#define OBRACE 45 -#define CBRACE 46 -#define OPAREN 47 -#define CPAREN 48 -#define OBRACKET 49 -#define CBRACKET 50 -#define DOT 51 -#define COMMA 52 -#define SEMI 53 -#define EXCLAM 54 -#define INVERT 55 -#define STRING 60 -#define INTEGER 61 -#define FLOAT 62 -#define IDENT 63 -#define KEYNAME 64 -#define PARTIAL 70 -#define DEFAULT 71 -#define HIDDEN 72 -#define ALPHANUMERIC_KEYS 73 -#define MODIFIER_KEYS 74 -#define KEYPAD_KEYS 75 -#define FUNCTION_KEYS 76 -#define ALTERNATE_GROUP 77 - - - +/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -{ -/* Line 293 of yacc.c */ -#line 161 "parser.y" +union YYSTYPE +{ +#line 162 "../src/xkbcomp/parser.y" /* yacc.c:355 */ int ival; int64_t num; enum xkb_file_type file_type; char *str; - xkb_atom_t sval; + xkb_atom_t atom; enum merge_mode merge; enum xkb_map_flags mapFlags; xkb_keysym_t keysym; @@ -318,22 +252,23 @@ typedef union YYSTYPE void *geom; XkbFile *file; +#line 256 "xkbcommon-internal@sta/parser.c" /* yacc.c:355 */ +}; - -/* Line 293 of yacc.c */ -#line 325 "src/xkbcomp/parser.c" -} YYSTYPE; +typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif -/* Copy the second part of user declarations. */ +int _xkbcommon_parse (struct parser_param *param); + +#endif /* !YY__XKBCOMMON_XKBCOMMON_INTERNAL_STA_PARSER_H_INCLUDED */ + +/* Copy the second part of user declarations. */ -/* Line 343 of yacc.c */ -#line 337 "src/xkbcomp/parser.c" +#line 272 "xkbcommon-internal@sta/parser.c" /* yacc.c:358 */ #ifdef short # undef short @@ -347,11 +282,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -371,8 +303,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -386,38 +317,67 @@ typedef short int yytype_int16; # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) # endif # endif # ifndef YY_ -# define YY_(msgid) msgid +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) +# define YYUSE(E) ((void) (E)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(E) /* empty */ #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") #else -static int -YYID (yyi) - int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END #endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + #if ! defined yyoverflow || YYERROR_VERBOSE @@ -436,9 +396,9 @@ YYID (yyi) # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif @@ -448,8 +408,8 @@ YYID (yyi) # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -465,7 +425,7 @@ YYID (yyi) # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -473,15 +433,13 @@ YYID (yyi) # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined malloc && ! defined EXIT_SUCCESS void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -491,7 +449,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc @@ -516,35 +474,35 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from FROM to TO. The source and destination do +/* Copy COUNT objects from SRC to DST. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) # else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -560,17 +518,19 @@ union yyalloc #define YYNNTS 72 /* YYNRULES -- Number of rules. */ #define YYNRULES 184 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 334 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 257 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ static const yytype_uint8 yytranslate[] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 2, @@ -602,119 +562,32 @@ static const yytype_uint8 yytranslate[] = }; #if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 5, 7, 9, 17, 19, 21, 23, - 26, 28, 36, 38, 40, 42, 44, 46, 48, 49, - 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, - 73, 74, 77, 80, 83, 86, 89, 92, 95, 98, - 101, 104, 107, 110, 113, 116, 119, 124, 127, 131, - 136, 142, 146, 150, 152, 154, 158, 165, 169, 171, - 174, 176, 183, 190, 194, 196, 197, 201, 205, 207, - 210, 212, 216, 220, 226, 233, 240, 246, 253, 260, - 267, 274, 277, 279, 285, 287, 289, 291, 293, 296, - 298, 304, 306, 310, 312, 314, 318, 325, 329, 331, - 335, 339, 341, 345, 351, 355, 359, 361, 367, 374, - 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, - 396, 398, 400, 402, 404, 406, 408, 410, 411, 413, - 415, 417, 419, 421, 423, 424, 428, 430, 434, 438, - 442, 446, 450, 452, 455, 458, 461, 464, 466, 471, - 473, 477, 481, 483, 488, 490, 494, 499, 506, 508, - 510, 512, 514, 516, 517, 521, 525, 527, 529, 533, - 535, 537, 539, 542, 544, 546, 548, 550, 552, 554, - 556, 558, 560, 562, 563 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 66, 0, -1, 67, -1, 70, -1, 0, -1, 72, - 68, 135, 41, 69, 42, 49, -1, 4, -1, 10, - -1, 11, -1, 69, 70, -1, 70, -1, 72, 71, - 135, 41, 75, 42, 49, -1, 5, -1, 6, -1, - 8, -1, 7, -1, 9, -1, 73, -1, -1, 73, - 74, -1, 74, -1, 57, -1, 58, -1, 59, -1, - 60, -1, 61, -1, 62, -1, 63, -1, 64, -1, - 75, 76, -1, -1, 114, 77, -1, 114, 80, -1, - 114, 83, -1, 114, 78, -1, 114, 79, -1, 114, - 86, -1, 114, 87, -1, 114, 92, -1, 114, 91, - -1, 114, 93, -1, 114, 94, -1, 114, 95, -1, - 114, 96, -1, 114, 110, -1, 115, 52, -1, 122, - 36, 118, 49, -1, 133, 49, -1, 50, 133, 49, - -1, 56, 36, 132, 49, -1, 22, 56, 36, 56, - 49, -1, 17, 81, 49, -1, 81, 48, 82, -1, - 82, -1, 133, -1, 133, 36, 118, -1, 19, 84, - 41, 85, 42, 49, -1, 127, 37, 118, -1, 127, - -1, 85, 77, -1, 77, -1, 18, 134, 41, 85, - 42, 49, -1, 21, 56, 41, 88, 42, 49, -1, - 88, 48, 89, -1, 89, -1, -1, 122, 36, 118, - -1, 122, 36, 90, -1, 133, -1, 50, 133, -1, - 90, -1, 45, 124, 46, -1, 45, 120, 46, -1, - 23, 131, 36, 118, 49, -1, 24, 133, 41, 117, - 42, 49, -1, 25, 134, 41, 85, 42, 49, -1, - 25, 131, 36, 118, 49, -1, 35, 25, 131, 36, - 118, 49, -1, 26, 134, 41, 106, 42, 49, -1, - 26, 134, 41, 108, 42, 49, -1, 29, 134, 41, - 97, 42, 49, -1, 97, 98, -1, 98, -1, 28, - 41, 99, 42, 49, -1, 77, -1, 110, -1, 93, - -1, 103, -1, 99, 100, -1, 100, -1, 27, 41, - 101, 42, 49, -1, 77, -1, 101, 48, 102, -1, - 102, -1, 56, -1, 41, 117, 42, -1, 30, 134, - 41, 104, 42, 49, -1, 104, 48, 105, -1, 105, - -1, 56, 36, 56, -1, 106, 48, 107, -1, 107, - -1, 41, 108, 42, -1, 133, 36, 41, 108, 42, - -1, 133, 36, 118, -1, 108, 48, 109, -1, 109, - -1, 45, 128, 48, 128, 46, -1, 111, 134, 41, - 85, 42, 49, -1, 31, -1, 32, -1, 33, -1, - 34, -1, 133, -1, 113, -1, 20, -1, 19, -1, - 18, -1, 21, -1, 23, -1, 24, -1, 25, -1, - 26, -1, 28, -1, 29, -1, 31, -1, 115, -1, - -1, 12, -1, 14, -1, 13, -1, 15, -1, 16, - -1, 117, -1, -1, 117, 48, 118, -1, 118, -1, - 118, 39, 118, -1, 118, 37, 118, -1, 118, 38, - 118, -1, 118, 40, 118, -1, 122, 36, 118, -1, - 119, -1, 38, 119, -1, 37, 119, -1, 50, 119, - -1, 51, 119, -1, 122, -1, 112, 43, 116, 44, - -1, 123, -1, 43, 118, 44, -1, 120, 48, 121, - -1, 121, -1, 112, 43, 116, 44, -1, 112, -1, - 112, 47, 112, -1, 112, 45, 118, 46, -1, 112, - 47, 112, 45, 118, 46, -1, 134, -1, 131, -1, - 130, -1, 56, -1, 125, -1, -1, 125, 48, 127, - -1, 125, 48, 126, -1, 127, -1, 126, -1, 41, - 125, 42, -1, 55, -1, 29, -1, 131, -1, 38, - 129, -1, 129, -1, 54, -1, 53, -1, 54, -1, - 53, -1, 53, -1, 55, -1, 58, -1, 52, -1, - 136, -1, -1, 52, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 232, 232, 234, 236, 240, 246, 247, 248, 251, - 259, 263, 278, 279, 280, 281, 282, 285, 286, 289, - 290, 293, 294, 295, 296, 297, 298, 299, 300, 303, - 305, 308, 313, 318, 323, 328, 333, 338, 343, 348, - 353, 358, 363, 364, 365, 366, 373, 375, 377, 381, - 385, 389, 393, 396, 400, 402, 406, 412, 414, 418, - 421, 425, 431, 437, 440, 442, 445, 446, 447, 448, - 449, 452, 454, 458, 462, 466, 470, 472, 476, 478, - 482, 486, 487, 490, 492, 494, 496, 498, 502, 503, - 506, 507, 511, 512, 515, 517, 521, 525, 526, 529, - 532, 534, 538, 540, 542, 546, 548, 552, 556, 560, - 561, 562, 563, 566, 567, 570, 572, 574, 576, 578, - 580, 582, 584, 586, 588, 590, 594, 595, 598, 599, - 600, 601, 602, 612, 613, 616, 619, 623, 625, 627, - 629, 631, 633, 637, 639, 641, 643, 645, 647, 649, - 651, 655, 658, 662, 666, 668, 670, 672, 676, 678, - 680, 682, 686, 687, 690, 692, 694, 696, 700, 704, - 710, 711, 731, 732, 735, 736, 739, 742, 745, 748, - 749, 752, 755, 756, 759 + 0, 241, 241, 243, 245, 249, 255, 256, 257, 260, + 268, 272, 280, 281, 282, 283, 284, 287, 288, 291, + 292, 295, 296, 297, 298, 299, 300, 301, 302, 305, + 307, 310, 315, 320, 325, 330, 335, 340, 345, 350, + 355, 360, 365, 366, 367, 368, 375, 377, 379, 383, + 387, 391, 395, 398, 402, 404, 408, 414, 416, 420, + 423, 427, 433, 439, 442, 444, 447, 448, 449, 450, + 451, 454, 456, 460, 464, 468, 472, 474, 478, 480, + 484, 488, 489, 492, 494, 496, 498, 500, 504, 505, + 508, 509, 513, 514, 517, 519, 523, 527, 528, 531, + 534, 536, 540, 542, 544, 548, 550, 554, 558, 562, + 563, 564, 565, 568, 569, 572, 574, 576, 578, 580, + 582, 584, 586, 588, 590, 592, 596, 597, 600, 601, + 602, 603, 604, 614, 615, 618, 621, 625, 627, 629, + 631, 633, 635, 639, 641, 643, 645, 647, 649, 651, + 653, 657, 660, 664, 668, 670, 672, 674, 678, 680, + 682, 684, 688, 689, 692, 694, 696, 698, 702, 706, + 712, 713, 733, 734, 737, 738, 741, 744, 747, 750, + 751, 754, 757, 758, 761 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +#if YYDEBUG || YYERROR_VERBOSE || 0 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = @@ -744,13 +617,13 @@ static const char *const yytname[] = "ExprList", "Expr", "Term", "ActionList", "Action", "Lhs", "Terminal", "OptKeySymList", "KeySymList", "KeySyms", "KeySym", "SignedNumber", "Number", "Float", "Integer", "KeyCode", "Ident", "String", "OptMapName", - "MapName", 0 + "MapName", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 255, 1, 2, 3, 4, 5, 6, @@ -763,111 +636,18 @@ static const yytype_uint16 yytoknum[] = }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 65, 66, 66, 66, 67, 68, 68, 68, 69, - 69, 70, 71, 71, 71, 71, 71, 72, 72, 73, - 73, 74, 74, 74, 74, 74, 74, 74, 74, 75, - 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, - 76, 76, 76, 76, 76, 76, 77, 77, 77, 78, - 79, 80, 81, 81, 82, 82, 83, 84, 84, 85, - 85, 86, 87, 88, 88, 88, 89, 89, 89, 89, - 89, 90, 90, 91, 92, 93, 94, 94, 95, 95, - 96, 97, 97, 98, 98, 98, 98, 98, 99, 99, - 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, - 106, 106, 107, 107, 107, 108, 108, 109, 110, 111, - 111, 111, 111, 112, 112, 113, 113, 113, 113, 113, - 113, 113, 113, 113, 113, 113, 114, 114, 115, 115, - 115, 115, 115, 116, 116, 117, 117, 118, 118, 118, - 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, - 119, 120, 120, 121, 122, 122, 122, 122, 123, 123, - 123, 123, 124, 124, 125, 125, 125, 125, 126, 127, - 127, 127, 128, 128, 129, 129, 130, 131, 132, 133, - 133, 134, 135, 135, 136 -}; +#define YYPACT_NINF -182 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 1, 7, 1, 1, 1, 2, - 1, 7, 1, 1, 1, 1, 1, 1, 0, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 4, 2, 3, 4, - 5, 3, 3, 1, 1, 3, 6, 3, 1, 2, - 1, 6, 6, 3, 1, 0, 3, 3, 1, 2, - 1, 3, 3, 5, 6, 6, 5, 6, 6, 6, - 6, 2, 1, 5, 1, 1, 1, 1, 2, 1, - 5, 1, 3, 1, 1, 3, 6, 3, 1, 3, - 3, 1, 3, 5, 3, 3, 1, 5, 6, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 0, 3, 1, 3, 3, 3, - 3, 3, 1, 2, 2, 2, 2, 1, 4, 1, - 3, 3, 1, 4, 1, 3, 4, 6, 1, 1, - 1, 1, 1, 0, 3, 3, 1, 1, 3, 1, - 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 1 -}; +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-182))) -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 18, 4, 21, 22, 23, 24, 25, 26, 27, 28, - 0, 2, 3, 0, 17, 20, 1, 6, 12, 13, - 15, 14, 16, 7, 8, 183, 183, 19, 184, 0, - 182, 0, 18, 30, 18, 10, 0, 127, 0, 9, - 128, 130, 129, 131, 132, 0, 29, 0, 126, 5, - 11, 0, 117, 116, 115, 118, 0, 119, 120, 121, - 122, 123, 124, 125, 110, 111, 112, 0, 0, 179, - 0, 180, 31, 34, 35, 32, 33, 36, 37, 39, - 38, 40, 41, 42, 43, 44, 0, 154, 114, 0, - 113, 45, 0, 53, 54, 181, 0, 170, 177, 169, - 0, 58, 171, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 47, 0, - 51, 0, 0, 0, 0, 65, 0, 0, 0, 0, - 0, 0, 0, 0, 48, 178, 0, 0, 117, 116, - 118, 119, 120, 121, 122, 124, 125, 0, 0, 0, - 0, 0, 176, 161, 154, 0, 142, 147, 149, 160, - 159, 113, 158, 155, 0, 52, 55, 60, 0, 0, - 57, 163, 0, 0, 64, 70, 0, 113, 0, 0, - 0, 136, 0, 0, 0, 0, 0, 101, 0, 106, - 0, 121, 123, 0, 84, 86, 0, 82, 87, 85, - 0, 49, 0, 144, 147, 143, 0, 145, 146, 134, - 0, 0, 0, 0, 156, 0, 0, 46, 0, 59, - 0, 170, 0, 169, 0, 0, 152, 0, 162, 167, - 166, 69, 0, 0, 0, 50, 73, 0, 0, 76, - 0, 0, 0, 175, 174, 0, 173, 0, 0, 0, - 0, 0, 0, 0, 0, 81, 0, 0, 150, 0, - 133, 138, 139, 137, 140, 141, 0, 61, 56, 0, - 134, 72, 0, 71, 0, 62, 63, 67, 66, 74, - 135, 75, 102, 172, 0, 78, 100, 79, 105, 0, - 104, 0, 91, 0, 89, 0, 80, 77, 108, 148, - 157, 168, 0, 151, 165, 164, 0, 0, 0, 0, - 88, 0, 0, 98, 153, 107, 103, 0, 94, 0, - 93, 83, 0, 0, 0, 0, 0, 0, 99, 96, - 97, 95, 90, 92 -}; +#define YYTABLE_NINF -180 -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 10, 11, 25, 34, 12, 26, 36, 14, 15, - 37, 46, 167, 73, 74, 75, 92, 93, 76, 100, - 168, 77, 78, 173, 174, 175, 79, 80, 195, 82, - 83, 84, 196, 197, 293, 294, 319, 320, 198, 312, - 313, 186, 187, 188, 189, 199, 86, 154, 88, 47, - 48, 259, 260, 181, 156, 225, 226, 157, 158, 227, - 228, 229, 230, 245, 246, 159, 160, 136, 161, 162, - 29, 30 -}; +#define yytable_value_is_error(Yytable_value) \ + 0 -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -182 + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { 176, -182, -182, -182, -182, -182, -182, -182, -182, -182, @@ -906,7 +686,48 @@ static const yytype_int16 yypact[] = -182, -182, -182, -182 }; -/* YYPGOTO[NTERM-NUM]. */ + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 18, 4, 21, 22, 23, 24, 25, 26, 27, 28, + 0, 2, 3, 0, 17, 20, 1, 6, 12, 13, + 15, 14, 16, 7, 8, 183, 183, 19, 184, 0, + 182, 0, 18, 30, 18, 10, 0, 127, 0, 9, + 128, 130, 129, 131, 132, 0, 29, 0, 126, 5, + 11, 0, 117, 116, 115, 118, 0, 119, 120, 121, + 122, 123, 124, 125, 110, 111, 112, 0, 0, 179, + 0, 180, 31, 34, 35, 32, 33, 36, 37, 39, + 38, 40, 41, 42, 43, 44, 0, 154, 114, 0, + 113, 45, 0, 53, 54, 181, 0, 170, 177, 169, + 0, 58, 171, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 47, 0, + 51, 0, 0, 0, 0, 65, 0, 0, 0, 0, + 0, 0, 0, 0, 48, 178, 0, 0, 117, 116, + 118, 119, 120, 121, 122, 124, 125, 0, 0, 0, + 0, 0, 176, 161, 154, 0, 142, 147, 149, 160, + 159, 113, 158, 155, 0, 52, 55, 60, 0, 0, + 57, 163, 0, 0, 64, 70, 0, 113, 0, 0, + 0, 136, 0, 0, 0, 0, 0, 101, 0, 106, + 0, 121, 123, 0, 84, 86, 0, 82, 87, 85, + 0, 49, 0, 144, 147, 143, 0, 145, 146, 134, + 0, 0, 0, 0, 156, 0, 0, 46, 0, 59, + 0, 170, 0, 169, 0, 0, 152, 0, 162, 167, + 166, 69, 0, 0, 0, 50, 73, 0, 0, 76, + 0, 0, 0, 175, 174, 0, 173, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 0, 0, 150, 0, + 133, 138, 139, 137, 140, 141, 0, 61, 56, 0, + 134, 72, 0, 71, 0, 62, 63, 67, 66, 74, + 135, 75, 102, 172, 0, 78, 100, 79, 105, 0, + 104, 0, 91, 0, 89, 0, 80, 77, 108, 148, + 157, 168, 0, 151, 165, 164, 0, 0, 0, 0, + 88, 0, 0, 98, 153, 107, 103, 0, 94, 0, + 93, 83, 0, 0, 0, 0, 0, 0, 99, 96, + 97, 95, 90, 92 +}; + + /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -182, -182, -182, -182, -182, 181, -182, 402, -182, 389, @@ -919,10 +740,22 @@ static const yytype_int16 yypgoto[] = 420, -182 }; -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -180 + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 10, 11, 25, 34, 12, 26, 36, 14, 15, + 37, 46, 167, 73, 74, 75, 92, 93, 76, 100, + 168, 77, 78, 173, 174, 175, 79, 80, 195, 82, + 83, 84, 196, 197, 293, 294, 319, 320, 198, 312, + 313, 186, 187, 188, 189, 199, 86, 154, 88, 47, + 48, 259, 260, 181, 156, 225, 226, 157, 158, 227, + 228, 229, 230, 245, 246, 159, 160, 136, 161, 162, + 29, 30 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 90, 101, 180, 241, 94, 184, 16, 69, 242, 102, @@ -1001,12 +834,6 @@ static const yytype_int16 yytable[] = 0, 0, 69, 0, 0, 71 }; -#define yypact_value_is_default(yystate) \ - ((yystate) == (-182)) - -#define yytable_value_is_error(yytable_value) \ - YYID (0) - static const yytype_int16 yycheck[] = { 47, 53, 128, 184, 51, 41, 0, 55, 38, 53, @@ -1085,8 +912,8 @@ static const yytype_int16 yycheck[] = -1, -1, 55, -1, -1, 58 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 0, 57, 58, 59, 60, 61, 62, 63, 64, @@ -1125,94 +952,89 @@ static const yytype_uint8 yystos[] = 105, 42, 49, 102 }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL - /* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 65, 66, 66, 66, 67, 68, 68, 68, 69, + 69, 70, 71, 71, 71, 71, 71, 72, 72, 73, + 73, 74, 74, 74, 74, 74, 74, 74, 74, 75, + 75, 76, 76, 76, 76, 76, 76, 76, 76, 76, + 76, 76, 76, 76, 76, 76, 77, 77, 77, 78, + 79, 80, 81, 81, 82, 82, 83, 84, 84, 85, + 85, 86, 87, 88, 88, 88, 89, 89, 89, 89, + 89, 90, 90, 91, 92, 93, 94, 94, 95, 95, + 96, 97, 97, 98, 98, 98, 98, 98, 99, 99, + 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, + 106, 106, 107, 107, 107, 108, 108, 109, 110, 111, + 111, 111, 111, 112, 112, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 114, 114, 115, 115, + 115, 115, 115, 116, 116, 117, 117, 118, 118, 118, + 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, + 119, 120, 120, 121, 122, 122, 122, 122, 123, 123, + 123, 123, 124, 124, 125, 125, 125, 125, 126, 127, + 127, 127, 128, 128, 129, 129, 130, 131, 132, 133, + 133, 134, 135, 135, 136 +}; -#define YYRECOVERING() (!!yyerrstatus) + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 7, 1, 1, 1, 2, + 1, 7, 1, 1, 1, 1, 1, 1, 0, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 4, 2, 3, 4, + 5, 3, 3, 1, 1, 3, 6, 3, 1, 2, + 1, 6, 6, 3, 1, 0, 3, 3, 1, 2, + 1, 3, 3, 5, 6, 6, 5, 6, 6, 6, + 6, 2, 1, 5, 1, 1, 1, 1, 2, 1, + 5, 1, 3, 1, 1, 3, 6, 3, 1, 3, + 3, 1, 3, 5, 3, 3, 1, 5, 6, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, + 1, 1, 1, 1, 0, 3, 1, 3, 3, 3, + 3, 3, 1, 2, 2, 2, 2, 1, 4, 1, + 3, 3, 1, 4, 1, 3, 4, 6, 1, 1, + 1, 1, 1, 0, 3, 3, 1, 1, 3, 1, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 0, 1 +}; -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (1); \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (param, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - - -#define YYTERROR 1 -#define YYERRCODE 256 - - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 -/* This macro is provided for backward compatibility. */ +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (param, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval, param_scanner) -#endif /* Enable debugging if requested. */ #if YYDEBUG @@ -1222,56 +1044,47 @@ while (YYID (0)) # define YYFPRINTF fprintf # endif -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value, param); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, param); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parser_param *param) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep, param) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - struct parser_param *param; -#endif { + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (param); if (!yyvaluep) return; - YYUSE (param); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif - switch (yytype) - { - default: - break; - } + YYUSE (yytype); } @@ -1279,23 +1092,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, param) | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct parser_param *param) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep, param) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; - struct parser_param *param; -#endif { - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep, param); YYFPRINTF (yyoutput, ")"); @@ -1306,16 +1107,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, param) | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) - yytype_int16 *yybottom; - yytype_int16 *yytop; -#endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -1326,50 +1119,42 @@ yy_stack_print (yybottom, yytop) YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct parser_param *param) -#else static void -yy_reduce_print (yyvsp, yyrule, param) - YYSTYPE *yyvsp; - int yyrule; - struct parser_param *param; -#endif +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, struct parser_param *param) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); + yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - , param); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , param); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule, param); \ -} while (YYID (0)) +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, param); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1383,7 +1168,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1406,15 +1191,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) @@ -1430,16 +1208,8 @@ yystrlen (yystr) # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif { char *yyd = yydest; const char *yys = yysrc; @@ -1469,27 +1239,27 @@ yytnamerr (char *yyres, const char *yystr) char const *yyp = yystr; for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } do_not_strip_quotes: ; } @@ -1512,12 +1282,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = 0; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1525,10 +1294,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1577,11 +1342,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, break; } yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } } } } @@ -1601,10 +1368,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, # undef YYCASE_ } - yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } if (*yymsg_alloc < yysize) { @@ -1641,83 +1410,290 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct parser_param *param) -#else -static void -yydestruct (yymsg, yytype, yyvaluep, param) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; - struct parser_param *param; -#endif { YYUSE (yyvaluep); YYUSE (param); - if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN switch (yytype) { + case 52: /* STRING */ +#line 225 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { free(((*yyvaluep).str)); } +#line 1429 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 55: /* IDENT */ +#line 225 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { free(((*yyvaluep).str)); } +#line 1435 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 66: /* XkbFile */ +#line 224 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { if (!param->rtrn) FreeXkbFile(((*yyvaluep).file)); } +#line 1441 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 67: /* XkbCompositeMap */ +#line 224 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { if (!param->rtrn) FreeXkbFile(((*yyvaluep).file)); } +#line 1447 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 69: /* XkbMapConfigList */ +#line 224 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { if (!param->rtrn) FreeXkbFile(((*yyvaluep).file)); } +#line 1453 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 70: /* XkbMapConfig */ +#line 224 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { if (!param->rtrn) FreeXkbFile(((*yyvaluep).file)); } +#line 1459 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 75: /* DeclList */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).any)); } +#line 1465 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 76: /* Decl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).any)); } +#line 1471 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 77: /* VarDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).var)); } +#line 1477 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 78: /* KeyNameDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).keyCode)); } +#line 1483 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 79: /* KeyAliasDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).keyAlias)); } +#line 1489 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 80: /* VModDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).vmod)); } +#line 1495 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 81: /* VModDefList */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).vmod)); } +#line 1501 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 82: /* VModDef */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).vmod)); } +#line 1507 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 83: /* InterpretDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).interp)); } +#line 1513 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 84: /* InterpretMatch */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).interp)); } +#line 1519 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 85: /* VarDeclList */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).var)); } +#line 1525 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 86: /* KeyTypeDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).keyType)); } +#line 1531 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 87: /* SymbolsDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).syms)); } +#line 1537 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 88: /* SymbolsBody */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).var)); } +#line 1543 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 89: /* SymbolsVarDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).var)); } +#line 1549 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 90: /* ArrayInit */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1555 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 91: /* GroupCompatDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).groupCompat)); } +#line 1561 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 92: /* ModMapDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).modMask)); } +#line 1567 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 93: /* LedMapDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).ledMap)); } +#line 1573 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 94: /* LedNameDecl */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).ledName)); } +#line 1579 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 108: /* CoordList */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1585 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 109: /* Coord */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1591 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 116: /* OptExprList */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1597 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 117: /* ExprList */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1603 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 118: /* Expr */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1609 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 119: /* Term */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1615 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 120: /* ActionList */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1621 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 121: /* Action */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1627 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 122: /* Lhs */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1633 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 123: /* Terminal */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1639 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 124: /* OptKeySymList */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1645 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 125: /* KeySymList */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1651 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 126: /* KeySyms */ +#line 219 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { FreeStmt((ParseCommon *) ((*yyvaluep).expr)); } +#line 1657 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 135: /* OptMapName */ +#line 225 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { free(((*yyvaluep).str)); } +#line 1663 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + + case 136: /* MapName */ +#line 225 "../src/xkbcomp/parser.y" /* yacc.c:1257 */ + { free(((*yyvaluep).str)); } +#line 1669 "xkbcommon-internal@sta/parser.c" /* yacc.c:1257 */ + break; + default: - break; + break; } + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (struct parser_param *param); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) int yyparse (struct parser_param *param) -#else -int -yyparse (param) - struct parser_param *param; -#endif -#endif { /* The lookahead symbol. */ int yychar; + /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); /* Number of syntax errors so far. */ int yynerrs; @@ -1727,10 +1703,10 @@ YYSTYPE yylval; int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. + 'yyss': related to states. + 'yyvs': related to semantic values. - Refer to the stacks thru separate pointers, to allow yyoverflow + Refer to the stacks through separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ @@ -1748,7 +1724,7 @@ YYSTYPE yylval; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ - int yytoken; + int yytoken = 0; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; @@ -1766,9 +1742,8 @@ YYSTYPE yylval; Keep to zero when no symbol should be popped. */ int yylen = 0; - yytoken = 0; - yyss = yyssa; - yyvs = yyvsa; + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1777,14 +1752,6 @@ YYSTYPE yylval; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - goto yysetstate; /*------------------------------------------------------------. @@ -1805,23 +1772,23 @@ YYSTYPE yylval; #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE @@ -1829,22 +1796,22 @@ YYSTYPE yylval; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ @@ -1853,10 +1820,10 @@ YYSTYPE yylval; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) - YYABORT; + YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); @@ -1885,7 +1852,7 @@ yybackup: if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, param_scanner); } if (yychar <= YYEOF) @@ -1925,7 +1892,9 @@ yybackup: yychar = YYEMPTY; yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate; @@ -1948,7 +1917,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1962,973 +1931,834 @@ yyreduce: switch (yyn) { case 2: - -/* Line 1806 of yacc.c */ -#line 233 "parser.y" - { (yyval.file) = param->rtrn = (yyvsp[(1) - (1)].file); param->more_maps = true; } +#line 242 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.file) = param->rtrn = (yyvsp[0].file); param->more_maps = !!param->rtrn; } +#line 1937 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 3: - -/* Line 1806 of yacc.c */ -#line 235 "parser.y" - { (yyval.file) = param->rtrn = (yyvsp[(1) - (1)].file); param->more_maps = true; YYACCEPT; } +#line 244 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.file) = param->rtrn = (yyvsp[0].file); param->more_maps = !!param->rtrn; YYACCEPT; } +#line 1943 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 4: - -/* Line 1806 of yacc.c */ -#line 237 "parser.y" +#line 246 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.file) = param->rtrn = NULL; param->more_maps = false; } +#line 1949 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 5: - -/* Line 1806 of yacc.c */ -#line 243 "parser.y" - { (yyval.file) = XkbFileCreate((yyvsp[(2) - (7)].file_type), (yyvsp[(3) - (7)].str), (ParseCommon *) (yyvsp[(5) - (7)].file), (yyvsp[(1) - (7)].mapFlags)); } +#line 252 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.file) = XkbFileCreate((yyvsp[-5].file_type), (yyvsp[-4].str), (ParseCommon *) (yyvsp[-2].file), (yyvsp[-6].mapFlags)); } +#line 1955 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 6: - -/* Line 1806 of yacc.c */ -#line 246 "parser.y" +#line 255 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.file_type) = FILE_TYPE_KEYMAP; } +#line 1961 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 7: - -/* Line 1806 of yacc.c */ -#line 247 "parser.y" +#line 256 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.file_type) = FILE_TYPE_KEYMAP; } +#line 1967 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 8: - -/* Line 1806 of yacc.c */ -#line 248 "parser.y" +#line 257 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.file_type) = FILE_TYPE_KEYMAP; } +#line 1973 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 9: - -/* Line 1806 of yacc.c */ -#line 252 "parser.y" +#line 261 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - if (!(yyvsp[(2) - (2)].file)) - (yyval.file) = (yyvsp[(1) - (2)].file); + if (!(yyvsp[0].file)) + (yyval.file) = (yyvsp[-1].file); else - (yyval.file) = (XkbFile *) AppendStmt((ParseCommon *) (yyvsp[(1) - (2)].file), - (ParseCommon *) (yyvsp[(2) - (2)].file)); + (yyval.file) = (XkbFile *) AppendStmt((ParseCommon *) (yyvsp[-1].file), + (ParseCommon *) (yyvsp[0].file)); } +#line 1985 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 10: - -/* Line 1806 of yacc.c */ -#line 260 "parser.y" - { (yyval.file) = (yyvsp[(1) - (1)].file); } +#line 269 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.file) = (yyvsp[0].file); } +#line 1991 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 11: - -/* Line 1806 of yacc.c */ -#line 266 "parser.y" +#line 275 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - if ((yyvsp[(2) - (7)].file_type) == FILE_TYPE_GEOMETRY) { - free((yyvsp[(3) - (7)].str)); - FreeStmt((yyvsp[(5) - (7)].any)); - (yyval.file) = NULL; - } - else { - (yyval.file) = XkbFileCreate((yyvsp[(2) - (7)].file_type), (yyvsp[(3) - (7)].str), (yyvsp[(5) - (7)].any), (yyvsp[(1) - (7)].mapFlags)); - } + (yyval.file) = XkbFileCreate((yyvsp[-5].file_type), (yyvsp[-4].str), (yyvsp[-2].any), (yyvsp[-6].mapFlags)); } +#line 1999 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 12: - -/* Line 1806 of yacc.c */ -#line 278 "parser.y" +#line 280 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.file_type) = FILE_TYPE_KEYCODES; } +#line 2005 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 13: - -/* Line 1806 of yacc.c */ -#line 279 "parser.y" +#line 281 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.file_type) = FILE_TYPE_TYPES; } +#line 2011 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 14: - -/* Line 1806 of yacc.c */ -#line 280 "parser.y" +#line 282 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.file_type) = FILE_TYPE_COMPAT; } +#line 2017 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 15: - -/* Line 1806 of yacc.c */ -#line 281 "parser.y" +#line 283 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.file_type) = FILE_TYPE_SYMBOLS; } +#line 2023 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 16: - -/* Line 1806 of yacc.c */ -#line 282 "parser.y" +#line 284 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.file_type) = FILE_TYPE_GEOMETRY; } +#line 2029 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 17: - -/* Line 1806 of yacc.c */ -#line 285 "parser.y" - { (yyval.mapFlags) = (yyvsp[(1) - (1)].mapFlags); } +#line 287 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.mapFlags) = (yyvsp[0].mapFlags); } +#line 2035 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 18: - -/* Line 1806 of yacc.c */ -#line 286 "parser.y" +#line 288 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.mapFlags) = 0; } +#line 2041 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 19: - -/* Line 1806 of yacc.c */ -#line 289 "parser.y" - { (yyval.mapFlags) = ((yyvsp[(1) - (2)].mapFlags) | (yyvsp[(2) - (2)].mapFlags)); } +#line 291 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.mapFlags) = ((yyvsp[-1].mapFlags) | (yyvsp[0].mapFlags)); } +#line 2047 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 20: - -/* Line 1806 of yacc.c */ -#line 290 "parser.y" - { (yyval.mapFlags) = (yyvsp[(1) - (1)].mapFlags); } +#line 292 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.mapFlags) = (yyvsp[0].mapFlags); } +#line 2053 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 21: - -/* Line 1806 of yacc.c */ -#line 293 "parser.y" +#line 295 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.mapFlags) = MAP_IS_PARTIAL; } +#line 2059 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 22: - -/* Line 1806 of yacc.c */ -#line 294 "parser.y" +#line 296 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.mapFlags) = MAP_IS_DEFAULT; } +#line 2065 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 23: - -/* Line 1806 of yacc.c */ -#line 295 "parser.y" +#line 297 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.mapFlags) = MAP_IS_HIDDEN; } +#line 2071 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 24: - -/* Line 1806 of yacc.c */ -#line 296 "parser.y" +#line 298 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.mapFlags) = MAP_HAS_ALPHANUMERIC; } +#line 2077 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 25: - -/* Line 1806 of yacc.c */ -#line 297 "parser.y" +#line 299 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.mapFlags) = MAP_HAS_MODIFIER; } +#line 2083 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 26: - -/* Line 1806 of yacc.c */ -#line 298 "parser.y" +#line 300 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.mapFlags) = MAP_HAS_KEYPAD; } +#line 2089 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 27: - -/* Line 1806 of yacc.c */ -#line 299 "parser.y" +#line 301 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.mapFlags) = MAP_HAS_FN; } +#line 2095 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 28: - -/* Line 1806 of yacc.c */ -#line 300 "parser.y" +#line 302 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.mapFlags) = MAP_IS_ALTGR; } +#line 2101 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 29: - -/* Line 1806 of yacc.c */ -#line 304 "parser.y" - { (yyval.any) = AppendStmt((yyvsp[(1) - (2)].any), (yyvsp[(2) - (2)].any)); } +#line 306 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.any) = AppendStmt((yyvsp[-1].any), (yyvsp[0].any)); } +#line 2107 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 30: - -/* Line 1806 of yacc.c */ -#line 305 "parser.y" +#line 307 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.any) = NULL; } +#line 2113 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 31: - -/* Line 1806 of yacc.c */ -#line 309 "parser.y" +#line 311 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].var)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].var); + (yyvsp[0].var)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].var); } +#line 2122 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 32: - -/* Line 1806 of yacc.c */ -#line 314 "parser.y" +#line 316 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].vmod)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].vmod); + (yyvsp[0].vmod)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].vmod); } +#line 2131 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 33: - -/* Line 1806 of yacc.c */ -#line 319 "parser.y" +#line 321 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].interp)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].interp); + (yyvsp[0].interp)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].interp); } +#line 2140 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 34: - -/* Line 1806 of yacc.c */ -#line 324 "parser.y" +#line 326 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].keyCode)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].keyCode); + (yyvsp[0].keyCode)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].keyCode); } +#line 2149 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 35: - -/* Line 1806 of yacc.c */ -#line 329 "parser.y" +#line 331 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].keyAlias)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].keyAlias); + (yyvsp[0].keyAlias)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].keyAlias); } +#line 2158 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 36: - -/* Line 1806 of yacc.c */ -#line 334 "parser.y" +#line 336 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].keyType)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].keyType); + (yyvsp[0].keyType)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].keyType); } +#line 2167 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 37: - -/* Line 1806 of yacc.c */ -#line 339 "parser.y" +#line 341 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].syms)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].syms); + (yyvsp[0].syms)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].syms); } +#line 2176 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 38: - -/* Line 1806 of yacc.c */ -#line 344 "parser.y" +#line 346 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].modMask)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].modMask); + (yyvsp[0].modMask)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].modMask); } +#line 2185 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 39: - -/* Line 1806 of yacc.c */ -#line 349 "parser.y" +#line 351 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].groupCompat)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].groupCompat); + (yyvsp[0].groupCompat)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].groupCompat); } +#line 2194 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 40: - -/* Line 1806 of yacc.c */ -#line 354 "parser.y" +#line 356 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].ledMap)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].ledMap); + (yyvsp[0].ledMap)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].ledMap); } +#line 2203 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 41: - -/* Line 1806 of yacc.c */ -#line 359 "parser.y" +#line 361 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyvsp[(2) - (2)].ledName)->merge = (yyvsp[(1) - (2)].merge); - (yyval.any) = (ParseCommon *) (yyvsp[(2) - (2)].ledName); + (yyvsp[0].ledName)->merge = (yyvsp[-1].merge); + (yyval.any) = (ParseCommon *) (yyvsp[0].ledName); } +#line 2212 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 42: - -/* Line 1806 of yacc.c */ -#line 363 "parser.y" +#line 365 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.any) = NULL; } +#line 2218 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 43: - -/* Line 1806 of yacc.c */ -#line 364 "parser.y" +#line 366 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.any) = NULL; } +#line 2224 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 44: - -/* Line 1806 of yacc.c */ -#line 365 "parser.y" +#line 367 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.any) = NULL; } +#line 2230 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 45: - -/* Line 1806 of yacc.c */ -#line 367 "parser.y" +#line 369 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - (yyval.any) = (ParseCommon *) IncludeCreate(param->ctx, (yyvsp[(2) - (2)].str), (yyvsp[(1) - (2)].merge)); - free((yyvsp[(2) - (2)].str)); + (yyval.any) = (ParseCommon *) IncludeCreate(param->ctx, (yyvsp[0].str), (yyvsp[-1].merge)); + free((yyvsp[0].str)); } +#line 2239 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 46: - -/* Line 1806 of yacc.c */ -#line 374 "parser.y" - { (yyval.var) = VarCreate((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); } +#line 376 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = VarCreate((yyvsp[-3].expr), (yyvsp[-1].expr)); } +#line 2245 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 47: - -/* Line 1806 of yacc.c */ -#line 376 "parser.y" - { (yyval.var) = BoolVarCreate((yyvsp[(1) - (2)].sval), true); } +#line 378 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = BoolVarCreate((yyvsp[-1].atom), true); } +#line 2251 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 48: - -/* Line 1806 of yacc.c */ -#line 378 "parser.y" - { (yyval.var) = BoolVarCreate((yyvsp[(2) - (3)].sval), false); } +#line 380 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = BoolVarCreate((yyvsp[-1].atom), false); } +#line 2257 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 49: - -/* Line 1806 of yacc.c */ -#line 382 "parser.y" - { (yyval.keyCode) = KeycodeCreate((yyvsp[(1) - (4)].sval), (yyvsp[(3) - (4)].num)); } +#line 384 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.keyCode) = KeycodeCreate((yyvsp[-3].atom), (yyvsp[-1].num)); } +#line 2263 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 50: - -/* Line 1806 of yacc.c */ -#line 386 "parser.y" - { (yyval.keyAlias) = KeyAliasCreate((yyvsp[(2) - (5)].sval), (yyvsp[(4) - (5)].sval)); } +#line 388 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.keyAlias) = KeyAliasCreate((yyvsp[-3].atom), (yyvsp[-1].atom)); } +#line 2269 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 51: - -/* Line 1806 of yacc.c */ -#line 390 "parser.y" - { (yyval.vmod) = (yyvsp[(2) - (3)].vmod); } +#line 392 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.vmod) = (yyvsp[-1].vmod); } +#line 2275 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 52: - -/* Line 1806 of yacc.c */ -#line 394 "parser.y" - { (yyval.vmod) = (VModDef *) AppendStmt((ParseCommon *) (yyvsp[(1) - (3)].vmod), - (ParseCommon *) (yyvsp[(3) - (3)].vmod)); } +#line 396 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.vmod) = (VModDef *) AppendStmt((ParseCommon *) (yyvsp[-2].vmod), + (ParseCommon *) (yyvsp[0].vmod)); } +#line 2282 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 53: - -/* Line 1806 of yacc.c */ -#line 397 "parser.y" - { (yyval.vmod) = (yyvsp[(1) - (1)].vmod); } +#line 399 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.vmod) = (yyvsp[0].vmod); } +#line 2288 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 54: - -/* Line 1806 of yacc.c */ -#line 401 "parser.y" - { (yyval.vmod) = VModCreate((yyvsp[(1) - (1)].sval), NULL); } +#line 403 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.vmod) = VModCreate((yyvsp[0].atom), NULL); } +#line 2294 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 55: - -/* Line 1806 of yacc.c */ -#line 403 "parser.y" - { (yyval.vmod) = VModCreate((yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].expr)); } +#line 405 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.vmod) = VModCreate((yyvsp[-2].atom), (yyvsp[0].expr)); } +#line 2300 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 56: - -/* Line 1806 of yacc.c */ -#line 409 "parser.y" - { (yyvsp[(2) - (6)].interp)->def = (yyvsp[(4) - (6)].var); (yyval.interp) = (yyvsp[(2) - (6)].interp); } +#line 411 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyvsp[-4].interp)->def = (yyvsp[-2].var); (yyval.interp) = (yyvsp[-4].interp); } +#line 2306 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 57: - -/* Line 1806 of yacc.c */ -#line 413 "parser.y" - { (yyval.interp) = InterpCreate((yyvsp[(1) - (3)].keysym), (yyvsp[(3) - (3)].expr)); } +#line 415 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.interp) = InterpCreate((yyvsp[-2].keysym), (yyvsp[0].expr)); } +#line 2312 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 58: - -/* Line 1806 of yacc.c */ -#line 415 "parser.y" - { (yyval.interp) = InterpCreate((yyvsp[(1) - (1)].keysym), NULL); } +#line 417 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.interp) = InterpCreate((yyvsp[0].keysym), NULL); } +#line 2318 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 59: - -/* Line 1806 of yacc.c */ -#line 419 "parser.y" - { (yyval.var) = (VarDef *) AppendStmt((ParseCommon *) (yyvsp[(1) - (2)].var), - (ParseCommon *) (yyvsp[(2) - (2)].var)); } +#line 421 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = (VarDef *) AppendStmt((ParseCommon *) (yyvsp[-1].var), + (ParseCommon *) (yyvsp[0].var)); } +#line 2325 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 60: - -/* Line 1806 of yacc.c */ -#line 422 "parser.y" - { (yyval.var) = (yyvsp[(1) - (1)].var); } +#line 424 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = (yyvsp[0].var); } +#line 2331 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 61: - -/* Line 1806 of yacc.c */ -#line 428 "parser.y" - { (yyval.keyType) = KeyTypeCreate((yyvsp[(2) - (6)].sval), (yyvsp[(4) - (6)].var)); } +#line 430 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.keyType) = KeyTypeCreate((yyvsp[-4].atom), (yyvsp[-2].var)); } +#line 2337 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 62: - -/* Line 1806 of yacc.c */ -#line 434 "parser.y" - { (yyval.syms) = SymbolsCreate((yyvsp[(2) - (6)].sval), (yyvsp[(4) - (6)].var)); } +#line 436 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.syms) = SymbolsCreate((yyvsp[-4].atom), (yyvsp[-2].var)); } +#line 2343 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 63: - -/* Line 1806 of yacc.c */ -#line 438 "parser.y" - { (yyval.var) = (VarDef *) AppendStmt((ParseCommon *) (yyvsp[(1) - (3)].var), - (ParseCommon *) (yyvsp[(3) - (3)].var)); } +#line 440 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = (VarDef *) AppendStmt((ParseCommon *) (yyvsp[-2].var), + (ParseCommon *) (yyvsp[0].var)); } +#line 2350 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 64: - -/* Line 1806 of yacc.c */ -#line 441 "parser.y" - { (yyval.var) = (yyvsp[(1) - (1)].var); } +#line 443 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = (yyvsp[0].var); } +#line 2356 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 65: - -/* Line 1806 of yacc.c */ -#line 442 "parser.y" +#line 444 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.var) = NULL; } +#line 2362 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 66: - -/* Line 1806 of yacc.c */ -#line 445 "parser.y" - { (yyval.var) = VarCreate((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } +#line 447 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = VarCreate((yyvsp[-2].expr), (yyvsp[0].expr)); } +#line 2368 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 67: - -/* Line 1806 of yacc.c */ -#line 446 "parser.y" - { (yyval.var) = VarCreate((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } +#line 448 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = VarCreate((yyvsp[-2].expr), (yyvsp[0].expr)); } +#line 2374 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 68: - -/* Line 1806 of yacc.c */ -#line 447 "parser.y" - { (yyval.var) = BoolVarCreate((yyvsp[(1) - (1)].sval), true); } +#line 449 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = BoolVarCreate((yyvsp[0].atom), true); } +#line 2380 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 69: - -/* Line 1806 of yacc.c */ -#line 448 "parser.y" - { (yyval.var) = BoolVarCreate((yyvsp[(2) - (2)].sval), false); } +#line 450 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = BoolVarCreate((yyvsp[0].atom), false); } +#line 2386 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 70: - -/* Line 1806 of yacc.c */ -#line 449 "parser.y" - { (yyval.var) = VarCreate(NULL, (yyvsp[(1) - (1)].expr)); } +#line 451 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.var) = VarCreate(NULL, (yyvsp[0].expr)); } +#line 2392 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 71: - -/* Line 1806 of yacc.c */ -#line 453 "parser.y" - { (yyval.expr) = (yyvsp[(2) - (3)].expr); } +#line 455 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[-1].expr); } +#line 2398 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 72: - -/* Line 1806 of yacc.c */ -#line 455 "parser.y" - { (yyval.expr) = ExprCreateUnary(EXPR_ACTION_LIST, EXPR_TYPE_ACTION, (yyvsp[(2) - (3)].expr)); } +#line 457 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateUnary(EXPR_ACTION_LIST, EXPR_TYPE_ACTION, (yyvsp[-1].expr)); } +#line 2404 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 73: - -/* Line 1806 of yacc.c */ -#line 459 "parser.y" - { (yyval.groupCompat) = GroupCompatCreate((yyvsp[(2) - (5)].ival), (yyvsp[(4) - (5)].expr)); } +#line 461 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.groupCompat) = GroupCompatCreate((yyvsp[-3].ival), (yyvsp[-1].expr)); } +#line 2410 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 74: - -/* Line 1806 of yacc.c */ -#line 463 "parser.y" - { (yyval.modMask) = ModMapCreate((yyvsp[(2) - (6)].sval), (yyvsp[(4) - (6)].expr)); } +#line 465 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.modMask) = ModMapCreate((yyvsp[-4].atom), (yyvsp[-2].expr)); } +#line 2416 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 75: - -/* Line 1806 of yacc.c */ -#line 467 "parser.y" - { (yyval.ledMap) = LedMapCreate((yyvsp[(2) - (6)].sval), (yyvsp[(4) - (6)].var)); } +#line 469 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.ledMap) = LedMapCreate((yyvsp[-4].atom), (yyvsp[-2].var)); } +#line 2422 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 76: - -/* Line 1806 of yacc.c */ -#line 471 "parser.y" - { (yyval.ledName) = LedNameCreate((yyvsp[(2) - (5)].ival), (yyvsp[(4) - (5)].expr), false); } +#line 473 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.ledName) = LedNameCreate((yyvsp[-3].ival), (yyvsp[-1].expr), false); } +#line 2428 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 77: - -/* Line 1806 of yacc.c */ -#line 473 "parser.y" - { (yyval.ledName) = LedNameCreate((yyvsp[(3) - (6)].ival), (yyvsp[(5) - (6)].expr), true); } +#line 475 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.ledName) = LedNameCreate((yyvsp[-3].ival), (yyvsp[-1].expr), true); } +#line 2434 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 78: - -/* Line 1806 of yacc.c */ -#line 477 "parser.y" +#line 479 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2440 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 79: - -/* Line 1806 of yacc.c */ -#line 479 "parser.y" - { (yyval.geom) = NULL; } +#line 481 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (void) (yyvsp[-2].expr); (yyval.geom) = NULL; } +#line 2446 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 80: - -/* Line 1806 of yacc.c */ -#line 483 "parser.y" +#line 485 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2452 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 81: - -/* Line 1806 of yacc.c */ -#line 486 "parser.y" +#line 488 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL;} +#line 2458 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 82: - -/* Line 1806 of yacc.c */ -#line 487 "parser.y" +#line 489 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2464 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 83: - -/* Line 1806 of yacc.c */ -#line 491 "parser.y" +#line 493 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2470 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 84: - -/* Line 1806 of yacc.c */ -#line 493 "parser.y" - { FreeStmt((ParseCommon *) (yyvsp[(1) - (1)].var)); (yyval.geom) = NULL; } +#line 495 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { FreeStmt((ParseCommon *) (yyvsp[0].var)); (yyval.geom) = NULL; } +#line 2476 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 85: - -/* Line 1806 of yacc.c */ -#line 495 "parser.y" +#line 497 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2482 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 86: - -/* Line 1806 of yacc.c */ -#line 497 "parser.y" - { FreeStmt((ParseCommon *) (yyvsp[(1) - (1)].ledMap)); (yyval.geom) = NULL; } +#line 499 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { FreeStmt((ParseCommon *) (yyvsp[0].ledMap)); (yyval.geom) = NULL; } +#line 2488 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 87: - -/* Line 1806 of yacc.c */ -#line 499 "parser.y" +#line 501 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2494 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 88: - -/* Line 1806 of yacc.c */ -#line 502 "parser.y" +#line 504 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL;} +#line 2500 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 89: - -/* Line 1806 of yacc.c */ -#line 503 "parser.y" +#line 505 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2506 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 90: - -/* Line 1806 of yacc.c */ -#line 506 "parser.y" +#line 508 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2512 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 91: - -/* Line 1806 of yacc.c */ -#line 508 "parser.y" - { FreeStmt((ParseCommon *) (yyvsp[(1) - (1)].var)); (yyval.geom) = NULL; } +#line 510 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { FreeStmt((ParseCommon *) (yyvsp[0].var)); (yyval.geom) = NULL; } +#line 2518 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 92: - -/* Line 1806 of yacc.c */ -#line 511 "parser.y" +#line 513 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2524 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 93: - -/* Line 1806 of yacc.c */ -#line 512 "parser.y" +#line 514 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2530 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 94: - -/* Line 1806 of yacc.c */ -#line 516 "parser.y" +#line 518 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2536 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 95: - -/* Line 1806 of yacc.c */ -#line 518 "parser.y" - { FreeStmt((ParseCommon *) (yyvsp[(2) - (3)].expr)); (yyval.geom) = NULL; } +#line 520 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { FreeStmt((ParseCommon *) (yyvsp[-1].expr)); (yyval.geom) = NULL; } +#line 2542 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 96: - -/* Line 1806 of yacc.c */ -#line 522 "parser.y" +#line 524 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2548 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 97: - -/* Line 1806 of yacc.c */ -#line 525 "parser.y" +#line 527 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2554 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 98: - -/* Line 1806 of yacc.c */ -#line 526 "parser.y" +#line 528 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2560 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 99: - -/* Line 1806 of yacc.c */ -#line 529 "parser.y" +#line 531 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2566 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 100: - -/* Line 1806 of yacc.c */ -#line 533 "parser.y" +#line 535 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL;} +#line 2572 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 101: - -/* Line 1806 of yacc.c */ -#line 535 "parser.y" +#line 537 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.geom) = NULL; } +#line 2578 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 102: - -/* Line 1806 of yacc.c */ -#line 539 "parser.y" - { (yyval.geom) = NULL; } +#line 541 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (void) (yyvsp[-1].expr); (yyval.geom) = NULL; } +#line 2584 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 103: - -/* Line 1806 of yacc.c */ -#line 541 "parser.y" - { (yyval.geom) = NULL; } +#line 543 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (void) (yyvsp[-1].expr); (yyval.geom) = NULL; } +#line 2590 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 104: - -/* Line 1806 of yacc.c */ -#line 543 "parser.y" - { FreeStmt((ParseCommon *) (yyvsp[(3) - (3)].expr)); (yyval.geom) = NULL; } +#line 545 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { FreeStmt((ParseCommon *) (yyvsp[0].expr)); (yyval.geom) = NULL; } +#line 2596 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 105: - -/* Line 1806 of yacc.c */ -#line 547 "parser.y" - { (yyval.expr) = NULL; } +#line 549 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (void) (yyvsp[-2].expr); (void) (yyvsp[0].expr); (yyval.expr) = NULL; } +#line 2602 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 106: - -/* Line 1806 of yacc.c */ -#line 549 "parser.y" - { (yyval.expr) = NULL; } +#line 551 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (void) (yyvsp[0].expr); (yyval.expr) = NULL; } +#line 2608 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 107: - -/* Line 1806 of yacc.c */ -#line 553 "parser.y" +#line 555 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.expr) = NULL; } +#line 2614 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 108: - -/* Line 1806 of yacc.c */ -#line 557 "parser.y" - { FreeStmt((ParseCommon *) (yyvsp[(4) - (6)].var)); (yyval.geom) = NULL; } +#line 559 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { FreeStmt((ParseCommon *) (yyvsp[-2].var)); (yyval.geom) = NULL; } +#line 2620 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 109: - -/* Line 1806 of yacc.c */ -#line 560 "parser.y" +#line 562 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.ival) = 0; } +#line 2626 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 110: - -/* Line 1806 of yacc.c */ -#line 561 "parser.y" +#line 563 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.ival) = 0; } +#line 2632 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 111: - -/* Line 1806 of yacc.c */ -#line 562 "parser.y" +#line 564 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.ival) = 0; } +#line 2638 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 112: - -/* Line 1806 of yacc.c */ -#line 563 "parser.y" +#line 565 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.ival) = 0; } +#line 2644 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 113: - -/* Line 1806 of yacc.c */ -#line 566 "parser.y" - { (yyval.sval) = (yyvsp[(1) - (1)].sval); } +#line 568 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = (yyvsp[0].atom); } +#line 2650 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 114: - -/* Line 1806 of yacc.c */ -#line 567 "parser.y" - { (yyval.sval) = (yyvsp[(1) - (1)].sval); } +#line 569 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = (yyvsp[0].atom); } +#line 2656 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 115: - -/* Line 1806 of yacc.c */ -#line 571 "parser.y" - { (yyval.sval) = xkb_atom_intern_literal(param->ctx, "action"); } +#line 573 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "action"); } +#line 2662 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 116: - -/* Line 1806 of yacc.c */ -#line 573 "parser.y" - { (yyval.sval) = xkb_atom_intern_literal(param->ctx, "interpret"); } +#line 575 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "interpret"); } +#line 2668 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 117: - -/* Line 1806 of yacc.c */ -#line 575 "parser.y" - { (yyval.sval) = xkb_atom_intern_literal(param->ctx, "type"); } +#line 577 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "type"); } +#line 2674 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 118: - -/* Line 1806 of yacc.c */ -#line 577 "parser.y" - { (yyval.sval) = xkb_atom_intern_literal(param->ctx, "key"); } +#line 579 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "key"); } +#line 2680 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 119: - -/* Line 1806 of yacc.c */ -#line 579 "parser.y" - { (yyval.sval) = xkb_atom_intern_literal(param->ctx, "group"); } +#line 581 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "group"); } +#line 2686 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 120: - -/* Line 1806 of yacc.c */ -#line 581 "parser.y" - {(yyval.sval) = xkb_atom_intern_literal(param->ctx, "modifier_map");} +#line 583 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + {(yyval.atom) = xkb_atom_intern_literal(param->ctx, "modifier_map");} +#line 2692 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 121: - -/* Line 1806 of yacc.c */ -#line 583 "parser.y" - { (yyval.sval) = xkb_atom_intern_literal(param->ctx, "indicator"); } +#line 585 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "indicator"); } +#line 2698 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 122: - -/* Line 1806 of yacc.c */ -#line 585 "parser.y" - { (yyval.sval) = XKB_ATOM_NONE; } +#line 587 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "shape"); } +#line 2704 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 123: - -/* Line 1806 of yacc.c */ -#line 587 "parser.y" - { (yyval.sval) = XKB_ATOM_NONE; } +#line 589 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "row"); } +#line 2710 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 124: - -/* Line 1806 of yacc.c */ -#line 589 "parser.y" - { (yyval.sval) = XKB_ATOM_NONE; } +#line 591 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "section"); } +#line 2716 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 125: - -/* Line 1806 of yacc.c */ -#line 591 "parser.y" - { (yyval.sval) = XKB_ATOM_NONE; } +#line 593 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "text"); } +#line 2722 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 126: - -/* Line 1806 of yacc.c */ -#line 594 "parser.y" - { (yyval.merge) = (yyvsp[(1) - (1)].merge); } +#line 596 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.merge) = (yyvsp[0].merge); } +#line 2728 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 127: - -/* Line 1806 of yacc.c */ -#line 595 "parser.y" +#line 597 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.merge) = MERGE_DEFAULT; } +#line 2734 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 128: - -/* Line 1806 of yacc.c */ -#line 598 "parser.y" +#line 600 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.merge) = MERGE_DEFAULT; } +#line 2740 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 129: - -/* Line 1806 of yacc.c */ -#line 599 "parser.y" +#line 601 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.merge) = MERGE_AUGMENT; } +#line 2746 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 130: - -/* Line 1806 of yacc.c */ -#line 600 "parser.y" +#line 602 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.merge) = MERGE_OVERRIDE; } +#line 2752 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 131: - -/* Line 1806 of yacc.c */ -#line 601 "parser.y" +#line 603 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.merge) = MERGE_REPLACE; } +#line 2758 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 132: - -/* Line 1806 of yacc.c */ -#line 603 "parser.y" +#line 605 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { /* * This used to be MERGE_ALT_FORM. This functionality was @@ -2936,398 +2766,345 @@ yyreduce: */ (yyval.merge) = MERGE_DEFAULT; } +#line 2770 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 133: - -/* Line 1806 of yacc.c */ -#line 612 "parser.y" - { (yyval.expr) = (yyvsp[(1) - (1)].expr); } +#line 614 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 2776 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 134: - -/* Line 1806 of yacc.c */ -#line 613 "parser.y" +#line 615 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.expr) = NULL; } +#line 2782 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 135: - -/* Line 1806 of yacc.c */ -#line 617 "parser.y" - { (yyval.expr) = (ExprDef *) AppendStmt((ParseCommon *) (yyvsp[(1) - (3)].expr), - (ParseCommon *) (yyvsp[(3) - (3)].expr)); } +#line 619 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (ExprDef *) AppendStmt((ParseCommon *) (yyvsp[-2].expr), + (ParseCommon *) (yyvsp[0].expr)); } +#line 2789 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 136: - -/* Line 1806 of yacc.c */ -#line 620 "parser.y" - { (yyval.expr) = (yyvsp[(1) - (1)].expr); } +#line 622 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 2795 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 137: - -/* Line 1806 of yacc.c */ -#line 624 "parser.y" - { (yyval.expr) = ExprCreateBinary(EXPR_DIVIDE, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } +#line 626 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateBinary(EXPR_DIVIDE, (yyvsp[-2].expr), (yyvsp[0].expr)); } +#line 2801 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 138: - -/* Line 1806 of yacc.c */ -#line 626 "parser.y" - { (yyval.expr) = ExprCreateBinary(EXPR_ADD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } +#line 628 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateBinary(EXPR_ADD, (yyvsp[-2].expr), (yyvsp[0].expr)); } +#line 2807 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 139: - -/* Line 1806 of yacc.c */ -#line 628 "parser.y" - { (yyval.expr) = ExprCreateBinary(EXPR_SUBTRACT, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } +#line 630 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateBinary(EXPR_SUBTRACT, (yyvsp[-2].expr), (yyvsp[0].expr)); } +#line 2813 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 140: - -/* Line 1806 of yacc.c */ -#line 630 "parser.y" - { (yyval.expr) = ExprCreateBinary(EXPR_MULTIPLY, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } +#line 632 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateBinary(EXPR_MULTIPLY, (yyvsp[-2].expr), (yyvsp[0].expr)); } +#line 2819 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 141: - -/* Line 1806 of yacc.c */ -#line 632 "parser.y" - { (yyval.expr) = ExprCreateBinary(EXPR_ASSIGN, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } +#line 634 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateBinary(EXPR_ASSIGN, (yyvsp[-2].expr), (yyvsp[0].expr)); } +#line 2825 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 142: - -/* Line 1806 of yacc.c */ -#line 634 "parser.y" - { (yyval.expr) = (yyvsp[(1) - (1)].expr); } +#line 636 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 2831 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 143: - -/* Line 1806 of yacc.c */ -#line 638 "parser.y" - { (yyval.expr) = ExprCreateUnary(EXPR_NEGATE, (yyvsp[(2) - (2)].expr)->expr.value_type, (yyvsp[(2) - (2)].expr)); } +#line 640 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateUnary(EXPR_NEGATE, (yyvsp[0].expr)->expr.value_type, (yyvsp[0].expr)); } +#line 2837 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 144: - -/* Line 1806 of yacc.c */ -#line 640 "parser.y" - { (yyval.expr) = ExprCreateUnary(EXPR_UNARY_PLUS, (yyvsp[(2) - (2)].expr)->expr.value_type, (yyvsp[(2) - (2)].expr)); } +#line 642 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateUnary(EXPR_UNARY_PLUS, (yyvsp[0].expr)->expr.value_type, (yyvsp[0].expr)); } +#line 2843 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 145: - -/* Line 1806 of yacc.c */ -#line 642 "parser.y" - { (yyval.expr) = ExprCreateUnary(EXPR_NOT, EXPR_TYPE_BOOLEAN, (yyvsp[(2) - (2)].expr)); } +#line 644 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateUnary(EXPR_NOT, EXPR_TYPE_BOOLEAN, (yyvsp[0].expr)); } +#line 2849 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 146: - -/* Line 1806 of yacc.c */ -#line 644 "parser.y" - { (yyval.expr) = ExprCreateUnary(EXPR_INVERT, (yyvsp[(2) - (2)].expr)->expr.value_type, (yyvsp[(2) - (2)].expr)); } +#line 646 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateUnary(EXPR_INVERT, (yyvsp[0].expr)->expr.value_type, (yyvsp[0].expr)); } +#line 2855 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 147: - -/* Line 1806 of yacc.c */ -#line 646 "parser.y" - { (yyval.expr) = (yyvsp[(1) - (1)].expr); } +#line 648 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 2861 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 148: - -/* Line 1806 of yacc.c */ -#line 648 "parser.y" - { (yyval.expr) = ExprCreateAction((yyvsp[(1) - (4)].sval), (yyvsp[(3) - (4)].expr)); } +#line 650 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateAction((yyvsp[-3].atom), (yyvsp[-1].expr)); } +#line 2867 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 149: - -/* Line 1806 of yacc.c */ -#line 650 "parser.y" - { (yyval.expr) = (yyvsp[(1) - (1)].expr); } +#line 652 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 2873 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 150: - -/* Line 1806 of yacc.c */ -#line 652 "parser.y" - { (yyval.expr) = (yyvsp[(2) - (3)].expr); } +#line 654 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[-1].expr); } +#line 2879 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 151: - -/* Line 1806 of yacc.c */ -#line 656 "parser.y" - { (yyval.expr) = (ExprDef *) AppendStmt((ParseCommon *) (yyvsp[(1) - (3)].expr), - (ParseCommon *) (yyvsp[(3) - (3)].expr)); } +#line 658 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (ExprDef *) AppendStmt((ParseCommon *) (yyvsp[-2].expr), + (ParseCommon *) (yyvsp[0].expr)); } +#line 2886 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 152: - -/* Line 1806 of yacc.c */ -#line 659 "parser.y" - { (yyval.expr) = (yyvsp[(1) - (1)].expr); } +#line 661 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 2892 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 153: - -/* Line 1806 of yacc.c */ -#line 663 "parser.y" - { (yyval.expr) = ExprCreateAction((yyvsp[(1) - (4)].sval), (yyvsp[(3) - (4)].expr)); } +#line 665 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateAction((yyvsp[-3].atom), (yyvsp[-1].expr)); } +#line 2898 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 154: - -/* Line 1806 of yacc.c */ -#line 667 "parser.y" - { (yyval.expr) = ExprCreateIdent((yyvsp[(1) - (1)].sval)); } +#line 669 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateIdent((yyvsp[0].atom)); } +#line 2904 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 155: - -/* Line 1806 of yacc.c */ -#line 669 "parser.y" - { (yyval.expr) = ExprCreateFieldRef((yyvsp[(1) - (3)].sval), (yyvsp[(3) - (3)].sval)); } +#line 671 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateFieldRef((yyvsp[-2].atom), (yyvsp[0].atom)); } +#line 2910 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 156: - -/* Line 1806 of yacc.c */ -#line 671 "parser.y" - { (yyval.expr) = ExprCreateArrayRef(XKB_ATOM_NONE, (yyvsp[(1) - (4)].sval), (yyvsp[(3) - (4)].expr)); } +#line 673 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateArrayRef(XKB_ATOM_NONE, (yyvsp[-3].atom), (yyvsp[-1].expr)); } +#line 2916 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 157: - -/* Line 1806 of yacc.c */ -#line 673 "parser.y" - { (yyval.expr) = ExprCreateArrayRef((yyvsp[(1) - (6)].sval), (yyvsp[(3) - (6)].sval), (yyvsp[(5) - (6)].expr)); } +#line 675 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateArrayRef((yyvsp[-5].atom), (yyvsp[-3].atom), (yyvsp[-1].expr)); } +#line 2922 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 158: - -/* Line 1806 of yacc.c */ -#line 677 "parser.y" - { (yyval.expr) = ExprCreateString((yyvsp[(1) - (1)].sval)); } +#line 679 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateString((yyvsp[0].atom)); } +#line 2928 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 159: - -/* Line 1806 of yacc.c */ -#line 679 "parser.y" - { (yyval.expr) = ExprCreateInteger((yyvsp[(1) - (1)].ival)); } +#line 681 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateInteger((yyvsp[0].ival)); } +#line 2934 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 160: - -/* Line 1806 of yacc.c */ -#line 681 "parser.y" - { (yyval.expr) = NULL; } +#line 683 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateFloat(/* Discard $1 */); } +#line 2940 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 161: - -/* Line 1806 of yacc.c */ -#line 683 "parser.y" - { (yyval.expr) = ExprCreateKeyName((yyvsp[(1) - (1)].sval)); } +#line 685 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateKeyName((yyvsp[0].atom)); } +#line 2946 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 162: - -/* Line 1806 of yacc.c */ -#line 686 "parser.y" - { (yyval.expr) = (yyvsp[(1) - (1)].expr); } +#line 688 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[0].expr); } +#line 2952 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 163: - -/* Line 1806 of yacc.c */ -#line 687 "parser.y" +#line 689 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.expr) = NULL; } +#line 2958 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 164: - -/* Line 1806 of yacc.c */ -#line 691 "parser.y" - { (yyval.expr) = ExprAppendKeysymList((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].keysym)); } +#line 693 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprAppendKeysymList((yyvsp[-2].expr), (yyvsp[0].keysym)); } +#line 2964 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 165: - -/* Line 1806 of yacc.c */ -#line 693 "parser.y" - { (yyval.expr) = ExprAppendMultiKeysymList((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); } +#line 695 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprAppendMultiKeysymList((yyvsp[-2].expr), (yyvsp[0].expr)); } +#line 2970 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 166: - -/* Line 1806 of yacc.c */ -#line 695 "parser.y" - { (yyval.expr) = ExprCreateKeysymList((yyvsp[(1) - (1)].keysym)); } +#line 697 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateKeysymList((yyvsp[0].keysym)); } +#line 2976 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 167: - -/* Line 1806 of yacc.c */ -#line 697 "parser.y" - { (yyval.expr) = ExprCreateMultiKeysymList((yyvsp[(1) - (1)].expr)); } +#line 699 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = ExprCreateMultiKeysymList((yyvsp[0].expr)); } +#line 2982 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 168: - -/* Line 1806 of yacc.c */ -#line 701 "parser.y" - { (yyval.expr) = (yyvsp[(2) - (3)].expr); } +#line 703 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.expr) = (yyvsp[-1].expr); } +#line 2988 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 169: - -/* Line 1806 of yacc.c */ -#line 705 "parser.y" +#line 707 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - if (!resolve_keysym((yyvsp[(1) - (1)].str), &(yyval.keysym))) - parser_warn(param, "unrecognized keysym"); - free((yyvsp[(1) - (1)].str)); + if (!resolve_keysym((yyvsp[0].str), &(yyval.keysym))) + parser_warn(param, "unrecognized keysym \"%s\"", (yyvsp[0].str)); + free((yyvsp[0].str)); } +#line 2998 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 170: - -/* Line 1806 of yacc.c */ -#line 710 "parser.y" +#line 712 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.keysym) = XKB_KEY_section; } +#line 3004 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 171: - -/* Line 1806 of yacc.c */ -#line 712 "parser.y" +#line 714 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { - if ((yyvsp[(1) - (1)].ival) < 0) { - parser_warn(param, "unrecognized keysym"); + if ((yyvsp[0].ival) < 0) { + parser_warn(param, "unrecognized keysym \"%d\"", (yyvsp[0].ival)); (yyval.keysym) = XKB_KEY_NoSymbol; } - else if ((yyvsp[(1) - (1)].ival) < 10) { /* XKB_KEY_0 .. XKB_KEY_9 */ - (yyval.keysym) = XKB_KEY_0 + (xkb_keysym_t) (yyvsp[(1) - (1)].ival); + else if ((yyvsp[0].ival) < 10) { /* XKB_KEY_0 .. XKB_KEY_9 */ + (yyval.keysym) = XKB_KEY_0 + (xkb_keysym_t) (yyvsp[0].ival); } else { char buf[17]; - snprintf(buf, sizeof(buf), "0x%x", (yyvsp[(1) - (1)].ival)); + snprintf(buf, sizeof(buf), "0x%x", (yyvsp[0].ival)); if (!resolve_keysym(buf, &(yyval.keysym))) { - parser_warn(param, "unrecognized keysym"); + parser_warn(param, "unrecognized keysym \"%s\"", buf); (yyval.keysym) = XKB_KEY_NoSymbol; } } } +#line 3026 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 172: - -/* Line 1806 of yacc.c */ -#line 731 "parser.y" - { (yyval.ival) = -(yyvsp[(2) - (2)].ival); } +#line 733 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.ival) = -(yyvsp[0].ival); } +#line 3032 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 173: - -/* Line 1806 of yacc.c */ -#line 732 "parser.y" - { (yyval.ival) = (yyvsp[(1) - (1)].ival); } +#line 734 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.ival) = (yyvsp[0].ival); } +#line 3038 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 174: - -/* Line 1806 of yacc.c */ -#line 735 "parser.y" - { (yyval.ival) = (yyvsp[(1) - (1)].num); } +#line 737 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.ival) = (yyvsp[0].num); } +#line 3044 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 175: - -/* Line 1806 of yacc.c */ -#line 736 "parser.y" - { (yyval.ival) = (yyvsp[(1) - (1)].num); } +#line 738 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.ival) = (yyvsp[0].num); } +#line 3050 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 176: - -/* Line 1806 of yacc.c */ -#line 739 "parser.y" +#line 741 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.ival) = 0; } +#line 3056 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 177: - -/* Line 1806 of yacc.c */ -#line 742 "parser.y" - { (yyval.ival) = (yyvsp[(1) - (1)].num); } +#line 744 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.ival) = (yyvsp[0].num); } +#line 3062 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 178: - -/* Line 1806 of yacc.c */ -#line 745 "parser.y" - { (yyval.num) = (yyvsp[(1) - (1)].num); } +#line 747 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.num) = (yyvsp[0].num); } +#line 3068 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 179: - -/* Line 1806 of yacc.c */ -#line 748 "parser.y" - { (yyval.sval) = xkb_atom_steal(param->ctx, (yyvsp[(1) - (1)].str)); } +#line 750 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_steal(param->ctx, (yyvsp[0].str)); } +#line 3074 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 180: - -/* Line 1806 of yacc.c */ -#line 749 "parser.y" - { (yyval.sval) = xkb_atom_intern_literal(param->ctx, "default"); } +#line 751 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_intern_literal(param->ctx, "default"); } +#line 3080 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 181: - -/* Line 1806 of yacc.c */ -#line 752 "parser.y" - { (yyval.sval) = xkb_atom_steal(param->ctx, (yyvsp[(1) - (1)].str)); } +#line 754 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.atom) = xkb_atom_steal(param->ctx, (yyvsp[0].str)); } +#line 3086 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 182: - -/* Line 1806 of yacc.c */ -#line 755 "parser.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); } +#line 757 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.str) = (yyvsp[0].str); } +#line 3092 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 183: - -/* Line 1806 of yacc.c */ -#line 756 "parser.y" +#line 758 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ { (yyval.str) = NULL; } +#line 3098 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; case 184: - -/* Line 1806 of yacc.c */ -#line 759 "parser.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); } +#line 761 "../src/xkbcomp/parser.y" /* yacc.c:1646 */ + { (yyval.str) = (yyvsp[0].str); } +#line 3104 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ break; - -/* Line 1806 of yacc.c */ -#line 3331 "src/xkbcomp/parser.c" +#line 3108 "xkbcommon-internal@sta/parser.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3349,7 +3126,7 @@ yyreduce: *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state + /* Now 'shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -3364,9 +3141,9 @@ yyreduce: goto yynewstate; -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -3417,20 +3194,20 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } else - { - yydestruct ("Error: discarding", - yytoken, &yylval, param); - yychar = YYEMPTY; - } + { + yydestruct ("Error: discarding", + yytoken, &yylval, param); + yychar = YYEMPTY; + } } /* Else will try to reuse lookahead token after shifting the error @@ -3449,7 +3226,7 @@ yyerrorlab: if (/*CONSTCOND*/ 0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -3462,35 +3239,37 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) - YYABORT; + YYABORT; yydestruct ("Error: popping", - yystos[yystate], yyvsp, param); + yystos[yystate], yyvsp, param); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END /* Shift the error token. */ @@ -3514,7 +3293,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined(yyoverflow) || YYERROR_VERBOSE +#if !defined yyoverflow || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -3533,14 +3312,14 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, param); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, param); + yystos[*yyssp], yyvsp, param); YYPOPSTACK (1); } #ifndef yyoverflow @@ -3551,14 +3330,9 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - - -/* Line 2067 of yacc.c */ -#line 762 "parser.y" +#line 764 "../src/xkbcomp/parser.y" /* yacc.c:1906 */ XkbFile * @@ -3569,6 +3343,8 @@ parse(struct xkb_context *ctx, struct scanner *scanner, const char *map) struct parser_param param = { .scanner = scanner, .ctx = ctx, + .rtrn = NULL, + .more_maps = false, }; /* @@ -3598,6 +3374,7 @@ parse(struct xkb_context *ctx, struct scanner *scanner, const char *map) FreeXkbFile(param.rtrn); } } + param.rtrn = NULL; } if (ret != 0) { @@ -3605,6 +3382,11 @@ parse(struct xkb_context *ctx, struct scanner *scanner, const char *map) return NULL; } + if (first) + log_vrb(ctx, 5, + "No map in include statement, but \"%s\" contains several; " + "Using first defined map, \"%s\"\n", + scanner->file_name, first->name); + return first; } - |