Commit 724f62c8e3d1e7dd7ffa8e735e91c1d17488e36a

Ran Benita 2012-07-25T17:29:08

Convert defines to enums in xkbcomp.h For statement / expression types. Signed-off-by: Ran Benita <ran234@gmail.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c
index ebd859b..276129c 100644
--- a/src/xkbcomp/action.c
+++ b/src/xkbcomp/action.c
@@ -243,8 +243,7 @@ CheckModifierField(struct xkb_keymap *keymap, unsigned action, ExprDef *value,
                    unsigned *flags_inout, xkb_mod_mask_t *mods_rtrn)
 {
     ExprResult rtrn;
-
-    if (value->op == ExprIdent) {
+    if (value->op == EXPR_IDENT) {
         const char *valStr;
         valStr = xkb_atom_text(keymap->ctx, value->value.str);
         if (valStr && (istreq(valStr, "usemodmapmods") ||
@@ -338,7 +337,7 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action,
     ExprDef *spec;
     ExprResult rtrn;
 
-    if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) {
+    if (value->op == EXPR_NEGATE || value->op == EXPR_UNARY_PLUS) {
         *flags_inout &= ~XkbSA_GroupAbsolute;
         spec = value->value.child;
     }
@@ -350,9 +349,9 @@ CheckGroupField(struct xkb_keymap *keymap, unsigned action,
     if (!ExprResolveGroup(keymap->ctx, spec, &rtrn))
         return ReportMismatch(keymap, action, F_Group,
                               "integer (range 1..8)");
-    if (value->op == OpNegate)
+    if (value->op == EXPR_NEGATE)
         *grp_rtrn = -rtrn.ival;
-    else if (value->op == OpUnaryPlus)
+    else if (value->op == EXPR_UNARY_PLUS)
         *grp_rtrn = rtrn.ival;
     else
         *grp_rtrn = rtrn.ival - 1;
@@ -435,7 +434,7 @@ HandleMovePtr(struct xkb_keymap *keymap, struct xkb_any_action *action,
         return ReportActionNotArray(keymap, action->type, field);
 
     if ((field == F_X) || (field == F_Y)) {
-        if ((value->op == OpNegate) || (value->op == OpUnaryPlus))
+        if (value->op == EXPR_NEGATE || value->op == EXPR_UNARY_PLUS)
             absolute = false;
         else
             absolute = true;
@@ -550,7 +549,7 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
         ExprDef *btn;
         if (array_ndx != NULL)
             return ReportActionNotArray(keymap, action->type, field);
-        if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) {
+        if (value->op == EXPR_NEGATE || value->op == EXPR_UNARY_PLUS) {
             act->flags &= ~XkbSA_DfltBtnAbsolute;
             btn = value->value.child;
         }
@@ -574,10 +573,8 @@ HandleSetPtrDflt(struct xkb_keymap *keymap, struct xkb_any_action *action,
                     "Illegal default button setting ignored\n");
             return false;
         }
-        if (value->op == OpNegate)
-            act->value = -rtrn.ival;
-        else
-            act->value = rtrn.ival;
+
+        act->value = (value->op == EXPR_NEGATE ? -rtrn.ival : rtrn.ival);
         return true;
     }
     return ReportIllegal(keymap, action->type, field);
@@ -656,7 +653,7 @@ HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
         ExprDef *scrn;
         if (array_ndx != NULL)
             return ReportActionNotArray(keymap, action->type, field);
-        if ((value->op == OpNegate) || (value->op == OpUnaryPlus)) {
+        if (value->op == EXPR_NEGATE || value->op == EXPR_UNARY_PLUS) {
             act->flags &= ~XkbSA_SwitchAbsolute;
             scrn = value->value.child;
         }
@@ -674,7 +671,7 @@ HandleSwitchScreen(struct xkb_keymap *keymap, struct xkb_any_action *action,
                     "Illegal screen value %d ignored\n", rtrn.ival);
             return false;
         }
-        if (value->op == OpNegate)
+        if (value->op == EXPR_NEGATE)
             act->screen = -rtrn.ival;
         else
             act->screen = rtrn.ival;
@@ -1077,7 +1074,7 @@ HandleActionDef(ExprDef * def,
     if (!actionsInitialized)
         ActionsInit(keymap->ctx);
 
-    if (def->op != ExprActionDecl) {
+    if (def->op != EXPR_ACTION_DECL) {
         log_err(keymap->ctx, "Expected an action definition, found %s\n",
                 exprOpText(def->op));
         return false;
@@ -1114,12 +1111,12 @@ HandleActionDef(ExprDef * def,
         ExprResult elemRtrn, fieldRtrn;
         unsigned fieldNdx;
 
-        if (arg->op == OpAssign) {
+        if (arg->op == EXPR_ASSIGN) {
             field = arg->value.binary.left;
             value = arg->value.binary.right;
         }
         else {
-            if ((arg->op == OpNot) || (arg->op == OpInvert)) {
+            if (arg->op == EXPR_NOT || arg->op == EXPR_INVERT) {
                 field = arg->value.child;
                 constFalse.value.str = xkb_atom_intern(keymap->ctx, "false");
                 value = &constFalse;
@@ -1209,15 +1206,15 @@ ActionsInit(struct xkb_context *ctx)
     if (!actionsInitialized) {
         memset(&constTrue, 0, sizeof(constTrue));
         memset(&constFalse, 0, sizeof(constFalse));
-        constTrue.common.stmtType = StmtExpr;
+        constTrue.common.type = STMT_EXPR;
         constTrue.common.next = NULL;
-        constTrue.op = ExprIdent;
-        constTrue.type = TypeBoolean;
+        constTrue.op = EXPR_IDENT;
+        constTrue.value_type = EXPR_TYPE_BOOLEAN;
         constTrue.value.str = xkb_atom_intern(ctx, "true");
-        constFalse.common.stmtType = StmtExpr;
+        constFalse.common.type = STMT_EXPR;
         constFalse.common.next = NULL;
-        constFalse.op = ExprIdent;
-        constFalse.type = TypeBoolean;
+        constFalse.op = EXPR_IDENT;
+        constFalse.value_type = EXPR_TYPE_BOOLEAN;
         constFalse.value.str = xkb_atom_intern(ctx, "false");
         actionsInitialized = 1;
     }
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index de0377b..adbb446 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -377,7 +377,7 @@ ResolveStateAndPredicate(ExprDef * expr,
     }
 
     *pred_rtrn = XkbSI_Exactly;
-    if (expr->op == ExprActionDecl) {
+    if (expr->op == EXPR_ACTION_DECL) {
         const char *pred_txt = xkb_atom_text(info->keymap->ctx,
                                              expr->value.action.name);
         if (istreq(pred_txt, "noneof"))
@@ -397,7 +397,7 @@ ResolveStateAndPredicate(ExprDef * expr,
         }
         expr = expr->value.action.args;
     }
-    else if (expr->op == ExprIdent) {
+    else if (expr->op == EXPR_IDENT) {
         const char *pred_txt = xkb_atom_text(info->keymap->ctx,
                                              expr->value.str);
         if (pred_txt && istreq(pred_txt, "any")) {
@@ -595,7 +595,7 @@ HandleIncludeCompatMap(CompatInfo *info, IncludeStmt *stmt)
         stmt->stmt = NULL;
     }
 
-    for (; stmt; stmt = stmt->next) {
+    for (; stmt; stmt = stmt->next_incl) {
         if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_COMPAT,
                                 &rtrn, &merge)) {
             info->errorCount += 10;
@@ -899,7 +899,7 @@ HandleInterpBody(CompatInfo *info, VarDef *def, SymInterpInfo *si)
     ExprDef *arrayNdx;
 
     for (; def != NULL; def = (VarDef *) def->common.next) {
-        if ((def->name) && (def->name->op == ExprFieldRef)) {
+        if (def->name && def->name->op == EXPR_FIELD_REF) {
             ok = HandleInterpVar(info, def);
             continue;
         }
@@ -1036,33 +1036,33 @@ HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge)
     stmt = file->defs;
     while (stmt)
     {
-        switch (stmt->stmtType) {
-        case StmtInclude:
+        switch (stmt->type) {
+        case STMT_INCLUDE:
             if (!HandleIncludeCompatMap(info, (IncludeStmt *) stmt))
                 info->errorCount++;
             break;
-        case StmtInterpDef:
+        case STMT_INTERP:
             if (!HandleInterpDef(info, (InterpDef *) stmt, merge))
                 info->errorCount++;
             break;
-        case StmtGroupCompatDef:
+        case STMT_GROUP_COMPAT:
             if (!HandleGroupCompatDef(info, (GroupCompatDef *) stmt, merge))
                 info->errorCount++;
             break;
-        case StmtIndicatorMapDef:
+        case STMT_INDICATOR_MAP:
             if (!HandleIndicatorMapDef(info, (IndicatorMapDef *) stmt, merge))
                 info->errorCount++;
             break;
-        case StmtVarDef:
+        case STMT_VAR:
             if (!HandleInterpVar(info, (VarDef *) stmt))
                 info->errorCount++;
             break;
-        case StmtVModDef:
+        case STMT_VMOD:
             if (!HandleVModDef((VModDef *) stmt, info->keymap, merge,
                                &info->vmods))
                 info->errorCount++;
             break;
-        case StmtKeycodeDef:
+        case STMT_KEYCODE:
             log_err(info->keymap->ctx,
                     "Interpretation files may not include other types; "
                     "Ignoring definition of key name\n");
@@ -1071,7 +1071,7 @@ HandleCompatMapFile(CompatInfo *info, XkbFile *file, enum merge_mode merge)
         default:
             log_wsgo(info->keymap->ctx,
                      "Unexpected statement type %d in HandleCompatMapFile\n",
-                     stmt->stmtType);
+                     stmt->type);
             break;
         }
         stmt = stmt->next;
diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
index b12ff18..f4d77f5 100644
--- a/src/xkbcomp/expr.c
+++ b/src/xkbcomp/expr.c
@@ -27,92 +27,92 @@
 #include "expr.h"
 
 typedef bool (*IdentLookupFunc)(struct xkb_context *ctx, const void *priv,
-                                xkb_atom_t field, unsigned type,
+                                xkb_atom_t field, enum expr_value_type type,
                                 ExprResult *val_rtrn);
 
 const char *
-exprOpText(unsigned type)
+exprOpText(enum expr_op_type op)
 {
     static char buf[32];
 
-    switch (type) {
-    case ExprValue:
+    switch (op) {
+    case EXPR_VALUE:
         strcpy(buf, "literal");
         break;
-    case ExprIdent:
+    case EXPR_IDENT:
         strcpy(buf, "identifier");
         break;
-    case ExprActionDecl:
+    case EXPR_ACTION_DECL:
         strcpy(buf, "action declaration");
         break;
-    case ExprFieldRef:
+    case EXPR_FIELD_REF:
         strcpy(buf, "field reference");
         break;
-    case ExprArrayRef:
+    case EXPR_ARRAY_REF:
         strcpy(buf, "array reference");
         break;
-    case ExprKeysymList:
+    case EXPR_KEYSYM_LIST:
         strcpy(buf, "list of keysyms");
         break;
-    case ExprActionList:
+    case EXPR_ACTION_LIST:
         strcpy(buf, "list of actions");
         break;
-    case OpAdd:
+    case EXPR_ADD:
         strcpy(buf, "addition");
         break;
-    case OpSubtract:
+    case EXPR_SUBTRACT:
         strcpy(buf, "subtraction");
         break;
-    case OpMultiply:
+    case EXPR_MULTIPLY:
         strcpy(buf, "multiplication");
         break;
-    case OpDivide:
+    case EXPR_DIVIDE:
         strcpy(buf, "division");
         break;
-    case OpAssign:
+    case EXPR_ASSIGN:
         strcpy(buf, "assignment");
         break;
-    case OpNot:
+    case EXPR_NOT:
         strcpy(buf, "logical not");
         break;
-    case OpNegate:
+    case EXPR_NEGATE:
         strcpy(buf, "arithmetic negation");
         break;
-    case OpInvert:
+    case EXPR_INVERT:
         strcpy(buf, "bitwise inversion");
         break;
-    case OpUnaryPlus:
+    case EXPR_UNARY_PLUS:
         strcpy(buf, "unary plus");
         break;
     default:
-        snprintf(buf, sizeof(buf), "illegal(%d)", type);
+        snprintf(buf, sizeof(buf), "illegal(%d)", op);
         break;
     }
     return buf;
 }
 
 static const char *
-exprTypeText(unsigned type)
+exprValueTypeText(enum expr_value_type type)
 {
     static char buf[20];
 
     switch (type) {
-    case TypeUnknown:
+    case EXPR_TYPE_UNKNOWN:
         strcpy(buf, "unknown");
         break;
-    case TypeBoolean:
+    case EXPR_TYPE_BOOLEAN:
         strcpy(buf, "boolean");
         break;
-    case TypeInt:
+    case EXPR_TYPE_INT:
         strcpy(buf, "int");
         break;
-    case TypeString:
+    case EXPR_TYPE_STRING:
         strcpy(buf, "string");
         break;
-    case TypeAction:
+    case EXPR_TYPE_ACTION:
         strcpy(buf, "action");
         break;
-    case TypeKeyName:
+    case EXPR_TYPE_KEYNAME:
         strcpy(buf, "keyname");
         break;
     default:
@@ -130,21 +130,23 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
     struct xkb_context *ctx = keymap->ctx;
 
     switch (expr->op) {
-    case ExprIdent:
+    case EXPR_IDENT:
         elem_rtrn->str = NULL;
         field_rtrn->str = xkb_atom_text(ctx, expr->value.str);
         *index_rtrn = NULL;
         return true;
-    case ExprFieldRef:
+    case EXPR_FIELD_REF:
         elem_rtrn->str = xkb_atom_text(ctx, expr->value.field.element);
         field_rtrn->str = xkb_atom_text(ctx, expr->value.field.field);
         *index_rtrn = NULL;
         return true;
-    case ExprArrayRef:
+    case EXPR_ARRAY_REF:
         elem_rtrn->str = xkb_atom_text(ctx, expr->value.array.element);
         field_rtrn->str = xkb_atom_text(ctx, expr->value.array.field);
         *index_rtrn = expr->value.array.entry;
         return true;
+    default:
+        break;
     }
     log_wsgo(keymap->ctx, "Unexpected operator %d in ResolveLhs\n", expr->op);
     return false;
@@ -152,16 +154,17 @@ ExprResolveLhs(struct xkb_keymap *keymap, ExprDef *expr,
 
 static bool
 SimpleLookup(struct xkb_context *ctx, const void *priv,
-             xkb_atom_t field, unsigned type, ExprResult *val_rtrn)
+             xkb_atom_t field, enum expr_value_type type,
+             ExprResult *val_rtrn)
 {
     const LookupEntry *entry;
     const char *str;
 
-    if ((priv == NULL) || (field == XKB_ATOM_NONE) || (type != TypeInt))
+    if (!priv || field == XKB_ATOM_NONE || type != EXPR_TYPE_INT)
         return false;
 
     str = xkb_atom_text(ctx, field);
-    for (entry = priv; (entry != NULL) && (entry->name != NULL); entry++) {
+    for (entry = priv; entry && entry->name; entry++) {
         if (istreq(str, entry->name)) {
             val_rtrn->uval = entry->result;
             return true;
@@ -186,19 +189,19 @@ static const LookupEntry modIndexNames[] = {
 
 bool
 LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
-               unsigned type, ExprResult *val_rtrn)
+               enum expr_value_type type, ExprResult *val_rtrn)
 {
     return SimpleLookup(ctx, modIndexNames, field, type, val_rtrn);
 }
 
 bool
 LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
-              unsigned type, ExprResult *val_rtrn)
+              enum expr_value_type type, ExprResult *val_rtrn)
 {
     const char *str;
     bool ret = true;
 
-    if (type != TypeInt)
+    if (type != EXPR_TYPE_INT)
         return false;
     str = xkb_atom_text(ctx, field);
     if (str == NULL)
@@ -222,17 +225,17 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
     const char *ident;
 
     switch (expr->op) {
-    case ExprValue:
-        if (expr->type != TypeBoolean) {
+    case EXPR_VALUE:
+        if (expr->value_type != EXPR_TYPE_BOOLEAN) {
             log_err(ctx,
                     "Found constant of type %s where boolean was expected\n",
-                    exprTypeText(expr->type));
+                    exprValueTypeText(expr->value_type));
             return false;
         }
         val_rtrn->ival = expr->value.ival;
         return true;
 
-    case ExprIdent:
+    case EXPR_IDENT:
         ident = xkb_atom_text(ctx, expr->value.str);
         if (ident) {
             if (istreq(ident, "true") ||
@@ -252,25 +255,25 @@ ExprResolveBoolean(struct xkb_context *ctx, ExprDef *expr,
                 xkb_atom_text(ctx, expr->value.str));
         return false;
 
-    case ExprFieldRef:
+    case EXPR_FIELD_REF:
         log_err(ctx, "Default \"%s.%s\" of type boolean is unknown\n",
                 xkb_atom_text(ctx, expr->value.field.element),
                 xkb_atom_text(ctx, expr->value.field.field));
         return false;
 
-    case OpInvert:
-    case OpNot:
+    case EXPR_INVERT:
+    case EXPR_NOT:
         ok = ExprResolveBoolean(ctx, expr, val_rtrn);
         if (ok)
             val_rtrn->uval = !val_rtrn->uval;
         return ok;
-    case OpAdd:
-    case OpSubtract:
-    case OpMultiply:
-    case OpDivide:
-    case OpAssign:
-    case OpNegate:
-    case OpUnaryPlus:
+    case EXPR_ADD:
+    case EXPR_SUBTRACT:
+    case EXPR_MULTIPLY:
+    case EXPR_DIVIDE:
+    case EXPR_ASSIGN:
+    case EXPR_NEGATE:
+    case EXPR_UNARY_PLUS:
         log_err(ctx, "%s of boolean values not permitted\n",
                 exprOpText(expr->op));
         break;
@@ -290,48 +293,51 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
     ExprDef *left, *right;
 
     switch (expr->op) {
-    case ExprValue:
-        if (expr->type != TypeInt) {
+    case EXPR_VALUE:
+        if (expr->value_type != EXPR_TYPE_INT) {
             log_err(ctx,
                     "Found constant of type %s where an int was expected\n",
-                    exprTypeText(expr->type));
+                    exprValueTypeText(expr->value_type));
             return false;
         }
         val_rtrn->uval = expr->value.uval;
         return true;
 
-    case OpAdd:
-    case OpSubtract:
-    case OpMultiply:
-    case OpDivide:
+    case EXPR_ADD:
+    case EXPR_SUBTRACT:
+    case EXPR_MULTIPLY:
+    case EXPR_DIVIDE:
         left = expr->value.binary.left;
         right = expr->value.binary.right;
-        if (ExprResolveKeyCode(ctx, left, &leftRtrn) &&
-            ExprResolveKeyCode(ctx, right, &rightRtrn)) {
-            switch (expr->op) {
-            case OpAdd:
-                val_rtrn->uval = leftRtrn.uval + rightRtrn.uval;
-                break;
-            case OpSubtract:
-                val_rtrn->uval = leftRtrn.uval - rightRtrn.uval;
-                break;
-            case OpMultiply:
-                val_rtrn->uval = leftRtrn.uval * rightRtrn.uval;
-                break;
-            case OpDivide:
-                if (rightRtrn.uval == 0) {
-                    log_err(ctx, "Cannot divide by zero: %d / %d\n",
-                            leftRtrn.uval, rightRtrn.uval);
-                    return false;
-                }
-                val_rtrn->uval = leftRtrn.uval / rightRtrn.uval;
-                break;
+        if (!ExprResolveKeyCode(ctx, left, &leftRtrn) ||
+            !ExprResolveKeyCode(ctx, right, &rightRtrn))
+            return false;
+
+        switch (expr->op) {
+        case EXPR_ADD:
+            val_rtrn->uval = leftRtrn.uval + rightRtrn.uval;
+            break;
+        case EXPR_SUBTRACT:
+            val_rtrn->uval = leftRtrn.uval - rightRtrn.uval;
+            break;
+        case EXPR_MULTIPLY:
+            val_rtrn->uval = leftRtrn.uval * rightRtrn.uval;
+            break;
+        case EXPR_DIVIDE:
+            if (rightRtrn.uval == 0) {
+                log_err(ctx, "Cannot divide by zero: %d / %d\n",
+                        leftRtrn.uval, rightRtrn.uval);
+                return false;
             }
-            return true;
+            val_rtrn->uval = leftRtrn.uval / rightRtrn.uval;
+            break;
+        default:
+            break;
         }
-        return false;
 
-    case OpNegate:
+        return true;
+
+    case EXPR_NEGATE:
         left = expr->value.child;
         if (ExprResolveKeyCode(ctx, left, &leftRtrn)) {
             val_rtrn->uval = ~leftRtrn.uval;
@@ -339,7 +345,7 @@ ExprResolveKeyCode(struct xkb_context *ctx, ExprDef *expr,
         }
         return false;
 
-    case OpUnaryPlus:
+    case EXPR_UNARY_PLUS:
         left = expr->value.child;
         return ExprResolveKeyCode(ctx, left, val_rtrn);
 
@@ -374,8 +380,8 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
     ExprDef *left, *right;
 
     switch (expr->op) {
-    case ExprValue:
-        if (expr->type == TypeString) {
+    case EXPR_VALUE:
+        if (expr->value_type == EXPR_TYPE_STRING) {
             const char *str;
             str = xkb_atom_text(ctx, expr->value.str);
             if (str != NULL)
@@ -390,34 +396,34 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
                     break;
                 }
         }
-        if (expr->type != TypeInt) {
+        if (expr->value_type != EXPR_TYPE_INT) {
             log_err(ctx,
                     "Found constant of type %s where an int was expected\n",
-                    exprTypeText(expr->type));
+                    exprValueTypeText(expr->value_type));
             return false;
         }
         val_rtrn->ival = expr->value.ival;
         return true;
 
-    case ExprIdent:
+    case EXPR_IDENT:
         if (lookup)
             ok = lookup(ctx, lookupPriv, expr->value.str,
-                        TypeInt, val_rtrn);
+                        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));
         return ok;
 
-    case ExprFieldRef:
+    case EXPR_FIELD_REF:
         log_err(ctx, "Default \"%s.%s\" of type int is unknown\n",
                 xkb_atom_text(ctx, expr->value.field.element),
                 xkb_atom_text(ctx, expr->value.field.field));
         return false;
 
-    case OpAdd:
-    case OpSubtract:
-    case OpMultiply:
-    case OpDivide:
+    case EXPR_ADD:
+    case EXPR_SUBTRACT:
+    case EXPR_MULTIPLY:
+    case EXPR_DIVIDE:
         left = expr->value.binary.left;
         right = expr->value.binary.right;
         if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
@@ -425,16 +431,16 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
             ExprResolveIntegerLookup(ctx, right, &rightRtrn, lookup,
                                      lookupPriv)) {
             switch (expr->op) {
-            case OpAdd:
+            case EXPR_ADD:
                 val_rtrn->ival = leftRtrn.ival + rightRtrn.ival;
                 break;
-            case OpSubtract:
+            case EXPR_SUBTRACT:
                 val_rtrn->ival = leftRtrn.ival - rightRtrn.ival;
                 break;
-            case OpMultiply:
+            case EXPR_MULTIPLY:
                 val_rtrn->ival = leftRtrn.ival * rightRtrn.ival;
                 break;
-            case OpDivide:
+            case EXPR_DIVIDE:
                 if (rightRtrn.ival == 0) {
                     log_err(ctx, "Cannot divide by zero: %d / %d\n",
                             leftRtrn.ival, rightRtrn.ival);
@@ -442,25 +448,27 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
                 }
                 val_rtrn->ival = leftRtrn.ival / rightRtrn.ival;
                 break;
+            default:
+                break;
             }
             return true;
         }
         return false;
 
-    case OpAssign:
+    case EXPR_ASSIGN:
         log_wsgo(ctx, "Assignment operator not implemented yet\n");
         break;
 
-    case OpNot:
+    case EXPR_NOT:
         log_err(ctx, "The ! operator cannot be applied to an integer\n");
         return false;
 
-    case OpInvert:
-    case OpNegate:
+    case EXPR_INVERT:
+    case EXPR_NEGATE:
         left = expr->value.child;
         if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
                                      lookupPriv)) {
-            if (expr->op == OpNegate)
+            if (expr->op == EXPR_NEGATE)
                 val_rtrn->ival = -leftRtrn.ival;
             else
                 val_rtrn->ival = ~leftRtrn.ival;
@@ -468,7 +476,7 @@ ExprResolveIntegerLookup(struct xkb_context *ctx, ExprDef *expr,
         }
         return false;
 
-    case OpUnaryPlus:
+    case EXPR_UNARY_PLUS:
         left = expr->value.child;
         return ExprResolveIntegerLookup(ctx, left, val_rtrn, lookup,
                                         lookupPriv);
@@ -572,35 +580,35 @@ ExprResolveString(struct xkb_context *ctx, ExprDef *expr,
                   ExprResult *val_rtrn)
 {
     switch (expr->op) {
-    case ExprValue:
-        if (expr->type != TypeString) {
+    case EXPR_VALUE:
+        if (expr->value_type != EXPR_TYPE_STRING) {
             log_err(ctx, "Found constant of type %s, expected a string\n",
-                    exprTypeText(expr->type));
+                    exprValueTypeText(expr->value_type));
             return false;
         }
         val_rtrn->str = xkb_atom_text(ctx, expr->value.str);
         return true;
 
-    case ExprIdent:
+    case EXPR_IDENT:
         log_err(ctx, "Identifier \"%s\" of type string not found\n",
                 xkb_atom_text(ctx, expr->value.str));
         return false;
 
-    case ExprFieldRef:
+    case EXPR_FIELD_REF:
         log_err(ctx, "Default \"%s.%s\" of type string not found\n",
                 xkb_atom_text(ctx, expr->value.field.element),
                 xkb_atom_text(ctx, expr->value.field.field));
         return false;
 
-    case OpAdd:
-    case OpSubtract:
-    case OpMultiply:
-    case OpDivide:
-    case OpAssign:
-    case OpNegate:
-    case OpInvert:
-    case OpNot:
-    case OpUnaryPlus:
+    case EXPR_ADD:
+    case EXPR_SUBTRACT:
+    case EXPR_MULTIPLY:
+    case EXPR_DIVIDE:
+    case EXPR_ASSIGN:
+    case EXPR_NEGATE:
+    case EXPR_INVERT:
+    case EXPR_NOT:
+    case EXPR_UNARY_PLUS:
         log_err(ctx, "%s of strings not permitted\n", exprOpText(expr->op));
         return false;
 
@@ -616,35 +624,35 @@ ExprResolveKeyName(struct xkb_context *ctx, ExprDef *expr,
                    ExprResult *val_rtrn)
 {
     switch (expr->op) {
-    case ExprValue:
-        if (expr->type != TypeKeyName) {
+    case EXPR_VALUE:
+        if (expr->value_type != EXPR_TYPE_KEYNAME) {
             log_err(ctx, "Found constant of type %s, expected a key name\n",
-                    exprTypeText(expr->type));
+                    exprValueTypeText(expr->value_type));
             return false;
         }
         memcpy(val_rtrn->name, expr->value.keyName, XkbKeyNameLength);
         return true;
 
-    case ExprIdent:
+    case EXPR_IDENT:
         log_err(ctx, "Identifier \"%s\" of type string not found\n",
                 xkb_atom_text(ctx, expr->value.str));
         return false;
 
-    case ExprFieldRef:
+    case EXPR_FIELD_REF:
         log_err(ctx, "Default \"%s.%s\" of type key name not found\n",
                 xkb_atom_text(ctx, expr->value.field.element),
                 xkb_atom_text(ctx, expr->value.field.field));
         return false;
 
-    case OpAdd:
-    case OpSubtract:
-    case OpMultiply:
-    case OpDivide:
-    case OpAssign:
-    case OpNegate:
-    case OpInvert:
-    case OpNot:
-    case OpUnaryPlus:
+    case EXPR_ADD:
+    case EXPR_SUBTRACT:
+    case EXPR_MULTIPLY:
+    case EXPR_DIVIDE:
+    case EXPR_ASSIGN:
+    case EXPR_NEGATE:
+    case EXPR_INVERT:
+    case EXPR_NOT:
+    case EXPR_UNARY_PLUS:
         log_err(ctx, "%s of key name values not permitted\n",
                 exprOpText(expr->op));
         return false;
@@ -662,12 +670,13 @@ int
 ExprResolveEnum(struct xkb_context *ctx, ExprDef *expr,
                 ExprResult *val_rtrn, const LookupEntry *values)
 {
-    if (expr->op != ExprIdent) {
+    if (expr->op != EXPR_IDENT) {
         log_err(ctx, "Found a %s where an enumerated value was expected\n",
                 exprOpText(expr->op));
         return false;
     }
-    if (!SimpleLookup(ctx, values, expr->value.str, TypeInt, val_rtrn)) {
+    if (!SimpleLookup(ctx, values, expr->value.str, EXPR_TYPE_INT,
+                      val_rtrn)) {
         int nOut = 0;
         log_err(ctx, "Illegal identifier %s (expected one of: ",
                 xkb_atom_text(ctx, expr->value.str));
@@ -697,33 +706,33 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
     const char *bogus = NULL;
 
     switch (expr->op) {
-    case ExprValue:
-        if (expr->type != TypeInt) {
+    case EXPR_VALUE:
+        if (expr->value_type != EXPR_TYPE_INT) {
             log_err(ctx,
                     "Found constant of type %s where a mask was expected\n",
-                    exprTypeText(expr->type));
+                    exprValueTypeText(expr->value_type));
             return false;
         }
         val_rtrn->ival = expr->value.ival;
         return true;
 
-    case ExprIdent:
-        ok = lookup(ctx, lookupPriv, expr->value.str, TypeInt, val_rtrn);
+    case EXPR_IDENT:
+        ok = lookup(ctx, lookupPriv, expr->value.str, 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));
         return ok;
 
-    case ExprFieldRef:
+    case EXPR_FIELD_REF:
         log_err(ctx, "Default \"%s.%s\" of type int is unknown\n",
                 xkb_atom_text(ctx, expr->value.field.element),
                 xkb_atom_text(ctx, expr->value.field.field));
         return false;
 
-    case ExprArrayRef:
+    case EXPR_ARRAY_REF:
         bogus = "array reference";
 
-    case ExprActionDecl:
+    case EXPR_ACTION_DECL:
         if (bogus == NULL)
             bogus = "function use";
         log_err(ctx,
@@ -731,10 +740,10 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
                 bogus);
         return false;
 
-    case OpAdd:
-    case OpSubtract:
-    case OpMultiply:
-    case OpDivide:
+    case EXPR_ADD:
+    case EXPR_SUBTRACT:
+    case EXPR_MULTIPLY:
+    case EXPR_DIVIDE:
         left = expr->value.binary.left;
         right = expr->value.binary.right;
         if (ExprResolveMaskLookup(ctx, left, &leftRtrn, lookup,
@@ -742,27 +751,29 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
             ExprResolveMaskLookup(ctx, right, &rightRtrn, lookup,
                                   lookupPriv)) {
             switch (expr->op) {
-            case OpAdd:
+            case EXPR_ADD:
                 val_rtrn->ival = leftRtrn.ival | rightRtrn.ival;
                 break;
-            case OpSubtract:
+            case EXPR_SUBTRACT:
                 val_rtrn->ival = leftRtrn.ival & (~rightRtrn.ival);
                 break;
-            case OpMultiply:
-            case OpDivide:
+            case EXPR_MULTIPLY:
+            case EXPR_DIVIDE:
                 log_err(ctx, "Cannot %s masks; Illegal operation ignored\n",
-                        (expr->op == OpDivide ? "divide" : "multiply"));
+                        (expr->op == EXPR_DIVIDE ? "divide" : "multiply"));
                 return false;
+            default:
+                break;
             }
             return true;
         }
         return false;
 
-    case OpAssign:
+    case EXPR_ASSIGN:
         log_wsgo(ctx, "Assignment operator not implemented yet\n");
         break;
 
-    case OpInvert:
+    case EXPR_INVERT:
         left = expr->value.child;
         if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
                                      lookupPriv)) {
@@ -771,14 +782,14 @@ ExprResolveMaskLookup(struct xkb_context *ctx, ExprDef *expr,
         }
         return false;
 
-    case OpUnaryPlus:
-    case OpNegate:
-    case OpNot:
+    case EXPR_UNARY_PLUS:
+    case EXPR_NEGATE:
+    case EXPR_NOT:
         left = expr->value.child;
         if (ExprResolveIntegerLookup(ctx, left, &leftRtrn, lookup,
                                      lookupPriv)) {
             log_err(ctx, "The %s operator cannot be used with a mask\n",
-                    (expr->op == OpNegate ? "-" : "!"));
+                    (expr->op == EXPR_NEGATE ? "-" : "!"));
         }
         return false;
 
@@ -818,7 +829,7 @@ ExprResolveKeySym(struct xkb_context *ctx, ExprDef *expr,
     int ok = 0;
     xkb_keysym_t sym;
 
-    if (expr->op == ExprIdent) {
+    if (expr->op == EXPR_IDENT) {
         const char *str;
         str = xkb_atom_text(ctx, expr->value.str);
         if (str) {
diff --git a/src/xkbcomp/expr.h b/src/xkbcomp/expr.h
index 5e51a70..174c1c8 100644
--- a/src/xkbcomp/expr.h
+++ b/src/xkbcomp/expr.h
@@ -47,22 +47,19 @@ typedef struct _LookupEntry {
 } LookupEntry;
 
 extern const char *
-exprOpText(unsigned type);
+exprOpText(enum expr_op_type op);
 
 extern bool
 LookupModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
-              unsigned type,
-              ExprResult *val_rtrn);
+              enum expr_value_type type, ExprResult *val_rtrn);
 
 extern bool
 LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
-               unsigned type,
-               ExprResult *val_rtrn);
+               enum expr_value_type type, ExprResult *val_rtrn);
 
 extern bool
 LookupModIndex(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
-               unsigned type,
-               ExprResult *val_rtrn);
+               enum expr_value_type type, ExprResult *val_rtrn);
 
 extern int
 ExprResolveModMask(struct xkb_context *ctx, ExprDef *expr,
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 319fa27..5db85dd 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -477,7 +477,7 @@ HandleIncludeKeycodes(KeyNamesInfo *info, IncludeStmt *stmt)
         stmt->stmt = NULL;
     }
 
-    for (; stmt; stmt = stmt->next) {
+    for (; stmt; stmt = stmt->next_incl) {
         if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_KEYCODES,
                                 &rtrn, &merge)) {
             info->errorCount += 10;
@@ -749,42 +749,42 @@ HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge)
     stmt = file->defs;
     while (stmt)
     {
-        switch (stmt->stmtType) {
-        case StmtInclude:    /* e.g. include "evdev+aliases(qwerty)" */
+        switch (stmt->type) {
+        case STMT_INCLUDE:    /* e.g. include "evdev+aliases(qwerty)" */
             if (!HandleIncludeKeycodes(info, (IncludeStmt *) stmt))
                 info->errorCount++;
             break;
-        case StmtKeycodeDef: /* e.g. <ESC> = 9; */
+        case STMT_KEYCODE: /* e.g. <ESC> = 9; */
             if (!HandleKeycodeDef(info, (KeycodeDef *) stmt, merge))
                 info->errorCount++;
             break;
-        case StmtKeyAliasDef: /* e.g. alias <MENU> = <COMP>; */
+        case STMT_ALIAS: /* e.g. alias <MENU> = <COMP>; */
             if (!HandleAliasDef(info, (KeyAliasDef *) stmt, merge,
                                 info->file_id))
                 info->errorCount++;
             break;
-        case StmtVarDef: /* e.g. minimum, maximum */
+        case STMT_VAR: /* e.g. minimum, maximum */
             if (!HandleKeyNameVar(info, (VarDef *) stmt))
                 info->errorCount++;
             break;
-        case StmtIndicatorNameDef: /* e.g. indicator 1 = "Caps Lock"; */
+        case STMT_INDICATOR_NAME: /* e.g. indicator 1 = "Caps Lock"; */
             if (!HandleIndicatorNameDef(info, (IndicatorNameDef *) stmt,
                                         merge))
                 info->errorCount++;
             break;
-        case StmtInterpDef:
-        case StmtVModDef:
+        case STMT_INTERP:
+        case STMT_VMOD:
             log_err(info->keymap->ctx,
                     "Keycode files may define key and indicator names only; "
                     "Ignoring definition of %s\n",
-                    (stmt->stmtType == StmtInterpDef ?
+                    (stmt->type == STMT_INTERP ?
                      "a symbol interpretation" : "virtual modifiers"));
             info->errorCount++;
             break;
         default:
             log_wsgo(info->keymap->ctx,
                      "Unexpected statement type %d in HandleKeycodesFile\n",
-                     stmt->stmtType);
+                     stmt->type);
             break;
         }
         stmt = stmt->next;
diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c
index 67dc9a0..448e925 100644
--- a/src/xkbcomp/keytypes.c
+++ b/src/xkbcomp/keytypes.c
@@ -361,7 +361,7 @@ HandleIncludeKeyTypes(KeyTypesInfo *info, IncludeStmt *stmt)
         stmt->stmt = NULL;
     }
 
-    for (; stmt; stmt = stmt->next) {
+    for (; stmt; stmt = stmt->next_incl) {
         if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_TYPES,
                                 &rtrn, &merge)) {
             info->errorCount += 10;
@@ -781,8 +781,8 @@ HandleKeyTypeBody(KeyTypesInfo *info, VarDef *def, KeyTypeInfo *type)
     ExprResult tmp, field;
     ExprDef *arrayNdx;
 
-    for (; def != NULL; def = (VarDef *) def->common.next) {
-        if ((def->name) && (def->name->op == ExprFieldRef)) {
+    for (; def; def = (VarDef *) def->common.next) {
+        if (def->name && def->name->op == EXPR_FIELD_REF) {
             ok = HandleKeyTypeVar(info, def);
             continue;
         }
@@ -874,37 +874,37 @@ HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge)
     stmt = file->defs;
     while (stmt)
     {
-        switch (stmt->stmtType) {
-        case StmtInclude:
+        switch (stmt->type) {
+        case STMT_INCLUDE:
             if (!HandleIncludeKeyTypes(info, (IncludeStmt *) stmt))
                 info->errorCount++;
             break;
-        case StmtKeyTypeDef: /* e.g. type "ONE_LEVEL" */
+        case STMT_TYPE: /* e.g. type "ONE_LEVEL" */
             if (!HandleKeyTypeDef(info, (KeyTypeDef *) stmt, merge))
                 info->errorCount++;
             break;
-        case StmtVarDef:
+        case STMT_VAR:
             if (!HandleKeyTypeVar(info, (VarDef *) stmt))
                 info->errorCount++;
             break;
-        case StmtVModDef: /* virtual_modifiers NumLock, ... */
+        case STMT_VMOD: /* virtual_modifiers NumLock, ... */
             if (!HandleVModDef((VModDef *) stmt, info->keymap, merge,
                                &info->vmods))
                 info->errorCount++;
             break;
-        case StmtKeyAliasDef:
+        case STMT_ALIAS:
             log_err(info->keymap->ctx,
                     "Key type files may not include other declarations; "
                     "Ignoring definition of key alias\n");
             info->errorCount++;
             break;
-        case StmtKeycodeDef:
+        case STMT_KEYCODE:
             log_err(info->keymap->ctx,
                     "Key type files may not include other declarations; "
                     "Ignoring definition of key name\n");
             info->errorCount++;
             break;
-        case StmtInterpDef:
+        case STMT_INTERP:
             log_err(info->keymap->ctx,
                     "Key type files may not include other declarations; "
                     "Ignoring definition of symbol interpretation\n");
@@ -913,7 +913,7 @@ HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge)
         default:
             log_wsgo(info->keymap->ctx,
                      "Unexpected statement type %d in HandleKeyTypesFile\n",
-                     stmt->stmtType);
+                     stmt->type);
             break;
         }
         stmt = stmt->next;
diff --git a/src/xkbcomp/misc.c b/src/xkbcomp/misc.c
index ed16e54..4742a4e 100644
--- a/src/xkbcomp/misc.c
+++ b/src/xkbcomp/misc.c
@@ -71,7 +71,7 @@ ProcessIncludeFile(struct xkb_context *ctx,
             next = (XkbFile *) mapToUse->common.next;
             mapToUse->common.next = NULL;
             if (streq(mapToUse->name, stmt->map) &&
-                mapToUse->type == file_type) {
+                mapToUse->file_type == file_type) {
                 FreeXKBFile(next);
                 break;
             }
@@ -92,11 +92,11 @@ ProcessIncludeFile(struct xkb_context *ctx,
                 "Using first defined map, \"%s\"\n",
                 stmt->file, rtrn->name);
     }
-    if (mapToUse->type != file_type) {
+    if (mapToUse->file_type != file_type) {
         log_err(ctx,
                 "Include file wrong type (expected %s, got %s); "
                 "Include file \"%s\" ignored\n",
-                FileTypeText(file_type), FileTypeText(mapToUse->type),
+                FileTypeText(file_type), FileTypeText(mapToUse->file_type),
                 stmt->file);
         return false;
     }
diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y
index 2c050ab..3c1fb37 100644
--- a/src/xkbcomp/parser.y
+++ b/src/xkbcomp/parser.y
@@ -435,7 +435,7 @@ SymbolsVarDecl	:	Lhs EQUALS Expr
 ArrayInit	:	OBRACKET OptKeySymList CBRACKET
 			{ $$= $2; }
 		|	OBRACKET ActionList CBRACKET
-			{ $$= ExprCreateUnary(ExprActionList,TypeAction,$2); }
+			{ $$= ExprCreateUnary(EXPR_ACTION_LIST, EXPR_TYPE_ACTION, $2); }
 		;
 
 GroupCompatDecl	:	GROUP Integer EQUALS Expr SEMI
@@ -613,27 +613,27 @@ ExprList	:	ExprList COMMA Expr
 		;
 
 Expr		:	Expr DIVIDE Expr
-			{ $$= ExprCreateBinary(OpDivide,$1,$3); }
+			{ $$= ExprCreateBinary(EXPR_DIVIDE,$1,$3); }
 		|	Expr PLUS Expr
-			{ $$= ExprCreateBinary(OpAdd,$1,$3); }
+			{ $$= ExprCreateBinary(EXPR_ADD,$1,$3); }
 		|	Expr MINUS Expr
-			{ $$= ExprCreateBinary(OpSubtract,$1,$3); }
+			{ $$= ExprCreateBinary(EXPR_SUBTRACT,$1,$3); }
 		|	Expr TIMES Expr
-			{ $$= ExprCreateBinary(OpMultiply,$1,$3); }
+			{ $$= ExprCreateBinary(EXPR_MULTIPLY,$1,$3); }
 		|	Lhs EQUALS Expr
-			{ $$= ExprCreateBinary(OpAssign,$1,$3); }
+			{ $$= ExprCreateBinary(EXPR_ASSIGN,$1,$3); }
 		|	Term
 			{ $$= $1; }
 		;
 
 Term		:	MINUS Term
-			{ $$= ExprCreateUnary(OpNegate,$2->type,$2); }
+			{ $$= ExprCreateUnary(EXPR_NEGATE,$2->value_type,$2); }
 		|	PLUS Term
-			{ $$= ExprCreateUnary(OpUnaryPlus,$2->type,$2); }
+			{ $$= ExprCreateUnary(EXPR_UNARY_PLUS,$2->value_type,$2); }
 		|	EXCLAM Term
-			{ $$= ExprCreateUnary(OpNot,TypeBoolean,$2); }
+			{ $$= ExprCreateUnary(EXPR_NOT,EXPR_TYPE_BOOLEAN,$2); }
 		|	INVERT Term
-			{ $$= ExprCreateUnary(OpInvert,$2->type,$2); }
+			{ $$= ExprCreateUnary(EXPR_INVERT,$2->value_type,$2); }
 		|	Lhs
 			{ $$= $1;  }
 		|	FieldSpec OPAREN OptExprList CPAREN %prec OPAREN
@@ -657,14 +657,14 @@ Action		:	FieldSpec OPAREN OptExprList CPAREN
 Lhs		:	FieldSpec
 			{
 			    ExprDef *expr;
-                            expr= ExprCreate(ExprIdent,TypeUnknown);
+                            expr= ExprCreate(EXPR_IDENT, EXPR_TYPE_UNKNOWN);
                             expr->value.str= $1;
                             $$= expr;
 			}
 		|	FieldSpec DOT FieldSpec
                         {
                             ExprDef *expr;
-                            expr= ExprCreate(ExprFieldRef,TypeUnknown);
+                            expr= ExprCreate(EXPR_FIELD_REF,EXPR_TYPE_UNKNOWN);
                             expr->value.field.element= $1;
                             expr->value.field.field= $3;
                             $$= expr;
@@ -672,7 +672,7 @@ Lhs		:	FieldSpec
 		|	FieldSpec OBRACKET Expr CBRACKET
 			{
 			    ExprDef *expr;
-			    expr= ExprCreate(ExprArrayRef,TypeUnknown);
+			    expr= ExprCreate(EXPR_ARRAY_REF,EXPR_TYPE_UNKNOWN);
 			    expr->value.array.element= XKB_ATOM_NONE;
 			    expr->value.array.field= $1;
 			    expr->value.array.entry= $3;
@@ -681,7 +681,7 @@ Lhs		:	FieldSpec
 		|	FieldSpec DOT FieldSpec OBRACKET Expr CBRACKET
 			{
 			    ExprDef *expr;
-			    expr= ExprCreate(ExprArrayRef,TypeUnknown);
+			    expr= ExprCreate(EXPR_ARRAY_REF,EXPR_TYPE_UNKNOWN);
 			    expr->value.array.element= $1;
 			    expr->value.array.field= $3;
 			    expr->value.array.entry= $5;
@@ -692,14 +692,14 @@ Lhs		:	FieldSpec
 Terminal	:	String
 			{
 			    ExprDef *expr;
-                            expr= ExprCreate(ExprValue,TypeString);
+                            expr= ExprCreate(EXPR_VALUE,EXPR_TYPE_STRING);
                             expr->value.str= $1;
                             $$= expr;
 			}
 		|	Integer
 			{
 			    ExprDef *expr;
-                            expr= ExprCreate(ExprValue,TypeInt);
+                            expr= ExprCreate(EXPR_VALUE,EXPR_TYPE_INT);
                             expr->value.ival= $1;
                             $$= expr;
 			}
@@ -710,7 +710,7 @@ Terminal	:	String
 		|	KeyName
 			{
 			    ExprDef *expr;
-			    expr= ExprCreate(ExprValue,TypeKeyName);
+			    expr= ExprCreate(EXPR_VALUE,EXPR_TYPE_KEYNAME);
 			    strncpy(expr->value.keyName,$1,4);
 			    $$= expr;
 			}
diff --git a/src/xkbcomp/parseutils.c b/src/xkbcomp/parseutils.c
index bcfde1a..2eb119b 100644
--- a/src/xkbcomp/parseutils.c
+++ b/src/xkbcomp/parseutils.c
@@ -57,49 +57,51 @@ AppendStmt(ParseCommon * to, ParseCommon * append)
 }
 
 ExprDef *
-ExprCreate(unsigned op, unsigned type)
+ExprCreate(enum expr_op_type op, enum expr_value_type type)
 {
     ExprDef *expr;
 
     expr = malloc_or_die(sizeof(*expr));
 
-    expr->common.stmtType = StmtExpr;
+    expr->common.type = STMT_EXPR;
     expr->common.next = NULL;
     expr->op = op;
-    expr->type = type;
+    expr->value_type = type;
     return expr;
 }
 
 ExprDef *
-ExprCreateUnary(unsigned op, unsigned type, ExprDef * child)
+ExprCreateUnary(enum expr_op_type op, enum expr_value_type type,
+                ExprDef *child)
 {
     ExprDef *expr;
     expr = malloc_or_die(sizeof(*expr));
 
-    expr->common.stmtType = StmtExpr;
+    expr->common.type = STMT_EXPR;
     expr->common.next = NULL;
     expr->op = op;
-    expr->type = type;
+    expr->value_type = type;
     expr->value.child = child;
     return expr;
 }
 
 ExprDef *
-ExprCreateBinary(unsigned op, ExprDef * left, ExprDef * right)
+ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right)
 {
     ExprDef *expr;
 
     expr = malloc_or_die(sizeof(*expr));
 
-    expr->common.stmtType = StmtExpr;
+    expr->common.type = STMT_EXPR;
     expr->common.next = NULL;
     expr->op = op;
-    if ((op == OpAssign) || (left->type == TypeUnknown))
-        expr->type = right->type;
-    else if ((left->type == right->type) || (right->type == TypeUnknown))
-        expr->type = left->type;
+    if (op == EXPR_ASSIGN || left->value_type == EXPR_TYPE_UNKNOWN)
+        expr->value_type = right->value_type;
+    else if (left->value_type == right->value_type ||
+             right->value_type == EXPR_TYPE_UNKNOWN)
+        expr->value_type = left->value_type;
     else
-        expr->type = TypeUnknown;
+        expr->value_type = EXPR_TYPE_UNKNOWN;
     expr->value.binary.left = left;
     expr->value.binary.right = right;
     return expr;
@@ -112,7 +114,7 @@ KeycodeCreate(char keyName[XkbKeyNameLength], unsigned long value)
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtKeycodeDef;
+    def->common.type = STMT_KEYCODE;
     def->common.next = NULL;
     strncpy(def->name, keyName, XkbKeyNameLength);
     def->name[XkbKeyNameLength] = '\0';
@@ -127,7 +129,7 @@ KeyAliasCreate(char alias[XkbKeyNameLength], char real[XkbKeyNameLength])
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtKeyAliasDef;
+    def->common.type = STMT_ALIAS;
     def->common.next = NULL;
     strncpy(def->alias, alias, XkbKeyNameLength);
     def->alias[XkbKeyNameLength] = '\0';
@@ -143,7 +145,7 @@ VModCreate(xkb_atom_t name, ExprDef * value)
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtVModDef;
+    def->common.type = STMT_VMOD;
     def->common.next = NULL;
     def->name = name;
     def->value = value;
@@ -156,7 +158,7 @@ VarCreate(ExprDef * name, ExprDef * value)
     VarDef *def;
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtVarDef;
+    def->common.type = STMT_VAR;
     def->common.next = NULL;
     def->name = name;
     def->value = value;
@@ -168,9 +170,9 @@ BoolVarCreate(xkb_atom_t nameToken, unsigned set)
 {
     ExprDef *name, *value;
 
-    name = ExprCreate(ExprIdent, TypeUnknown);
+    name = ExprCreate(EXPR_IDENT, EXPR_TYPE_UNKNOWN);
     name->value.str = nameToken;
-    value = ExprCreate(ExprValue, TypeBoolean);
+    value = ExprCreate(EXPR_VALUE, EXPR_TYPE_BOOLEAN);
     value->value.uval = set;
     return VarCreate(name, value);
 }
@@ -182,7 +184,7 @@ InterpCreate(char *sym, ExprDef * match)
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtInterpDef;
+    def->common.type = STMT_INTERP;
     def->common.next = NULL;
     def->sym = sym;
     def->match = match;
@@ -196,7 +198,7 @@ KeyTypeCreate(xkb_atom_t name, VarDef * body)
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtKeyTypeDef;
+    def->common.type = STMT_TYPE;
     def->common.next = NULL;
     def->merge = MERGE_DEFAULT;
     def->name = name;
@@ -211,7 +213,7 @@ SymbolsCreate(char keyName[XkbKeyNameLength], ExprDef *symbols)
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtSymbolsDef;
+    def->common.type = STMT_SYMBOLS;
     def->common.next = NULL;
     def->merge = MERGE_DEFAULT;
     strncpy(def->keyName, keyName, XkbKeyNameLength);
@@ -226,7 +228,7 @@ GroupCompatCreate(int group, ExprDef * val)
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtGroupCompatDef;
+    def->common.type = STMT_GROUP_COMPAT;
     def->common.next = NULL;
     def->merge = MERGE_DEFAULT;
     def->group = group;
@@ -241,7 +243,7 @@ ModMapCreate(uint32_t modifier, ExprDef * keys)
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtModMapDef;
+    def->common.type = STMT_MODMAP;
     def->common.next = NULL;
     def->merge = MERGE_DEFAULT;
     def->modifier = modifier;
@@ -256,7 +258,7 @@ IndicatorMapCreate(xkb_atom_t name, VarDef * body)
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtIndicatorMapDef;
+    def->common.type = STMT_INDICATOR_MAP;
     def->common.next = NULL;
     def->merge = MERGE_DEFAULT;
     def->name = name;
@@ -271,7 +273,7 @@ IndicatorNameCreate(int ndx, ExprDef * name, bool virtual)
 
     def = malloc_or_die(sizeof(*def));
 
-    def->common.stmtType = StmtIndicatorNameDef;
+    def->common.type = STMT_INDICATOR_NAME;
     def->common.next = NULL;
     def->merge = MERGE_DEFAULT;
     def->ndx = ndx;
@@ -287,9 +289,9 @@ ActionCreate(xkb_atom_t name, ExprDef * args)
 
     act = malloc_or_die(sizeof(*act));
 
-    act->common.stmtType = StmtExpr;
+    act->common.type = STMT_EXPR;
     act->common.next = NULL;
-    act->op = ExprActionDecl;
+    act->op = EXPR_ACTION_DECL;
     act->value.action.name = name;
     act->value.action.args = args;
     return act;
@@ -300,7 +302,7 @@ CreateKeysymList(char *sym)
 {
     ExprDef *def;
 
-    def = ExprCreate(ExprKeysymList, TypeSymbols);
+    def = ExprCreate(EXPR_KEYSYM_LIST, EXPR_TYPE_SYMBOLS);
 
     darray_init(def->value.list.syms);
     darray_init(def->value.list.symsMapIndex);
@@ -402,8 +404,8 @@ IncludeCreate(struct xkb_context *ctx, char *str, enum merge_mode merge)
         if (first == NULL) {
             first = incl = malloc(sizeof(*first));
         } else {
-            incl->next = malloc(sizeof(*first));
-            incl = incl->next;
+            incl->next_incl = malloc(sizeof(*first));
+            incl = incl->next_incl;
         }
 
         if (!incl) {
@@ -413,7 +415,7 @@ IncludeCreate(struct xkb_context *ctx, char *str, enum merge_mode merge)
             break;
         }
 
-        incl->common.stmtType = StmtInclude;
+        incl->common.type = STMT_INCLUDE;
         incl->common.next = NULL;
         incl->merge = merge;
         incl->stmt = NULL;
@@ -421,7 +423,7 @@ IncludeCreate(struct xkb_context *ctx, char *str, enum merge_mode merge)
         incl->map = map;
         incl->modifier = extra_data;
         incl->path = NULL;
-        incl->next = NULL;
+        incl->next_incl = NULL;
 
         if (nextop == '|')
             merge = MERGE_AUGMENT;
@@ -502,7 +504,7 @@ CreateXKBFile(struct xkb_context *ctx, enum xkb_file_type type, char *name,
         return NULL;
 
     EnsureSafeMapName(name);
-    file->type = type;
+    file->file_type = type;
     file->topName = strdup_safe(name);
     file->name = name;
     file->defs = defs;
@@ -520,32 +522,32 @@ FreeExpr(ExprDef *expr)
         return;
 
     switch (expr->op) {
-    case ExprActionList:
-    case OpNegate:
-    case OpUnaryPlus:
-    case OpNot:
-    case OpInvert:
+    case EXPR_ACTION_LIST:
+    case EXPR_NEGATE:
+    case EXPR_UNARY_PLUS:
+    case EXPR_NOT:
+    case EXPR_INVERT:
         FreeStmt(&expr->value.child->common);
         break;
 
-    case OpDivide:
-    case OpAdd:
-    case OpSubtract:
-    case OpMultiply:
-    case OpAssign:
+    case EXPR_DIVIDE:
+    case EXPR_ADD:
+    case EXPR_SUBTRACT:
+    case EXPR_MULTIPLY:
+    case EXPR_ASSIGN:
         FreeStmt(&expr->value.binary.left->common);
         FreeStmt(&expr->value.binary.right->common);
         break;
 
-    case ExprActionDecl:
+    case EXPR_ACTION_DECL:
         FreeStmt(&expr->value.action.args->common);
         break;
 
-    case ExprArrayRef:
+    case EXPR_ARRAY_REF:
         FreeStmt(&expr->value.array.entry->common);
         break;
 
-    case ExprKeysymList:
+    case EXPR_KEYSYM_LIST:
         darray_foreach(sym, expr->value.list.syms)
             free(*sym);
         darray_free(expr->value.list.syms);
@@ -565,7 +567,7 @@ FreeInclude(IncludeStmt *incl)
 
     while (incl)
     {
-        next = incl->next;
+        next = incl->next_incl;
 
         free(incl->file);
         free(incl->map);
@@ -589,43 +591,43 @@ FreeStmt(ParseCommon *stmt)
         next = stmt->next;
         u.any = stmt;
 
-        switch (stmt->stmtType) {
-        case StmtInclude:
+        switch (stmt->type) {
+        case STMT_INCLUDE:
             FreeInclude((IncludeStmt *) stmt);
             /* stmt is already free'd here. */
             stmt = NULL;
             break;
-        case StmtExpr:
+        case STMT_EXPR:
             FreeExpr(u.expr);
             break;
-        case StmtVarDef:
+        case STMT_VAR:
             FreeStmt(&u.var->name->common);
             FreeStmt(&u.var->value->common);
             break;
-        case StmtKeyTypeDef:
+        case STMT_TYPE:
             FreeStmt(&u.keyType->body->common);
             break;
-        case StmtInterpDef:
+        case STMT_INTERP:
             free(u.interp->sym);
             FreeStmt(&u.interp->match->common);
             FreeStmt(&u.interp->def->common);
             break;
-        case StmtVModDef:
+        case STMT_VMOD:
             FreeStmt(&u.vmod->value->common);
             break;
-        case StmtSymbolsDef:
+        case STMT_SYMBOLS:
             FreeStmt(&u.syms->symbols->common);
             break;
-        case StmtModMapDef:
+        case STMT_MODMAP:
             FreeStmt(&u.modMask->keys->common);
             break;
-        case StmtGroupCompatDef:
+        case STMT_GROUP_COMPAT:
             FreeStmt(&u.groupCompat->def->common);
             break;
-        case StmtIndicatorMapDef:
+        case STMT_INDICATOR_MAP:
             FreeStmt(&u.ledMap->body->common);
             break;
-        case StmtIndicatorNameDef:
+        case STMT_INDICATOR_NAME:
             FreeStmt(&u.ledName->name->common);
             break;
         default:
@@ -646,7 +648,7 @@ FreeXKBFile(XkbFile *file)
     {
         next = (XkbFile *) file->common.next;
 
-        switch (file->type) {
+        switch (file->file_type) {
         case FILE_TYPE_KEYMAP:
             FreeXKBFile((XkbFile *) file->defs);
             break;
diff --git a/src/xkbcomp/parseutils.h b/src/xkbcomp/parseutils.h
index 1d54c83..73db3d8 100644
--- a/src/xkbcomp/parseutils.h
+++ b/src/xkbcomp/parseutils.h
@@ -50,13 +50,14 @@ extern ParseCommon *
 AppendStmt(ParseCommon *to, ParseCommon *append);
 
 extern ExprDef *
-ExprCreate(unsigned op, unsigned type);
+ExprCreate(enum expr_op_type op, enum expr_value_type type);
 
 extern ExprDef *
-ExprCreateUnary(unsigned op, unsigned type, ExprDef *child);
+ExprCreateUnary(enum expr_op_type op, enum expr_value_type type,
+                ExprDef *child);
 
 extern ExprDef *
-ExprCreateBinary(unsigned op, ExprDef *left, ExprDef *right);
+ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right);
 
 KeycodeDef *
 KeycodeCreate(char keyName[XkbKeyNameLength], unsigned long value);
diff --git a/src/xkbcomp/path.c b/src/xkbcomp/path.c
index fe24e65..0ecdd7f 100644
--- a/src/xkbcomp/path.c
+++ b/src/xkbcomp/path.c
@@ -167,8 +167,8 @@ XkbDirectoryForInclude(enum xkb_file_type type)
  * pathRtrn is undefined.
  */
 FILE *
-XkbFindFileInPath(struct xkb_context *ctx,
-                  const char *name, enum xkb_file_type type, char **pathRtrn)
+XkbFindFileInPath(struct xkb_context *ctx, const char *name,
+                  enum xkb_file_type type, char **pathRtrn)
 {
     size_t i;
     int ret;
diff --git a/src/xkbcomp/path.h b/src/xkbcomp/path.h
index 916d355..be1a9cf 100644
--- a/src/xkbcomp/path.h
+++ b/src/xkbcomp/path.h
@@ -37,10 +37,10 @@ XkbParseIncludeMap(char **str_inout, char **file_rtrn, char **map_rtrn,
                    char **extra_data);
 
 const char *
-XkbDirectoryForInclude(unsigned type);
+XkbDirectoryForInclude(enum xkb_file_type type);
 
 FILE *
-XkbFindFileInPath(struct xkb_context *ctx, const char *name, unsigned type,
-                  char **pathRtrn);
+XkbFindFileInPath(struct xkb_context *ctx, const char *name,
+                  enum xkb_file_type type, char **pathRtrn);
 
 #endif /* XKBCOMP_PATH_H */
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 2a03a45..c06afc8 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -766,7 +766,7 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *stmt)
         stmt->stmt = NULL;
     }
 
-    for (; stmt; stmt = stmt->next) {
+    for (; stmt; stmt = stmt->next_incl) {
         if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_SYMBOLS,
                                 &rtrn, &merge)) {
             info->errorCount += 10;
@@ -856,7 +856,7 @@ AddSymbolsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
         keyi->symsDefined |= (1 << ndx);
         return true;
     }
-    if (value->op != ExprKeysymList) {
+    if (value->op != EXPR_KEYSYM_LIST) {
         log_err(info->keymap->ctx,
                 "Expected a list of symbols, found %s; "
                 "Ignoring symbols for group %u of %s\n",
@@ -946,7 +946,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
         return true;
     }
 
-    if (value->op != ExprActionList) {
+    if (value->op != EXPR_ACTION_LIST) {
         log_wsgo(info->keymap->ctx,
                  "Bad expression type (%d) for action list value; "
                  "Ignoring actions for group %u of %s\n",
@@ -1247,14 +1247,14 @@ HandleSymbolsBody(SymbolsInfo *info, VarDef *def, KeyInfo *keyi)
     ExprResult tmp, field;
     ExprDef *arrayNdx;
 
-    for (; def != NULL; def = (VarDef *) def->common.next) {
-        if ((def->name) && (def->name->type == ExprFieldRef)) {
+    for (; def; def = (VarDef *) def->common.next) {
+        if (def->name && def->name->op == EXPR_FIELD_REF) {
             ok = HandleSymbolsVar(info, def);
             continue;
         }
 
         if (!def->name) {
-            if (!def->value || (def->value->op == ExprKeysymList))
+            if (!def->value || def->value->op == EXPR_KEYSYM_LIST)
                 field.str = "symbols";
             else
                 field.str = "actions";
@@ -1349,7 +1349,7 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def)
     bool ok;
     struct xkb_context *ctx = info->keymap->ctx;
 
-    if (!LookupModIndex(ctx, NULL, def->modifier, TypeInt, &rtrn)) {
+    if (!LookupModIndex(ctx, NULL, def->modifier, EXPR_TYPE_INT, &rtrn)) {
         log_err(info->keymap->ctx,
                 "Illegal modifier map definition; "
                 "Ignoring map for non-modifier \"%s\"\n",
@@ -1359,7 +1359,7 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def)
     ok = true;
     tmp.modifier = rtrn.uval;
     for (key = def->keys; key != NULL; key = (ExprDef *) key->common.next) {
-        if ((key->op == ExprValue) && (key->type == TypeKeyName)) {
+        if (key->op == EXPR_VALUE && key->value_type == EXPR_TYPE_KEYNAME) {
             tmp.haveSymbol = false;
             tmp.u.keyName = KeyNameToLong(key->value.keyName);
         }
@@ -1390,44 +1390,44 @@ HandleSymbolsFile(SymbolsInfo *info, XkbFile *file, enum merge_mode merge)
     stmt = file->defs;
     while (stmt)
     {
-        switch (stmt->stmtType) {
-        case StmtInclude:
+        switch (stmt->type) {
+        case STMT_INCLUDE:
             if (!HandleIncludeSymbols(info, (IncludeStmt *) stmt))
                 info->errorCount++;
             break;
-        case StmtSymbolsDef:
+        case STMT_SYMBOLS:
             if (!HandleSymbolsDef(info, (SymbolsDef *) stmt))
                 info->errorCount++;
             break;
-        case StmtVarDef:
+        case STMT_VAR:
             if (!HandleSymbolsVar(info, (VarDef *) stmt))
                 info->errorCount++;
             break;
-        case StmtVModDef:
+        case STMT_VMOD:
             if (!HandleVModDef((VModDef *) stmt, info->keymap, merge,
                                &info->vmods))
                 info->errorCount++;
             break;
-        case StmtInterpDef:
+        case STMT_INTERP:
             log_err(info->keymap->ctx,
                     "Interpretation files may not include other types; "
                     "Ignoring definition of symbol interpretation\n");
             info->errorCount++;
             break;
-        case StmtKeycodeDef:
+        case STMT_KEYCODE:
             log_err(info->keymap->ctx,
                     "Interpretation files may not include other types; "
                     "Ignoring definition of key name\n");
             info->errorCount++;
             break;
-        case StmtModMapDef:
+        case STMT_MODMAP:
             if (!HandleModMapDef(info, (ModMapDef *) stmt))
                 info->errorCount++;
             break;
         default:
             log_wsgo(info->keymap->ctx,
                      "Unexpected statement type %d in HandleSymbolsFile\n",
-                     stmt->stmtType);
+                     stmt->type);
             break;
         }
         stmt = stmt->next;
diff --git a/src/xkbcomp/vmod.c b/src/xkbcomp/vmod.c
index 4842a00..9a18424 100644
--- a/src/xkbcomp/vmod.c
+++ b/src/xkbcomp/vmod.c
@@ -149,7 +149,7 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap,
  *
  * @param keymap Pointer to the xkb data structure.
  * @param field The Atom of the modifier's name (e.g. Atom for LAlt)
- * @param type Must be TypeInt, otherwise return false.
+ * @param type Must be EXPR_TYPE_INT, otherwise return false.
  * @param val_rtrn Set to the index of the modifier that matches.
  *
  * @return true on success, false otherwise. If false is returned, val_rtrn is
@@ -157,12 +157,12 @@ HandleVModDef(VModDef *stmt, struct xkb_keymap *keymap,
  */
 static int
 LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
-                unsigned type, ExprResult * val_rtrn)
+                enum expr_value_type type, ExprResult * val_rtrn)
 {
     xkb_mod_index_t i;
     const char *name = xkb_atom_text(keymap->ctx, field);
 
-    if (type != TypeInt)
+    if (type != EXPR_TYPE_INT)
         return false;
 
     /* For each named modifier, get the name and compare it to the one passed
@@ -192,7 +192,7 @@ LookupVModIndex(const struct xkb_keymap *keymap, xkb_atom_t field,
  */
 bool
 LookupVModMask(struct xkb_context *ctx, const void *priv, xkb_atom_t field,
-               unsigned type, ExprResult *val_rtrn)
+               enum expr_value_type type, ExprResult *val_rtrn)
 {
     if (LookupModMask(ctx, NULL, field, type, val_rtrn)) {
         return true;
@@ -212,7 +212,7 @@ FindKeypadVMod(struct xkb_keymap *keymap)
     ExprResult rtrn;
 
     name = xkb_atom_intern(keymap->ctx, "NumLock");
-    if ((keymap) && LookupVModIndex(keymap, name, TypeInt, &rtrn)) {
+    if ((keymap) && LookupVModIndex(keymap, name, EXPR_TYPE_INT, &rtrn)) {
         return rtrn.ival;
     }
     return -1;
@@ -222,7 +222,7 @@ bool
 ResolveVirtualModifier(ExprDef *def, struct xkb_keymap *keymap,
                        ExprResult *val_rtrn, VModInfo *info)
 {
-    if (def->op == ExprIdent) {
+    if (def->op == EXPR_IDENT) {
         xkb_mod_index_t i;
         xkb_mod_mask_t bit;
         const char *name = xkb_atom_text(keymap->ctx, def->value.str);
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index 7295a52..748a51e 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -102,24 +102,24 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
      * Other aggregate file types are converted to FILE_TYPE_KEYMAP
      * in the parser.
      */
-    if (file->type != FILE_TYPE_KEYMAP) {
+    if (file->file_type != FILE_TYPE_KEYMAP) {
         log_err(ctx, "Cannot compile a %s file alone into a keymap\n",
-                FileTypeText(file->type));
+                FileTypeText(file->file_type));
         goto err;
     }
 
     /* Check for duplicate entries in the input file */
     for (file = (XkbFile *) file->defs; file;
          file = (XkbFile *) file->common.next) {
-        if (have & file->type) {
+        if (have & file->file_type) {
             log_err(ctx,
                     "More than one %s section in a keymap file; "
                     "All sections after the first ignored\n",
-                    FileTypeText(file->type));
+                    FileTypeText(file->file_type));
             continue;
         }
 
-        switch (file->type) {
+        switch (file->file_type) {
         case FILE_TYPE_KEYCODES:
             keycodes = file;
             break;
@@ -138,7 +138,7 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
 
         default:
             log_err(ctx, "Cannot define %s in a keymap file\n",
-                    FileTypeText(file->type));
+                    FileTypeText(file->file_type));
             continue;
         }
 
@@ -147,7 +147,7 @@ compile_keymap(struct xkb_context *ctx, XkbFile *file)
             file->topName = strdup(main_name);
         }
 
-        have |= file->type;
+        have |= file->file_type;
     }
 
     if (REQUIRED_FILE_TYPES & (~have)) {
diff --git a/src/xkbcomp/xkbcomp.h b/src/xkbcomp/xkbcomp.h
index d2f419d..9ab77c4 100644
--- a/src/xkbcomp/xkbcomp.h
+++ b/src/xkbcomp/xkbcomp.h
@@ -29,51 +29,51 @@
 
 #include "xkb-priv.h"
 
-#define TypeUnknown          0
-#define TypeBoolean          1
-#define TypeInt              2
-#define TypeString           4
-#define TypeAction           5
-#define TypeKeyName          6
-#define TypeSymbols          7
-
-#define StmtUnknown          0
-#define StmtInclude          1
-#define StmtKeycodeDef       2
-#define StmtKeyAliasDef      3
-#define StmtExpr             4
-#define StmtVarDef           5
-#define StmtKeyTypeDef       6
-#define StmtInterpDef        7
-#define StmtVModDef          8
-#define StmtSymbolsDef       9
-#define StmtModMapDef        10
-#define StmtGroupCompatDef   11
-#define StmtIndicatorMapDef  12
-#define StmtIndicatorNameDef 13
+enum stmt_type {
+    STMT_UNKNOWN = 0,
+    STMT_INCLUDE,
+    STMT_KEYCODE,
+    STMT_ALIAS,
+    STMT_EXPR,
+    STMT_VAR,
+    STMT_TYPE,
+    STMT_INTERP,
+    STMT_VMOD,
+    STMT_SYMBOLS,
+    STMT_MODMAP,
+    STMT_GROUP_COMPAT,
+    STMT_INDICATOR_MAP,
+    STMT_INDICATOR_NAME,
+};
 
-typedef struct _ParseCommon {
-    unsigned stmtType;
-    struct _ParseCommon *next;
-} ParseCommon;
+enum expr_value_type {
+    EXPR_TYPE_UNKNOWN = 0,
+    EXPR_TYPE_BOOLEAN,
+    EXPR_TYPE_INT,
+    EXPR_TYPE_STRING,
+    EXPR_TYPE_ACTION,
+    EXPR_TYPE_KEYNAME,
+    EXPR_TYPE_SYMBOLS,
+};
 
-#define ExprValue      0
-#define ExprIdent      1
-#define ExprActionDecl 2
-#define ExprFieldRef   3
-#define ExprArrayRef   4
-#define ExprKeysymList 5
-#define ExprActionList 6
-
-#define OpAdd          20
-#define OpSubtract     21
-#define OpMultiply     22
-#define OpDivide       23
-#define OpAssign       24
-#define OpNot          25
-#define OpNegate       26
-#define OpInvert       27
-#define OpUnaryPlus    28
+enum expr_op_type {
+    EXPR_VALUE = 0,
+    EXPR_IDENT,
+    EXPR_ACTION_DECL,
+    EXPR_FIELD_REF,
+    EXPR_ARRAY_REF,
+    EXPR_KEYSYM_LIST,
+    EXPR_ACTION_LIST,
+    EXPR_ADD,
+    EXPR_SUBTRACT,
+    EXPR_MULTIPLY,
+    EXPR_DIVIDE,
+    EXPR_ASSIGN,
+    EXPR_NOT,
+    EXPR_NEGATE,
+    EXPR_INVERT,
+    EXPR_UNARY_PLUS,
+};
 
 enum merge_mode {
     MERGE_DEFAULT,
@@ -82,8 +82,10 @@ enum merge_mode {
     MERGE_REPLACE,
 };
 
-#define AutoKeyNames (1L << 0)
-#define CreateKeyNames(x) ((x)->flags & AutoKeyNames)
+typedef struct _ParseCommon {
+    enum stmt_type type;
+    struct _ParseCommon *next;
+} ParseCommon;
 
 typedef struct _IncludeStmt {
     ParseCommon common;
@@ -93,13 +95,13 @@ typedef struct _IncludeStmt {
     char *map;
     char *modifier;
     char *path;
-    struct _IncludeStmt *next;
+    struct _IncludeStmt *next_incl;
 } IncludeStmt;
 
 typedef struct _Expr {
     ParseCommon common;
-    unsigned op;
-    unsigned type;
+    enum expr_op_type op;
+    enum expr_value_type value_type;
     union {
         struct {
             struct _Expr *left;
@@ -206,14 +208,13 @@ typedef struct _IndicatorNameDef {
 typedef struct _IndicatorMapDef {
     ParseCommon common;
     enum merge_mode merge;
-    unsigned type;
     xkb_atom_t name;
     VarDef *body;
 } IndicatorMapDef;
 
 typedef struct _XkbFile {
     ParseCommon common;
-    enum xkb_file_type type;
+    enum xkb_file_type file_type;
     char *topName;
     char *name;
     ParseCommon *defs;
@@ -237,4 +238,7 @@ extern bool
 CompileSymbols(XkbFile *file, struct xkb_keymap *keymap,
                enum merge_mode merge);
 
+#define AutoKeyNames (1L << 0)
+#define CreateKeyNames(x) ((x)->flags & AutoKeyNames)
+
 #endif /* XKBCOMP_H */