diff options
-rw-r--r-- | src/xkbcomp/ast-build.c | 8 | ||||
-rw-r--r-- | src/xkbcomp/ast-build.h | 3 | ||||
-rw-r--r-- | src/xkbcomp/ast.h | 7 | ||||
-rw-r--r-- | src/xkbcomp/parser.y | 10 |
4 files changed, 23 insertions, 5 deletions
diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c index eeef76a..452c3c5 100644 --- a/src/xkbcomp/ast-build.c +++ b/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); @@ -785,6 +792,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/xkbcomp/ast-build.h b/src/xkbcomp/ast-build.h index b57e4cd..6c76f38 100644 --- a/src/xkbcomp/ast-build.h +++ b/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/xkbcomp/ast.h b/src/xkbcomp/ast.h index 9778884..49c5ada 100644 --- a/src/xkbcomp/ast.h +++ b/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; diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y index 6e2a2de..296ce19 100644 --- a/src/xkbcomp/parser.y +++ b/src/xkbcomp/parser.y @@ -584,13 +584,13 @@ Element : ACTION_TOK | INDICATOR { $$ = xkb_atom_intern_literal(param->ctx, "indicator"); } | SHAPE - { $$ = XKB_ATOM_NONE; } + { $$ = xkb_atom_intern_literal(param->ctx, "shape"); } | ROW - { $$ = XKB_ATOM_NONE; } + { $$ = xkb_atom_intern_literal(param->ctx, "row"); } | SECTION - { $$ = XKB_ATOM_NONE; } + { $$ = xkb_atom_intern_literal(param->ctx, "section"); } | TEXT - { $$ = XKB_ATOM_NONE; } + { $$ = xkb_atom_intern_literal(param->ctx, "text"); } ; OptMergeMode : MergeMode { $$ = $1; } @@ -680,7 +680,7 @@ Terminal : String | Integer { $$ = ExprCreateInteger($1); } | Float - { $$ = NULL; } + { $$ = ExprCreateFloat(/* Discard $1 */); } | KEYNAME { $$ = ExprCreateKeyName($1); } ; |