diff options
author | Ran Benita <ran234@gmail.com> | 2013-11-30 22:25:39 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2013-11-30 22:28:13 +0200 |
commit | dbd8b1ef8dafa8ab84ca7090205241661ac01a45 (patch) | |
tree | 6e15f327b9f6a54d35dc126650bd22bcc00cdc70 /src | |
parent | 9dc5b8cb6097c5bfd61dbe6a17b59aa8fe9638e5 (diff) | |
download | libxkbcommon-dbd8b1ef8dafa8ab84ca7090205241661ac01a45.tar.gz libxkbcommon-dbd8b1ef8dafa8ab84ca7090205241661ac01a45.tar.bz2 libxkbcommon-dbd8b1ef8dafa8ab84ca7090205241661ac01a45.zip |
expr: add 'ident' value to ExprDef union
This distinguishes between an identifier expression and a string
expression in the union.
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/xkbcomp/action.c | 2 | ||||
-rw-r--r-- | src/xkbcomp/ast-build.c | 2 | ||||
-rw-r--r-- | src/xkbcomp/ast.h | 1 | ||||
-rw-r--r-- | src/xkbcomp/compat.c | 2 | ||||
-rw-r--r-- | src/xkbcomp/expr.c | 24 | ||||
-rw-r--r-- | src/xkbcomp/parser.y | 2 |
6 files changed, 17 insertions, 16 deletions
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c index 88323f9..3522dc8 100644 --- a/src/xkbcomp/action.c +++ b/src/xkbcomp/action.c @@ -267,7 +267,7 @@ CheckModifierField(struct xkb_keymap *keymap, enum xkb_action_type action, { if (value->op == EXPR_IDENT) { const char *valStr; - valStr = xkb_atom_text(keymap->ctx, value->value.str); + valStr = xkb_atom_text(keymap->ctx, value->value.ident); if (valStr && (istreq(valStr, "usemodmapmods") || istreq(valStr, "modmapmods"))) { diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c index 25172ee..29980aa 100644 --- a/src/xkbcomp/ast-build.c +++ b/src/xkbcomp/ast-build.c @@ -192,7 +192,7 @@ BoolVarCreate(xkb_atom_t nameToken, unsigned set) VarDef *def; name = ExprCreate(EXPR_IDENT, EXPR_TYPE_UNKNOWN); - name->value.str = nameToken; + name->value.ident = nameToken; value = ExprCreate(EXPR_VALUE, EXPR_TYPE_BOOLEAN); value->value.uval = set; def = VarCreate(name, value); diff --git a/src/xkbcomp/ast.h b/src/xkbcomp/ast.h index ed8831b..d94550f 100644 --- a/src/xkbcomp/ast.h +++ b/src/xkbcomp/ast.h @@ -186,6 +186,7 @@ typedef struct _Expr { darray(unsigned int) symsNumEntries; } list; struct _Expr *child; + xkb_atom_t ident; xkb_atom_t str; unsigned uval; int ival; diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c index 9e17cbb..0775a98 100644 --- a/src/xkbcomp/compat.c +++ b/src/xkbcomp/compat.c @@ -444,7 +444,7 @@ ResolveStateAndPredicate(ExprDef *expr, enum xkb_match_operation *pred_rtrn, } else if (expr->op == EXPR_IDENT) { const char *pred_txt = xkb_atom_text(info->keymap->ctx, - expr->value.str); + expr->value.ident); if (pred_txt && istreq(pred_txt, "any")) { *pred_rtrn = MATCH_ANY; *mods_rtrn = MOD_REAL_MASK_ALL; diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c index dc64d78..4d61609 100644 --- a/src/xkbcomp/expr.c +++ b/src/xkbcomp/expr.c @@ -40,7 +40,7 @@ ExprResolveLhs(struct xkb_context *ctx, const ExprDef *expr, switch (expr->op) { case EXPR_IDENT: *elem_rtrn = NULL; - *field_rtrn = xkb_atom_text(ctx, expr->value.str); + *field_rtrn = xkb_atom_text(ctx, expr->value.ident); *index_rtrn = NULL; return true; case EXPR_FIELD_REF: @@ -139,7 +139,7 @@ ExprResolveBoolean(struct xkb_context *ctx, const ExprDef *expr, return true; case EXPR_IDENT: - ident = xkb_atom_text(ctx, expr->value.str); + ident = xkb_atom_text(ctx, expr->value.ident); if (ident) { if (istreq(ident, "true") || istreq(ident, "yes") || @@ -155,7 +155,7 @@ ExprResolveBoolean(struct xkb_context *ctx, const ExprDef *expr, } } log_err(ctx, "Identifier \"%s\" of type boolean is unknown\n", - xkb_atom_text(ctx, expr->value.str)); + xkb_atom_text(ctx, expr->value.ident)); return false; case EXPR_FIELD_REF: @@ -298,11 +298,11 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, const ExprDef *expr, case EXPR_IDENT: if (lookup) - ok = lookup(ctx, lookupPriv, expr->value.str, EXPR_TYPE_INT, &u); + ok = lookup(ctx, lookupPriv, expr->value.ident, EXPR_TYPE_INT, &u); if (!ok) log_err(ctx, "Identifier \"%s\" of type int is unknown\n", - xkb_atom_text(ctx, expr->value.str)); + xkb_atom_text(ctx, expr->value.ident)); else *val_rtrn = (int) u; @@ -458,7 +458,7 @@ ExprResolveString(struct xkb_context *ctx, const ExprDef *expr, case EXPR_IDENT: log_err(ctx, "Identifier \"%s\" of type string not found\n", - xkb_atom_text(ctx, expr->value.str)); + xkb_atom_text(ctx, expr->value.ident)); return false; case EXPR_FIELD_REF: @@ -497,10 +497,10 @@ ExprResolveEnum(struct xkb_context *ctx, const ExprDef *expr, return false; } - if (!SimpleLookup(ctx, values, expr->value.str, EXPR_TYPE_INT, + if (!SimpleLookup(ctx, values, expr->value.ident, EXPR_TYPE_INT, val_rtrn)) { log_err(ctx, "Illegal identifier %s; expected one of:\n", - xkb_atom_text(ctx, expr->value.str)); + xkb_atom_text(ctx, expr->value.ident)); while (values && values->name) { log_err(ctx, "\t%s\n", values->name); @@ -535,11 +535,11 @@ ExprResolveMaskLookup(struct xkb_context *ctx, const ExprDef *expr, return true; case EXPR_IDENT: - ok = lookup(ctx, lookupPriv, expr->value.str, EXPR_TYPE_INT, + ok = lookup(ctx, lookupPriv, expr->value.ident, EXPR_TYPE_INT, val_rtrn); if (!ok) log_err(ctx, "Identifier \"%s\" of type int is unknown\n", - xkb_atom_text(ctx, expr->value.str)); + xkb_atom_text(ctx, expr->value.ident)); return ok; case EXPR_FIELD_REF: @@ -640,7 +640,7 @@ ExprResolveKeySym(struct xkb_context *ctx, const ExprDef *expr, if (expr->op == EXPR_IDENT) { const char *str; - str = xkb_atom_text(ctx, expr->value.str); + str = xkb_atom_text(ctx, expr->value.ident); *sym_rtrn = xkb_keysym_from_name(str, 0); if (*sym_rtrn != XKB_KEY_NoSymbol) return true; @@ -661,7 +661,7 @@ ExprResolveMod(struct xkb_keymap *keymap, const ExprDef *def, enum mod_type mod_type, xkb_mod_index_t *ndx_rtrn) { xkb_mod_index_t ndx; - xkb_atom_t name = def->value.str; + xkb_atom_t name = def->value.ident; if (def->op != EXPR_IDENT) { log_err(keymap->ctx, diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y index 01421fc..b48966d 100644 --- a/src/xkbcomp/parser.y +++ b/src/xkbcomp/parser.y @@ -669,7 +669,7 @@ Lhs : FieldSpec { ExprDef *expr; expr = ExprCreate(EXPR_IDENT, EXPR_TYPE_UNKNOWN); - expr->value.str = $1; + expr->value.ident = $1; $$ = expr; } | FieldSpec DOT FieldSpec |