1 /* A Bison parser, made by GNU Bison 2.3. */
2
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46 /* Identify Bison output. */
47 #define YYBISON 1
48
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
51
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
54
55 /* Pure parsers. */
56 #define YYPURE 0
57
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
60
61
62
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 TOK_ANY = 258,
70 TOK_ANSI = 259,
71 TOK_AUTHOR = 260,
72 TOK_BEEP = 261,
73 TOK_BITMAP = 262,
74 TOK_BRKT = 263,
75 TOK_CALL = 264,
76 TOK_CAPSFREE = 265,
77 TOK_CAPSOFF = 266,
78 TOK_CAPSON = 267,
79 TOK_COMMA = 268,
80 TOK_CONTEXT = 269,
81 TOK_COPYRIGHT = 270,
82 TOK_CHAR = 271,
83 TOK_DEADKEY = 272,
84 TOK_DOLLAR = 273,
85 TOK_ERROR = 274,
86 TOK_ETHNOLOGUE = 275,
87 TOK_GROUP = 276,
88 TOK_GT = 277,
89 TOK_HOTKEY = 278,
90 TOK_INDEX = 279,
91 TOK_LANGUAGE = 280,
92 TOK_LAYOUT = 281,
93 TOK_MATCH = 282,
94 TOK_MESSAGE = 283,
95 TOK_MNEMONIC = 284,
96 TOK_NOMATCH = 285,
97 TOK_NAME = 286,
98 TOK_NOTANY = 287,
99 TOK_NUL = 288,
100 TOK_NUMBER = 289,
101 TOK_NL = 290,
102 TOK_OUTS = 291,
103 TOK_RAWKEY = 292,
104 TOK_PLUS = 293,
105 TOK_QM = 294,
106 TOK_RTN = 295,
107 TOK_SB = 296,
108 TOK_SHIFT = 297,
109 TOK_STORE = 298,
110 TOK_STOREINSTORE = 299,
111 TOK_SWITCH = 300,
112 TOK_UNICODE = 301,
113 TOK_USE = 302,
114 TOK_USINGKEYS = 303,
115 TOK_UTF = 304,
116 TOK_VERSION = 305,
117 TOK_XKEYSYM = 306
118 };
119 #endif
120 /* Tokens. */
121 #define TOK_ANY 258
122 #define TOK_ANSI 259
123 #define TOK_AUTHOR 260
124 #define TOK_BEEP 261
125 #define TOK_BITMAP 262
126 #define TOK_BRKT 263
127 #define TOK_CALL 264
128 #define TOK_CAPSFREE 265
129 #define TOK_CAPSOFF 266
130 #define TOK_CAPSON 267
131 #define TOK_COMMA 268
132 #define TOK_CONTEXT 269
133 #define TOK_COPYRIGHT 270
134 #define TOK_CHAR 271
135 #define TOK_DEADKEY 272
136 #define TOK_DOLLAR 273
137 #define TOK_ERROR 274
138 #define TOK_ETHNOLOGUE 275
139 #define TOK_GROUP 276
140 #define TOK_GT 277
141 #define TOK_HOTKEY 278
142 #define TOK_INDEX 279
143 #define TOK_LANGUAGE 280
144 #define TOK_LAYOUT 281
145 #define TOK_MATCH 282
146 #define TOK_MESSAGE 283
147 #define TOK_MNEMONIC 284
148 #define TOK_NOMATCH 285
149 #define TOK_NAME 286
150 #define TOK_NOTANY 287
151 #define TOK_NUL 288
152 #define TOK_NUMBER 289
153 #define TOK_NL 290
154 #define TOK_OUTS 291
155 #define TOK_RAWKEY 292
156 #define TOK_PLUS 293
157 #define TOK_QM 294
158 #define TOK_RTN 295
159 #define TOK_SB 296
160 #define TOK_SHIFT 297
161 #define TOK_STORE 298
162 #define TOK_STOREINSTORE 299
163 #define TOK_SWITCH 300
164 #define TOK_UNICODE 301
165 #define TOK_USE 302
166 #define TOK_USINGKEYS 303
167 #define TOK_UTF 304
168 #define TOK_VERSION 305
169 #define TOK_XKEYSYM 306
170
171
172
173
174 /* Copy the first part of user declarations. */
175 #line 1 "yacc.y"
176
177 /*
178 YACC grammar for reading Keyman-style keyboard definition files
179 and outputting UTF-8 byte code for the Linux interpreter
180 */
181 #include <stdio.h>
182 #include <string.h>
183 #include <stdlib.h>
184
185 #include "compiler.h"
186
187 extern char *fname; /* Current file name */
188 extern int yylex(); /* Reference needed by yacc.c */
189
190 int lineno = 1; /* Current line number in file */
191 int errcount = 0; /* Count of errors */
192
193 int n; /* Temporary index value */
194 GROUP *gp = NULL; /* Temporary group pointer */
195
196 #define YYDEBUG 1 /* Allow compiler debugging (if yydebug true) */
197
198
199 /* Enabling traces. */
200 #ifndef YYDEBUG
201 # define YYDEBUG 0
202 #endif
203
204 /* Enabling verbose error messages. */
205 #ifdef YYERROR_VERBOSE
206 # undef YYERROR_VERBOSE
207 # define YYERROR_VERBOSE 1
208 #else
209 # define YYERROR_VERBOSE 0
210 #endif
211
212 /* Enabling the token table. */
213 #ifndef YYTOKEN_TABLE
214 # define YYTOKEN_TABLE 0
215 #endif
216
217 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
218 typedef union YYSTYPE
219 #line 25 "yacc.y"
220 {
221 int simple;
222 ITEM number;
223 char *string;
224 ITEM *items;
225 RULE *rule;
226 GROUP *group;
227 }
228 /* Line 187 of yacc.c. */
229 #line 230 "yacc.c"
230 YYSTYPE;
231 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
232 # define YYSTYPE_IS_DECLARED 1
233 # define YYSTYPE_IS_TRIVIAL 1
234 #endif
235
236
237
238 /* Copy the second part of user declarations. */
239
240
241 /* Line 216 of yacc.c. */
242 #line 243 "yacc.c"
243
244 #ifdef short
245 # undef short
246 #endif
247
248 #ifdef YYTYPE_UINT8
249 typedef YYTYPE_UINT8 yytype_uint8;
250 #else
251 typedef unsigned char yytype_uint8;
252 #endif
253
254 #ifdef YYTYPE_INT8
255 typedef YYTYPE_INT8 yytype_int8;
256 #elif (defined __STDC__ || defined __C99__FUNC__ \
257 || defined __cplusplus || defined _MSC_VER)
258 typedef signed char yytype_int8;
259 #else
260 typedef short int yytype_int8;
261 #endif
262
263 #ifdef YYTYPE_UINT16
264 typedef YYTYPE_UINT16 yytype_uint16;
265 #else
266 typedef unsigned short int yytype_uint16;
267 #endif
268
269 #ifdef YYTYPE_INT16
270 typedef YYTYPE_INT16 yytype_int16;
271 #else
272 typedef short int yytype_int16;
273 #endif
274
275 #ifndef YYSIZE_T
276 # ifdef __SIZE_TYPE__
277 # define YYSIZE_T __SIZE_TYPE__
278 # elif defined size_t
279 # define YYSIZE_T size_t
280 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
281 || defined __cplusplus || defined _MSC_VER)
282 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
283 # define YYSIZE_T size_t
284 # else
285 # define YYSIZE_T unsigned int
286 # endif
287 #endif
288
289 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
290
291 #ifndef YY_
292 # if YYENABLE_NLS
293 # if ENABLE_NLS
294 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
295 # define YY_(msgid) dgettext ("bison-runtime", msgid)
296 # endif
297 # endif
298 # ifndef YY_
299 # define YY_(msgid) msgid
300 # endif
301 #endif
302
303 /* Suppress unused-variable warnings by "using" E. */
304 #if ! defined lint || defined __GNUC__
305 # define YYUSE(e) ((void) (e))
306 #else
307 # define YYUSE(e) /* empty */
308 #endif
309
310 /* Identity function, used to suppress warnings about constant conditions. */
311 #ifndef lint
312 # define YYID(n) (n)
313 #else
314 #if (defined __STDC__ || defined __C99__FUNC__ \
315 || defined __cplusplus || defined _MSC_VER)
316 static int
YYID(int i)317 YYID (int i)
318 #else
319 static int
320 YYID (i)
321 int i;
322 #endif
323 {
324 return i;
325 }
326 #endif
327
328 #if ! defined yyoverflow || YYERROR_VERBOSE
329
330 /* The parser invokes alloca or malloc; define the necessary symbols. */
331
332 # ifdef YYSTACK_USE_ALLOCA
333 # if YYSTACK_USE_ALLOCA
334 # ifdef __GNUC__
335 # define YYSTACK_ALLOC __builtin_alloca
336 # elif defined __BUILTIN_VA_ARG_INCR
337 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
338 # elif defined _AIX
339 # define YYSTACK_ALLOC __alloca
340 # elif defined _MSC_VER
341 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
342 # define alloca _alloca
343 # else
344 # define YYSTACK_ALLOC alloca
345 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
346 || defined __cplusplus || defined _MSC_VER)
347 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
348 # ifndef _STDLIB_H
349 # define _STDLIB_H 1
350 # endif
351 # endif
352 # endif
353 # endif
354 # endif
355
356 # ifdef YYSTACK_ALLOC
357 /* Pacify GCC's `empty if-body' warning. */
358 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
359 # ifndef YYSTACK_ALLOC_MAXIMUM
360 /* The OS might guarantee only one guard page at the bottom of the stack,
361 and a page size can be as small as 4096 bytes. So we cannot safely
362 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
363 to allow for a few compiler-allocated temporary stack slots. */
364 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
365 # endif
366 # else
367 # define YYSTACK_ALLOC YYMALLOC
368 # define YYSTACK_FREE YYFREE
369 # ifndef YYSTACK_ALLOC_MAXIMUM
370 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
371 # endif
372 # if (defined __cplusplus && ! defined _STDLIB_H \
373 && ! ((defined YYMALLOC || defined malloc) \
374 && (defined YYFREE || defined free)))
375 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
376 # ifndef _STDLIB_H
377 # define _STDLIB_H 1
378 # endif
379 # endif
380 # ifndef YYMALLOC
381 # define YYMALLOC malloc
382 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
383 || defined __cplusplus || defined _MSC_VER)
384 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
385 # endif
386 # endif
387 # ifndef YYFREE
388 # define YYFREE free
389 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
390 || defined __cplusplus || defined _MSC_VER)
391 void free (void *); /* INFRINGES ON USER NAME SPACE */
392 # endif
393 # endif
394 # endif
395 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
396
397
398 #if (! defined yyoverflow \
399 && (! defined __cplusplus \
400 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
401
402 /* A type that is properly aligned for any stack member. */
403 union yyalloc
404 {
405 yytype_int16 yyss;
406 YYSTYPE yyvs;
407 };
408
409 /* The size of the maximum gap between one aligned stack and the next. */
410 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
411
412 /* The size of an array large to enough to hold all stacks, each with
413 N elements. */
414 # define YYSTACK_BYTES(N) \
415 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
416 + YYSTACK_GAP_MAXIMUM)
417
418 /* Copy COUNT objects from FROM to TO. The source and destination do
419 not overlap. */
420 # ifndef YYCOPY
421 # if defined __GNUC__ && 1 < __GNUC__
422 # define YYCOPY(To, From, Count) \
423 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
424 # else
425 # define YYCOPY(To, From, Count) \
426 do \
427 { \
428 YYSIZE_T yyi; \
429 for (yyi = 0; yyi < (Count); yyi++) \
430 (To)[yyi] = (From)[yyi]; \
431 } \
432 while (YYID (0))
433 # endif
434 # endif
435
436 /* Relocate STACK from its old location to the new one. The
437 local variables YYSIZE and YYSTACKSIZE give the old and new number of
438 elements in the stack, and YYPTR gives the new location of the
439 stack. Advance YYPTR to a properly aligned location for the next
440 stack. */
441 # define YYSTACK_RELOCATE(Stack) \
442 do \
443 { \
444 YYSIZE_T yynewbytes; \
445 YYCOPY (&yyptr->Stack, Stack, yysize); \
446 Stack = &yyptr->Stack; \
447 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
448 yyptr += yynewbytes / sizeof (*yyptr); \
449 } \
450 while (YYID (0))
451
452 #endif
453
454 /* YYFINAL -- State number of the termination state. */
455 #define YYFINAL 75
456 /* YYLAST -- Last index in YYTABLE. */
457 #define YYLAST 274
458
459 /* YYNTOKENS -- Number of terminals. */
460 #define YYNTOKENS 52
461 /* YYNNTS -- Number of nonterminals. */
462 #define YYNNTS 16
463 /* YYNRULES -- Number of rules. */
464 #define YYNRULES 79
465 /* YYNRULES -- Number of states. */
466 #define YYNSTATES 160
467
468 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
469 #define YYUNDEFTOK 2
470 #define YYMAXUTOK 306
471
472 #define YYTRANSLATE(YYX) \
473 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
474
475 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
476 static const yytype_uint8 yytranslate[] =
477 {
478 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
504 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
505 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
506 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
507 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
508 45, 46, 47, 48, 49, 50, 51
509 };
510
511 #if YYDEBUG
512 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
513 YYRHS. */
514 static const yytype_uint16 yyprhs[] =
515 {
516 0, 0, 3, 6, 8, 10, 13, 17, 21, 27,
517 31, 35, 39, 43, 47, 51, 55, 59, 63, 67,
518 70, 73, 76, 81, 87, 93, 101, 105, 109, 113,
519 117, 119, 121, 124, 126, 129, 133, 138, 140, 143,
520 148, 153, 155, 157, 159, 162, 165, 167, 171, 173,
521 176, 179, 182, 185, 187, 194, 199, 201, 203, 205,
522 210, 213, 215, 217, 220, 223, 226, 228, 232, 235,
523 239, 241, 244, 247, 249, 252, 254, 257, 259, 261
524 };
525
526 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
527 static const yytype_int8 yyrhs[] =
528 {
529 53, 0, -1, 54, 56, -1, 56, -1, 55, -1,
530 55, 54, -1, 31, 67, 35, -1, 31, 63, 35,
531 -1, 23, 41, 65, 41, 35, -1, 23, 63, 35,
532 -1, 50, 67, 35, -1, 50, 63, 35, -1, 7,
533 67, 35, -1, 7, 63, 35, -1, 15, 63, 35,
534 -1, 28, 63, 35, -1, 25, 61, 35, -1, 26,
535 63, 35, -1, 26, 67, 35, -1, 11, 35, -1,
536 12, 35, -1, 10, 35, -1, 43, 64, 61, 35,
537 -1, 4, 22, 47, 64, 35, -1, 46, 22, 47,
538 64, 35, -1, 4, 22, 47, 64, 47, 64, 35,
539 -1, 5, 63, 35, -1, 29, 63, 35, -1, 20,
540 63, 35, -1, 19, 67, 35, -1, 35, -1, 57,
541 -1, 57, 56, -1, 58, -1, 58, 59, -1, 21,
542 64, 35, -1, 21, 64, 48, 35, -1, 60, -1,
543 60, 59, -1, 61, 22, 61, 35, -1, 43, 64,
544 61, 35, -1, 35, -1, 62, -1, 63, -1, 62,
545 61, -1, 63, 61, -1, 34, -1, 41, 65, 41,
546 -1, 38, -1, 3, 64, -1, 32, 64, -1, 36,
547 64, -1, 17, 64, -1, 33, -1, 24, 8, 67,
548 13, 67, 8, -1, 24, 8, 67, 8, -1, 40,
549 -1, 6, -1, 14, -1, 14, 8, 67, 8, -1,
550 47, 64, -1, 27, -1, 30, -1, 9, 64, -1,
551 45, 64, -1, 18, 67, -1, 19, -1, 39, 67,
552 39, -1, 39, 39, -1, 8, 67, 8, -1, 63,
553 -1, 66, 63, -1, 66, 37, -1, 37, -1, 66,
554 51, -1, 51, -1, 66, 42, -1, 42, -1, 16,
555 -1, 16, 67, -1
556 };
557
558 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
559 static const yytype_uint16 yyrline[] =
560 {
561 0, 102, 102, 108, 117, 118, 122, 126, 130, 134,
562 138, 142, 146, 150, 154, 158, 162, 166, 170, 174,
563 178, 182, 186, 190, 194, 198, 203, 207, 211, 215,
564 216, 220, 224, 231, 238, 249, 255, 263, 267, 274,
565 278, 282, 289, 293, 297, 301, 308, 312, 316, 320,
566 332, 344, 356, 360, 364, 376, 381, 385, 389, 393,
567 397, 401, 405, 409, 414, 419, 433, 440, 445, 452,
568 459, 464, 469, 473, 477, 481, 488, 492, 499, 503
569 };
570 #endif
571
572 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
573 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
574 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
575 static const char *const yytname[] =
576 {
577 "$end", "error", "$undefined", "TOK_ANY", "TOK_ANSI", "TOK_AUTHOR",
578 "TOK_BEEP", "TOK_BITMAP", "TOK_BRKT", "TOK_CALL", "TOK_CAPSFREE",
579 "TOK_CAPSOFF", "TOK_CAPSON", "TOK_COMMA", "TOK_CONTEXT", "TOK_COPYRIGHT",
580 "TOK_CHAR", "TOK_DEADKEY", "TOK_DOLLAR", "TOK_ERROR", "TOK_ETHNOLOGUE",
581 "TOK_GROUP", "TOK_GT", "TOK_HOTKEY", "TOK_INDEX", "TOK_LANGUAGE",
582 "TOK_LAYOUT", "TOK_MATCH", "TOK_MESSAGE", "TOK_MNEMONIC", "TOK_NOMATCH",
583 "TOK_NAME", "TOK_NOTANY", "TOK_NUL", "TOK_NUMBER", "TOK_NL", "TOK_OUTS",
584 "TOK_RAWKEY", "TOK_PLUS", "TOK_QM", "TOK_RTN", "TOK_SB", "TOK_SHIFT",
585 "TOK_STORE", "TOK_STOREINSTORE", "TOK_SWITCH", "TOK_UNICODE", "TOK_USE",
586 "TOK_USINGKEYS", "TOK_UTF", "TOK_VERSION", "TOK_XKEYSYM", "$accept",
587 "T_FILE", "T_HEADER", "T_HEADLINE", "T_GROUPS", "T_GROUP", "T_GHEADER",
588 "T_RULES", "T_RULELINE", "T_ITEMS", "T_ITEM", "T_STRING", "T_PARAMETER",
589 "T_KEYDEF", "T_KEYMODS", "T_BYTES", 0
590 };
591 #endif
592
593 # ifdef YYPRINT
594 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
595 token YYLEX-NUM. */
596 static const yytype_uint16 yytoknum[] =
597 {
598 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
599 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
600 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
601 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
602 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
603 305, 306
604 };
605 # endif
606
607 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
608 static const yytype_uint8 yyr1[] =
609 {
610 0, 52, 53, 53, 54, 54, 55, 55, 55, 55,
611 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
612 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
613 55, 56, 56, 57, 57, 58, 58, 59, 59, 60,
614 60, 60, 61, 61, 61, 61, 62, 62, 62, 62,
615 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
616 62, 62, 62, 62, 62, 62, 62, 63, 63, 64,
617 65, 65, 65, 65, 65, 65, 66, 66, 67, 67
618 };
619
620 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
621 static const yytype_uint8 yyr2[] =
622 {
623 0, 2, 2, 1, 1, 2, 3, 3, 5, 3,
624 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
625 2, 2, 4, 5, 5, 7, 3, 3, 3, 3,
626 1, 1, 2, 1, 2, 3, 4, 1, 2, 4,
627 4, 1, 1, 1, 2, 2, 1, 3, 1, 2,
628 2, 2, 2, 1, 6, 4, 1, 1, 1, 4,
629 2, 1, 1, 2, 2, 2, 1, 3, 2, 3,
630 1, 2, 2, 1, 2, 1, 2, 1, 1, 2
631 };
632
633 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
634 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
635 means the default is an error. */
636 static const yytype_uint8 yydefact[] =
637 {
638 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
639 0, 0, 0, 0, 0, 0, 0, 30, 0, 0,
640 0, 0, 0, 4, 3, 31, 33, 0, 0, 0,
641 78, 0, 0, 21, 19, 20, 0, 0, 0, 0,
642 0, 0, 0, 0, 57, 0, 58, 0, 0, 66,
643 0, 61, 62, 0, 53, 46, 0, 48, 56, 0,
644 0, 0, 0, 42, 43, 0, 0, 0, 0, 0,
645 0, 0, 0, 0, 0, 1, 2, 5, 32, 41,
646 0, 34, 37, 0, 0, 68, 0, 26, 79, 13,
647 12, 14, 29, 28, 0, 35, 0, 73, 77, 75,
648 70, 0, 0, 9, 49, 63, 0, 52, 65, 0,
649 50, 51, 0, 64, 60, 16, 44, 45, 17, 18,
650 15, 27, 7, 6, 0, 0, 11, 10, 0, 38,
651 0, 0, 67, 69, 36, 0, 72, 76, 74, 71,
652 0, 0, 47, 22, 0, 0, 0, 23, 0, 8,
653 59, 55, 0, 24, 40, 39, 0, 0, 25, 54
654 };
655
656 /* YYDEFGOTO[NTERM-NUM]. */
657 static const yytype_int8 yydefgoto[] =
658 {
659 -1, 21, 22, 23, 24, 25, 26, 81, 82, 83,
660 63, 64, 40, 101, 102, 32
661 };
662
663 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
664 STATE-NUM. */
665 #define YYPACT_NINF -33
666 static const yytype_int16 yypact[] =
667 {
668 117, -16, -22, -12, -28, -21, 2, -22, 25, -22,
669 10, 6, 227, -12, -22, -22, -12, -33, 10, 20,
670 -12, 46, 27, 154, -33, 27, 184, 3, -7, 14,
671 25, 16, 17, -33, -33, -33, 24, 30, 37, 25,
672 -25, -26, 38, 10, -33, 10, 47, 10, 25, -33,
673 48, -33, -33, 10, -33, -33, 10, -33, -33, -26,
674 10, 10, 39, 227, 227, 41, 42, 43, 44, 45,
675 49, 227, 34, 50, 51, -33, -33, -33, -33, -33,
676 10, -33, 184, 60, 10, -33, 52, -33, -33, -33,
677 -33, -33, -33, -33, 75, -33, 53, -33, -33, -33,
678 -33, 19, -18, -33, -33, -33, 25, -33, -33, 25,
679 -33, -33, 54, -33, -33, -33, -33, -33, -33, -33,
680 -33, -33, -33, -33, 57, 10, -33, -33, 227, -33,
681 227, -32, -33, -33, -33, 58, -33, -33, -33, -33,
682 79, 21, -33, -33, 59, 62, 64, -33, 10, -33,
683 -33, -33, 25, -33, -33, -33, 65, 81, -33, -33
684 };
685
686 /* YYPGOTO[NTERM-NUM]. */
687 static const yytype_int8 yypgoto[] =
688 {
689 -33, -33, 67, -33, 13, -33, -33, 22, -33, -10,
690 -33, 55, -17, 56, -33, -8
691 };
692
693 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
694 positive, shift that token. If negative, reduce the rule which
695 number is the opposite. If zero, do what YYDEFACT says.
696 If YYTABLE_NINF, syntax error. */
697 #define YYTABLE_NINF -1
698 static const yytype_uint8 yytable[] =
699 {
700 37, 71, 62, 147, 30, 66, 27, 33, 70, 30,
701 95, 97, 74, 28, 34, 148, 98, 28, 39, 136,
702 86, 28, 88, 96, 137, 99, 104, 28, 105, 151,
703 107, 94, 85, 138, 152, 76, 110, 35, 78, 111,
704 108, 30, 72, 113, 114, 28, 75, 41, 10, 87,
705 84, 89, 90, 116, 117, 106, 109, 29, 31, 91,
706 135, 124, 36, 128, 38, 92, 42, 131, 65, 67,
707 68, 69, 93, 103, 115, 73, 118, 119, 120, 121,
708 122, 125, 130, 133, 123, 126, 127, 150, 134, 159,
709 77, 132, 143, 149, 153, 142, 100, 154, 140, 155,
710 158, 141, 0, 0, 129, 0, 0, 0, 144, 0,
711 0, 0, 0, 0, 100, 112, 0, 0, 145, 0,
712 146, 1, 2, 0, 3, 0, 0, 4, 5, 6,
713 0, 156, 7, 0, 0, 0, 8, 9, 10, 0,
714 11, 0, 12, 13, 157, 14, 15, 0, 16, 0,
715 0, 0, 17, 0, 0, 0, 0, 139, 1, 2,
716 18, 3, 0, 19, 4, 5, 6, 20, 0, 7,
717 0, 0, 0, 8, 9, 0, 0, 11, 0, 12,
718 13, 0, 14, 15, 0, 16, 0, 43, 0, 17,
719 44, 0, 0, 45, 0, 0, 0, 18, 46, 0,
720 19, 47, 48, 49, 20, 0, 0, 0, 50, 0,
721 0, 51, 0, 0, 52, 0, 53, 54, 55, 79,
722 56, 0, 57, 28, 58, 59, 0, 80, 0, 60,
723 43, 61, 0, 44, 0, 0, 45, 0, 0, 0,
724 0, 46, 0, 0, 47, 48, 49, 0, 0, 0,
725 0, 50, 0, 0, 51, 0, 0, 52, 0, 53,
726 54, 55, 0, 56, 0, 57, 28, 58, 59, 0,
727 0, 0, 60, 0, 61
728 };
729
730 static const yytype_int16 yycheck[] =
731 {
732 8, 18, 12, 35, 16, 13, 22, 35, 16, 16,
733 35, 37, 20, 39, 35, 47, 42, 39, 8, 37,
734 28, 39, 30, 48, 42, 51, 43, 39, 45, 8,
735 47, 39, 39, 51, 13, 22, 53, 35, 25, 56,
736 48, 16, 22, 60, 61, 39, 0, 41, 21, 35,
737 47, 35, 35, 63, 64, 8, 8, 2, 3, 35,
738 41, 71, 7, 80, 9, 35, 11, 84, 13, 14,
739 15, 16, 35, 35, 35, 20, 35, 35, 35, 35,
740 35, 47, 22, 8, 35, 35, 35, 8, 35, 8,
741 23, 39, 35, 35, 35, 41, 41, 35, 106, 35,
742 35, 109, -1, -1, 82, -1, -1, -1, 125, -1,
743 -1, -1, -1, -1, 59, 59, -1, -1, 128, -1,
744 130, 4, 5, -1, 7, -1, -1, 10, 11, 12,
745 -1, 148, 15, -1, -1, -1, 19, 20, 21, -1,
746 23, -1, 25, 26, 152, 28, 29, -1, 31, -1,
747 -1, -1, 35, -1, -1, -1, -1, 102, 4, 5,
748 43, 7, -1, 46, 10, 11, 12, 50, -1, 15,
749 -1, -1, -1, 19, 20, -1, -1, 23, -1, 25,
750 26, -1, 28, 29, -1, 31, -1, 3, -1, 35,
751 6, -1, -1, 9, -1, -1, -1, 43, 14, -1,
752 46, 17, 18, 19, 50, -1, -1, -1, 24, -1,
753 -1, 27, -1, -1, 30, -1, 32, 33, 34, 35,
754 36, -1, 38, 39, 40, 41, -1, 43, -1, 45,
755 3, 47, -1, 6, -1, -1, 9, -1, -1, -1,
756 -1, 14, -1, -1, 17, 18, 19, -1, -1, -1,
757 -1, 24, -1, -1, 27, -1, -1, 30, -1, 32,
758 33, 34, -1, 36, -1, 38, 39, 40, 41, -1,
759 -1, -1, 45, -1, 47
760 };
761
762 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
763 symbol of state STATE-NUM. */
764 static const yytype_uint8 yystos[] =
765 {
766 0, 4, 5, 7, 10, 11, 12, 15, 19, 20,
767 21, 23, 25, 26, 28, 29, 31, 35, 43, 46,
768 50, 53, 54, 55, 56, 57, 58, 22, 39, 63,
769 16, 63, 67, 35, 35, 35, 63, 67, 63, 8,
770 64, 41, 63, 3, 6, 9, 14, 17, 18, 19,
771 24, 27, 30, 32, 33, 34, 36, 38, 40, 41,
772 45, 47, 61, 62, 63, 63, 67, 63, 63, 63,
773 67, 64, 22, 63, 67, 0, 56, 54, 56, 35,
774 43, 59, 60, 61, 47, 39, 67, 35, 67, 35,
775 35, 35, 35, 35, 67, 35, 48, 37, 42, 51,
776 63, 65, 66, 35, 64, 64, 8, 64, 67, 8,
777 64, 64, 65, 64, 64, 35, 61, 61, 35, 35,
778 35, 35, 35, 35, 61, 47, 35, 35, 64, 59,
779 22, 64, 39, 8, 35, 41, 37, 42, 51, 63,
780 67, 67, 41, 35, 64, 61, 61, 35, 47, 35,
781 8, 8, 13, 35, 35, 35, 64, 67, 35, 8
782 };
783
784 #define yyerrok (yyerrstatus = 0)
785 #define yyclearin (yychar = YYEMPTY)
786 #define YYEMPTY (-2)
787 #define YYEOF 0
788
789 #define YYACCEPT goto yyacceptlab
790 #define YYABORT goto yyabortlab
791 #define YYERROR goto yyerrorlab
792
793
794 /* Like YYERROR except do call yyerror. This remains here temporarily
795 to ease the transition to the new meaning of YYERROR, for GCC.
796 Once GCC version 2 has supplanted version 1, this can go. */
797
798 #define YYFAIL goto yyerrlab
799
800 #define YYRECOVERING() (!!yyerrstatus)
801
802 #define YYBACKUP(Token, Value) \
803 do \
804 if (yychar == YYEMPTY && yylen == 1) \
805 { \
806 yychar = (Token); \
807 yylval = (Value); \
808 yytoken = YYTRANSLATE (yychar); \
809 YYPOPSTACK (1); \
810 goto yybackup; \
811 } \
812 else \
813 { \
814 yyerror (YY_("syntax error: cannot back up")); \
815 YYERROR; \
816 } \
817 while (YYID (0))
818
819
820 #define YYTERROR 1
821 #define YYERRCODE 256
822
823
824 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
825 If N is 0, then set CURRENT to the empty location which ends
826 the previous symbol: RHS[0] (always defined). */
827
828 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
829 #ifndef YYLLOC_DEFAULT
830 # define YYLLOC_DEFAULT(Current, Rhs, N) \
831 do \
832 if (YYID (N)) \
833 { \
834 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
835 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
836 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
837 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
838 } \
839 else \
840 { \
841 (Current).first_line = (Current).last_line = \
842 YYRHSLOC (Rhs, 0).last_line; \
843 (Current).first_column = (Current).last_column = \
844 YYRHSLOC (Rhs, 0).last_column; \
845 } \
846 while (YYID (0))
847 #endif
848
849
850 /* YY_LOCATION_PRINT -- Print the location on the stream.
851 This macro was not mandated originally: define only if we know
852 we won't break user code: when these are the locations we know. */
853
854 #ifndef YY_LOCATION_PRINT
855 # if YYLTYPE_IS_TRIVIAL
856 # define YY_LOCATION_PRINT(File, Loc) \
857 fprintf (File, "%d.%d-%d.%d", \
858 (Loc).first_line, (Loc).first_column, \
859 (Loc).last_line, (Loc).last_column)
860 # else
861 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
862 # endif
863 #endif
864
865
866 /* YYLEX -- calling `yylex' with the right arguments. */
867
868 #ifdef YYLEX_PARAM
869 # define YYLEX yylex (YYLEX_PARAM)
870 #else
871 # define YYLEX yylex ()
872 #endif
873
874 /* Enable debugging if requested. */
875 #if YYDEBUG
876
877 # ifndef YYFPRINTF
878 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
879 # define YYFPRINTF fprintf
880 # endif
881
882 # define YYDPRINTF(Args) \
883 do { \
884 if (yydebug) \
885 YYFPRINTF Args; \
886 } while (YYID (0))
887
888 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
889 do { \
890 if (yydebug) \
891 { \
892 YYFPRINTF (stderr, "%s ", Title); \
893 yy_symbol_print (stderr, \
894 Type, Value); \
895 YYFPRINTF (stderr, "\n"); \
896 } \
897 } while (YYID (0))
898
899
900 /*--------------------------------.
901 | Print this symbol on YYOUTPUT. |
902 `--------------------------------*/
903
904 /*ARGSUSED*/
905 #if (defined __STDC__ || defined __C99__FUNC__ \
906 || defined __cplusplus || defined _MSC_VER)
907 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)908 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
909 #else
910 static void
911 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
912 FILE *yyoutput;
913 int yytype;
914 YYSTYPE const * const yyvaluep;
915 #endif
916 {
917 if (!yyvaluep)
918 return;
919 # ifdef YYPRINT
920 if (yytype < YYNTOKENS)
921 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
922 # else
923 YYUSE (yyoutput);
924 # endif
925 switch (yytype)
926 {
927 default:
928 break;
929 }
930 }
931
932
933 /*--------------------------------.
934 | Print this symbol on YYOUTPUT. |
935 `--------------------------------*/
936
937 #if (defined __STDC__ || defined __C99__FUNC__ \
938 || defined __cplusplus || defined _MSC_VER)
939 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)940 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
941 #else
942 static void
943 yy_symbol_print (yyoutput, yytype, yyvaluep)
944 FILE *yyoutput;
945 int yytype;
946 YYSTYPE const * const yyvaluep;
947 #endif
948 {
949 if (yytype < YYNTOKENS)
950 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
951 else
952 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
953
954 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
955 YYFPRINTF (yyoutput, ")");
956 }
957
958 /*------------------------------------------------------------------.
959 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
960 | TOP (included). |
961 `------------------------------------------------------------------*/
962
963 #if (defined __STDC__ || defined __C99__FUNC__ \
964 || defined __cplusplus || defined _MSC_VER)
965 static void
yy_stack_print(yytype_int16 * bottom,yytype_int16 * top)966 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
967 #else
968 static void
969 yy_stack_print (bottom, top)
970 yytype_int16 *bottom;
971 yytype_int16 *top;
972 #endif
973 {
974 YYFPRINTF (stderr, "Stack now");
975 for (; bottom <= top; ++bottom)
976 YYFPRINTF (stderr, " %d", *bottom);
977 YYFPRINTF (stderr, "\n");
978 }
979
980 # define YY_STACK_PRINT(Bottom, Top) \
981 do { \
982 if (yydebug) \
983 yy_stack_print ((Bottom), (Top)); \
984 } while (YYID (0))
985
986
987 /*------------------------------------------------.
988 | Report that the YYRULE is going to be reduced. |
989 `------------------------------------------------*/
990
991 #if (defined __STDC__ || defined __C99__FUNC__ \
992 || defined __cplusplus || defined _MSC_VER)
993 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)994 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
995 #else
996 static void
997 yy_reduce_print (yyvsp, yyrule)
998 YYSTYPE *yyvsp;
999 int yyrule;
1000 #endif
1001 {
1002 int yynrhs = yyr2[yyrule];
1003 int yyi;
1004 unsigned long int yylno = yyrline[yyrule];
1005 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1006 yyrule - 1, yylno);
1007 /* The symbols being reduced. */
1008 for (yyi = 0; yyi < yynrhs; yyi++)
1009 {
1010 fprintf (stderr, " $%d = ", yyi + 1);
1011 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1012 &(yyvsp[(yyi + 1) - (yynrhs)])
1013 );
1014 fprintf (stderr, "\n");
1015 }
1016 }
1017
1018 # define YY_REDUCE_PRINT(Rule) \
1019 do { \
1020 if (yydebug) \
1021 yy_reduce_print (yyvsp, Rule); \
1022 } while (YYID (0))
1023
1024 /* Nonzero means print parse trace. It is left uninitialized so that
1025 multiple parsers can coexist. */
1026 int yydebug;
1027 #else /* !YYDEBUG */
1028 # define YYDPRINTF(Args)
1029 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1030 # define YY_STACK_PRINT(Bottom, Top)
1031 # define YY_REDUCE_PRINT(Rule)
1032 #endif /* !YYDEBUG */
1033
1034
1035 /* YYINITDEPTH -- initial size of the parser's stacks. */
1036 #ifndef YYINITDEPTH
1037 # define YYINITDEPTH 200
1038 #endif
1039
1040 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1041 if the built-in stack extension method is used).
1042
1043 Do not make this value too large; the results are undefined if
1044 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1045 evaluated with infinite-precision integer arithmetic. */
1046
1047 #ifndef YYMAXDEPTH
1048 # define YYMAXDEPTH 10000
1049 #endif
1050
1051
1052
1053 #if YYERROR_VERBOSE
1054
1055 # ifndef yystrlen
1056 # if defined __GLIBC__ && defined _STRING_H
1057 # define yystrlen strlen
1058 # else
1059 /* Return the length of YYSTR. */
1060 #if (defined __STDC__ || defined __C99__FUNC__ \
1061 || defined __cplusplus || defined _MSC_VER)
1062 static YYSIZE_T
yystrlen(const char * yystr)1063 yystrlen (const char *yystr)
1064 #else
1065 static YYSIZE_T
1066 yystrlen (yystr)
1067 const char *yystr;
1068 #endif
1069 {
1070 YYSIZE_T yylen;
1071 for (yylen = 0; yystr[yylen]; yylen++)
1072 continue;
1073 return yylen;
1074 }
1075 # endif
1076 # endif
1077
1078 # ifndef yystpcpy
1079 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1080 # define yystpcpy stpcpy
1081 # else
1082 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1083 YYDEST. */
1084 #if (defined __STDC__ || defined __C99__FUNC__ \
1085 || defined __cplusplus || defined _MSC_VER)
1086 static char *
yystpcpy(char * yydest,const char * yysrc)1087 yystpcpy (char *yydest, const char *yysrc)
1088 #else
1089 static char *
1090 yystpcpy (yydest, yysrc)
1091 char *yydest;
1092 const char *yysrc;
1093 #endif
1094 {
1095 char *yyd = yydest;
1096 const char *yys = yysrc;
1097
1098 while ((*yyd++ = *yys++) != '\0')
1099 continue;
1100
1101 return yyd - 1;
1102 }
1103 # endif
1104 # endif
1105
1106 # ifndef yytnamerr
1107 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1108 quotes and backslashes, so that it's suitable for yyerror. The
1109 heuristic is that double-quoting is unnecessary unless the string
1110 contains an apostrophe, a comma, or backslash (other than
1111 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1112 null, do not copy; instead, return the length of what the result
1113 would have been. */
1114 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1115 yytnamerr (char *yyres, const char *yystr)
1116 {
1117 if (*yystr == '"')
1118 {
1119 YYSIZE_T yyn = 0;
1120 char const *yyp = yystr;
1121
1122 for (;;)
1123 switch (*++yyp)
1124 {
1125 case '\'':
1126 case ',':
1127 goto do_not_strip_quotes;
1128
1129 case '\\':
1130 if (*++yyp != '\\')
1131 goto do_not_strip_quotes;
1132 /* Fall through. */
1133 default:
1134 if (yyres)
1135 yyres[yyn] = *yyp;
1136 yyn++;
1137 break;
1138
1139 case '"':
1140 if (yyres)
1141 yyres[yyn] = '\0';
1142 return yyn;
1143 }
1144 do_not_strip_quotes: ;
1145 }
1146
1147 if (! yyres)
1148 return yystrlen (yystr);
1149
1150 return yystpcpy (yyres, yystr) - yyres;
1151 }
1152 # endif
1153
1154 /* Copy into YYRESULT an error message about the unexpected token
1155 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1156 including the terminating null byte. If YYRESULT is null, do not
1157 copy anything; just return the number of bytes that would be
1158 copied. As a special case, return 0 if an ordinary "syntax error"
1159 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1160 size calculation. */
1161 static YYSIZE_T
yysyntax_error(char * yyresult,int yystate,int yychar)1162 yysyntax_error (char *yyresult, int yystate, int yychar)
1163 {
1164 int yyn = yypact[yystate];
1165
1166 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1167 return 0;
1168 else
1169 {
1170 int yytype = YYTRANSLATE (yychar);
1171 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1172 YYSIZE_T yysize = yysize0;
1173 YYSIZE_T yysize1;
1174 int yysize_overflow = 0;
1175 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1176 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1177 int yyx;
1178
1179 # if 0
1180 /* This is so xgettext sees the translatable formats that are
1181 constructed on the fly. */
1182 YY_("syntax error, unexpected %s");
1183 YY_("syntax error, unexpected %s, expecting %s");
1184 YY_("syntax error, unexpected %s, expecting %s or %s");
1185 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1186 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1187 # endif
1188 char *yyfmt;
1189 char const *yyf;
1190 static char const yyunexpected[] = "syntax error, unexpected %s";
1191 static char const yyexpecting[] = ", expecting %s";
1192 static char const yyor[] = " or %s";
1193 char yyformat[sizeof yyunexpected
1194 + sizeof yyexpecting - 1
1195 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1196 * (sizeof yyor - 1))];
1197 char const *yyprefix = yyexpecting;
1198
1199 /* Start YYX at -YYN if negative to avoid negative indexes in
1200 YYCHECK. */
1201 int yyxbegin = yyn < 0 ? -yyn : 0;
1202
1203 /* Stay within bounds of both yycheck and yytname. */
1204 int yychecklim = YYLAST - yyn + 1;
1205 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1206 int yycount = 1;
1207
1208 yyarg[0] = yytname[yytype];
1209 yyfmt = yystpcpy (yyformat, yyunexpected);
1210
1211 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1212 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1213 {
1214 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1215 {
1216 yycount = 1;
1217 yysize = yysize0;
1218 yyformat[sizeof yyunexpected - 1] = '\0';
1219 break;
1220 }
1221 yyarg[yycount++] = yytname[yyx];
1222 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1223 yysize_overflow |= (yysize1 < yysize);
1224 yysize = yysize1;
1225 yyfmt = yystpcpy (yyfmt, yyprefix);
1226 yyprefix = yyor;
1227 }
1228
1229 yyf = YY_(yyformat);
1230 yysize1 = yysize + yystrlen (yyf);
1231 yysize_overflow |= (yysize1 < yysize);
1232 yysize = yysize1;
1233
1234 if (yysize_overflow)
1235 return YYSIZE_MAXIMUM;
1236
1237 if (yyresult)
1238 {
1239 /* Avoid sprintf, as that infringes on the user's name space.
1240 Don't have undefined behavior even if the translation
1241 produced a string with the wrong number of "%s"s. */
1242 char *yyp = yyresult;
1243 int yyi = 0;
1244 while ((*yyp = *yyf) != '\0')
1245 {
1246 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1247 {
1248 yyp += yytnamerr (yyp, yyarg[yyi++]);
1249 yyf += 2;
1250 }
1251 else
1252 {
1253 yyp++;
1254 yyf++;
1255 }
1256 }
1257 }
1258 return yysize;
1259 }
1260 }
1261 #endif /* YYERROR_VERBOSE */
1262
1263
1264 /*-----------------------------------------------.
1265 | Release the memory associated to this symbol. |
1266 `-----------------------------------------------*/
1267
1268 /*ARGSUSED*/
1269 #if (defined __STDC__ || defined __C99__FUNC__ \
1270 || defined __cplusplus || defined _MSC_VER)
1271 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1272 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1273 #else
1274 static void
1275 yydestruct (yymsg, yytype, yyvaluep)
1276 const char *yymsg;
1277 int yytype;
1278 YYSTYPE *yyvaluep;
1279 #endif
1280 {
1281 YYUSE (yyvaluep);
1282
1283 if (!yymsg)
1284 yymsg = "Deleting";
1285 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1286
1287 switch (yytype)
1288 {
1289
1290 default:
1291 break;
1292 }
1293 }
1294
1295
1296 /* Prevent warnings from -Wmissing-prototypes. */
1297
1298 #ifdef YYPARSE_PARAM
1299 #if defined __STDC__ || defined __cplusplus
1300 int yyparse (void *YYPARSE_PARAM);
1301 #else
1302 int yyparse ();
1303 #endif
1304 #else /* ! YYPARSE_PARAM */
1305 #if defined __STDC__ || defined __cplusplus
1306 int yyparse (void);
1307 #else
1308 int yyparse ();
1309 #endif
1310 #endif /* ! YYPARSE_PARAM */
1311
1312
1313
1314 /* The look-ahead symbol. */
1315 int yychar;
1316
1317 /* The semantic value of the look-ahead symbol. */
1318 YYSTYPE yylval;
1319
1320 /* Number of syntax errors so far. */
1321 int yynerrs;
1322
1323
1324
1325 /*----------.
1326 | yyparse. |
1327 `----------*/
1328
1329 #ifdef YYPARSE_PARAM
1330 #if (defined __STDC__ || defined __C99__FUNC__ \
1331 || defined __cplusplus || defined _MSC_VER)
1332 int
yyparse(void * YYPARSE_PARAM)1333 yyparse (void *YYPARSE_PARAM)
1334 #else
1335 int
1336 yyparse (YYPARSE_PARAM)
1337 void *YYPARSE_PARAM;
1338 #endif
1339 #else /* ! YYPARSE_PARAM */
1340 #if (defined __STDC__ || defined __C99__FUNC__ \
1341 || defined __cplusplus || defined _MSC_VER)
1342 int
1343 yyparse (void)
1344 #else
1345 int
1346 yyparse ()
1347
1348 #endif
1349 #endif
1350 {
1351
1352 int yystate;
1353 int yyn;
1354 int yyresult;
1355 /* Number of tokens to shift before error messages enabled. */
1356 int yyerrstatus;
1357 /* Look-ahead token as an internal (translated) token number. */
1358 int yytoken = 0;
1359 #if YYERROR_VERBOSE
1360 /* Buffer for error messages, and its allocated size. */
1361 char yymsgbuf[128];
1362 char *yymsg = yymsgbuf;
1363 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1364 #endif
1365
1366 /* Three stacks and their tools:
1367 `yyss': related to states,
1368 `yyvs': related to semantic values,
1369 `yyls': related to locations.
1370
1371 Refer to the stacks thru separate pointers, to allow yyoverflow
1372 to reallocate them elsewhere. */
1373
1374 /* The state stack. */
1375 yytype_int16 yyssa[YYINITDEPTH];
1376 yytype_int16 *yyss = yyssa;
1377 yytype_int16 *yyssp;
1378
1379 /* The semantic value stack. */
1380 YYSTYPE yyvsa[YYINITDEPTH];
1381 YYSTYPE *yyvs = yyvsa;
1382 YYSTYPE *yyvsp;
1383
1384
1385
1386 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1387
1388 YYSIZE_T yystacksize = YYINITDEPTH;
1389
1390 /* The variables used to return semantic value and location from the
1391 action routines. */
1392 YYSTYPE yyval;
1393
1394
1395 /* The number of symbols on the RHS of the reduced rule.
1396 Keep to zero when no symbol should be popped. */
1397 int yylen = 0;
1398
1399 YYDPRINTF ((stderr, "Starting parse\n"));
1400
1401 yystate = 0;
1402 yyerrstatus = 0;
1403 yynerrs = 0;
1404 yychar = YYEMPTY; /* Cause a token to be read. */
1405
1406 /* Initialize stack pointers.
1407 Waste one element of value and location stack
1408 so that they stay on the same level as the state stack.
1409 The wasted elements are never initialized. */
1410
1411 yyssp = yyss;
1412 yyvsp = yyvs;
1413
1414 goto yysetstate;
1415
1416 /*------------------------------------------------------------.
1417 | yynewstate -- Push a new state, which is found in yystate. |
1418 `------------------------------------------------------------*/
1419 yynewstate:
1420 /* In all cases, when you get here, the value and location stacks
1421 have just been pushed. So pushing a state here evens the stacks. */
1422 yyssp++;
1423
1424 yysetstate:
1425 *yyssp = yystate;
1426
1427 if (yyss + yystacksize - 1 <= yyssp)
1428 {
1429 /* Get the current used size of the three stacks, in elements. */
1430 YYSIZE_T yysize = yyssp - yyss + 1;
1431
1432 #ifdef yyoverflow
1433 {
1434 /* Give user a chance to reallocate the stack. Use copies of
1435 these so that the &'s don't force the real ones into
1436 memory. */
1437 YYSTYPE *yyvs1 = yyvs;
1438 yytype_int16 *yyss1 = yyss;
1439
1440
1441 /* Each stack pointer address is followed by the size of the
1442 data in use in that stack, in bytes. This used to be a
1443 conditional around just the two extra args, but that might
1444 be undefined if yyoverflow is a macro. */
1445 yyoverflow (YY_("memory exhausted"),
1446 &yyss1, yysize * sizeof (*yyssp),
1447 &yyvs1, yysize * sizeof (*yyvsp),
1448
1449 &yystacksize);
1450
1451 yyss = yyss1;
1452 yyvs = yyvs1;
1453 }
1454 #else /* no yyoverflow */
1455 # ifndef YYSTACK_RELOCATE
1456 goto yyexhaustedlab;
1457 # else
1458 /* Extend the stack our own way. */
1459 if (YYMAXDEPTH <= yystacksize)
1460 goto yyexhaustedlab;
1461 yystacksize *= 2;
1462 if (YYMAXDEPTH < yystacksize)
1463 yystacksize = YYMAXDEPTH;
1464
1465 {
1466 yytype_int16 *yyss1 = yyss;
1467 union yyalloc *yyptr =
1468 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1469 if (! yyptr)
1470 goto yyexhaustedlab;
1471 YYSTACK_RELOCATE (yyss);
1472 YYSTACK_RELOCATE (yyvs);
1473
1474 # undef YYSTACK_RELOCATE
1475 if (yyss1 != yyssa)
1476 YYSTACK_FREE (yyss1);
1477 }
1478 # endif
1479 #endif /* no yyoverflow */
1480
1481 yyssp = yyss + yysize - 1;
1482 yyvsp = yyvs + yysize - 1;
1483
1484
1485 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1486 (unsigned long int) yystacksize));
1487
1488 if (yyss + yystacksize - 1 <= yyssp)
1489 YYABORT;
1490 }
1491
1492 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1493
1494 goto yybackup;
1495
1496 /*-----------.
1497 | yybackup. |
1498 `-----------*/
1499 yybackup:
1500
1501 /* Do appropriate processing given the current state. Read a
1502 look-ahead token if we need one and don't already have one. */
1503
1504 /* First try to decide what to do without reference to look-ahead token. */
1505 yyn = yypact[yystate];
1506 if (yyn == YYPACT_NINF)
1507 goto yydefault;
1508
1509 /* Not known => get a look-ahead token if don't already have one. */
1510
1511 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1512 if (yychar == YYEMPTY)
1513 {
1514 YYDPRINTF ((stderr, "Reading a token: "));
1515 yychar = YYLEX;
1516 }
1517
1518 if (yychar <= YYEOF)
1519 {
1520 yychar = yytoken = YYEOF;
1521 YYDPRINTF ((stderr, "Now at end of input.\n"));
1522 }
1523 else
1524 {
1525 yytoken = YYTRANSLATE (yychar);
1526 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1527 }
1528
1529 /* If the proper action on seeing token YYTOKEN is to reduce or to
1530 detect an error, take that action. */
1531 yyn += yytoken;
1532 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1533 goto yydefault;
1534 yyn = yytable[yyn];
1535 if (yyn <= 0)
1536 {
1537 if (yyn == 0 || yyn == YYTABLE_NINF)
1538 goto yyerrlab;
1539 yyn = -yyn;
1540 goto yyreduce;
1541 }
1542
1543 if (yyn == YYFINAL)
1544 YYACCEPT;
1545
1546 /* Count tokens shifted since error; after three, turn off error
1547 status. */
1548 if (yyerrstatus)
1549 yyerrstatus--;
1550
1551 /* Shift the look-ahead token. */
1552 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1553
1554 /* Discard the shifted token unless it is eof. */
1555 if (yychar != YYEOF)
1556 yychar = YYEMPTY;
1557
1558 yystate = yyn;
1559 *++yyvsp = yylval;
1560
1561 goto yynewstate;
1562
1563
1564 /*-----------------------------------------------------------.
1565 | yydefault -- do the default action for the current state. |
1566 `-----------------------------------------------------------*/
1567 yydefault:
1568 yyn = yydefact[yystate];
1569 if (yyn == 0)
1570 goto yyerrlab;
1571 goto yyreduce;
1572
1573
1574 /*-----------------------------.
1575 | yyreduce -- Do a reduction. |
1576 `-----------------------------*/
1577 yyreduce:
1578 /* yyn is the number of a rule to reduce with. */
1579 yylen = yyr2[yyn];
1580
1581 /* If YYLEN is nonzero, implement the default value of the action:
1582 `$$ = $1'.
1583
1584 Otherwise, the following line sets YYVAL to garbage.
1585 This behavior is undocumented and Bison
1586 users should not rely upon it. Assigning to YYVAL
1587 unconditionally makes the parser a bit smaller, and it avoids a
1588 GCC warning that YYVAL may be used uninitialized. */
1589 yyval = yyvsp[1-yylen];
1590
1591
1592 YY_REDUCE_PRINT (yyn);
1593 switch (yyn)
1594 {
1595 case 2:
1596 #line 103 "yacc.y"
1597 {
1598 kbp->groups = (yyvsp[(2) - (2)].group);
1599 kbp->ngroups = count_groups((yyvsp[(2) - (2)].group));
1600 kbp->nstores = count_stores(kbp->stores);
1601 }
1602 break;
1603
1604 case 3:
1605 #line 109 "yacc.y"
1606 {
1607 kbp->groups = (yyvsp[(1) - (1)].group);
1608 kbp->ngroups = count_groups((yyvsp[(1) - (1)].group));
1609 kbp->nstores = count_stores(kbp->stores);
1610 }
1611 break;
1612
1613 case 6:
1614 #line 123 "yacc.y"
1615 {
1616 new_store_from_string("&name",(yyvsp[(2) - (3)].string),lineno);
1617 }
1618 break;
1619
1620 case 7:
1621 #line 127 "yacc.y"
1622 {
1623 new_store_from_string("&name",(yyvsp[(2) - (3)].string),lineno);
1624 }
1625 break;
1626
1627 case 8:
1628 #line 131 "yacc.y"
1629 {
1630 new_store("&hotkey",new_list((yyvsp[(3) - (5)].number)),lineno);
1631 }
1632 break;
1633
1634 case 9:
1635 #line 135 "yacc.y"
1636 {
1637 new_store_from_string("&hotkey",(yyvsp[(2) - (3)].string),lineno);
1638 }
1639 break;
1640
1641 case 10:
1642 #line 139 "yacc.y"
1643 {
1644 new_store_from_string("&version",(yyvsp[(2) - (3)].string),lineno);
1645 }
1646 break;
1647
1648 case 11:
1649 #line 143 "yacc.y"
1650 {
1651 new_store_from_string("&version",(yyvsp[(2) - (3)].string),lineno);
1652 }
1653 break;
1654
1655 case 12:
1656 #line 147 "yacc.y"
1657 {
1658 new_store_from_string("&bitmap",(yyvsp[(2) - (3)].string),lineno);
1659 }
1660 break;
1661
1662 case 13:
1663 #line 151 "yacc.y"
1664 {
1665 new_store_from_string("&bitmap",(yyvsp[(2) - (3)].string),lineno);
1666 }
1667 break;
1668
1669 case 14:
1670 #line 155 "yacc.y"
1671 {
1672 new_store_from_string("©right",(yyvsp[(2) - (3)].string),lineno);
1673 }
1674 break;
1675
1676 case 15:
1677 #line 159 "yacc.y"
1678 {
1679 new_store_from_string("&message",(yyvsp[(2) - (3)].string),lineno);
1680 }
1681 break;
1682
1683 case 16:
1684 #line 163 "yacc.y"
1685 {
1686 new_store_from_string("&language",(yyvsp[(2) - (3)].items),lineno);
1687 }
1688 break;
1689
1690 case 17:
1691 #line 167 "yacc.y"
1692 {
1693 new_store_from_string("&layout",(yyvsp[(2) - (3)].string),lineno);
1694 }
1695 break;
1696
1697 case 18:
1698 #line 171 "yacc.y"
1699 {
1700 new_store_from_string("&layout",(yyvsp[(2) - (3)].string),lineno);
1701 }
1702 break;
1703
1704 case 19:
1705 #line 175 "yacc.y"
1706 {
1707 new_store_from_string("&capsalwaysoff","1",lineno);
1708 }
1709 break;
1710
1711 case 20:
1712 #line 179 "yacc.y"
1713 {
1714 new_store_from_string("&capsononly","1",lineno);
1715 }
1716 break;
1717
1718 case 21:
1719 #line 183 "yacc.y"
1720 {
1721 new_store_from_string("&shiftfreescaps","1",lineno);
1722 }
1723 break;
1724
1725 case 22:
1726 #line 187 "yacc.y"
1727 {
1728 new_store((yyvsp[(2) - (4)].string),(yyvsp[(3) - (4)].items),lineno);
1729 }
1730 break;
1731
1732 case 23:
1733 #line 191 "yacc.y"
1734 {
1735 set_start_group((yyvsp[(4) - (5)].string),KF_ANSI, lineno);
1736 }
1737 break;
1738
1739 case 24:
1740 #line 195 "yacc.y"
1741 {
1742 set_start_group((yyvsp[(4) - (5)].string),KF_UNICODE, lineno);
1743 }
1744 break;
1745
1746 case 25:
1747 #line 199 "yacc.y"
1748 {
1749 kmflcomp_error(lineno,"alternate starting groups not supported");
1750 fail(11,"obsolete syntax");
1751 }
1752 break;
1753
1754 case 26:
1755 #line 204 "yacc.y"
1756 {
1757 new_store_from_string("&author",(yyvsp[(2) - (3)].string),lineno);
1758 }
1759 break;
1760
1761 case 27:
1762 #line 208 "yacc.y"
1763 {
1764 new_store_from_string("&mnemoniclayout",(yyvsp[(2) - (3)].string),lineno);
1765 }
1766 break;
1767
1768 case 28:
1769 #line 212 "yacc.y"
1770 {
1771 new_store_from_string("ðnologuecode",(yyvsp[(2) - (3)].string),lineno);
1772 }
1773 break;
1774
1775 case 31:
1776 #line 221 "yacc.y"
1777 {
1778 (yyval.group) = kbp->groups;
1779 }
1780 break;
1781
1782 case 32:
1783 #line 225 "yacc.y"
1784 {
1785 (yyval.group) = kbp->groups;
1786 }
1787 break;
1788
1789 case 33:
1790 #line 232 "yacc.y"
1791 {
1792 (yyval.group) = (yyvsp[(1) - (1)].group);
1793 ((yyval.group))->rules = NULL;
1794 ((yyval.group))->nrules = 0;
1795 kmflcomp_warn(0,"group(%s) is empty!",((yyvsp[(1) - (1)].group))->name);
1796 }
1797 break;
1798
1799 case 34:
1800 #line 239 "yacc.y"
1801 {
1802 (yyval.group) = (yyvsp[(1) - (2)].group);
1803 ((yyval.group))->rules = (yyvsp[(2) - (2)].rule);
1804 ((yyval.group))->nrules = count_rules((yyvsp[(2) - (2)].rule));
1805 if(((yyval.group))->nrules == 0)
1806 kmflcomp_warn(0,"group(%s) is empty!",((yyvsp[(1) - (2)].group))->name);
1807 }
1808 break;
1809
1810 case 35:
1811 #line 250 "yacc.y"
1812 {
1813 (yyval.group) = gp = new_group((yyvsp[(2) - (3)].string), lineno);
1814 if(gp) gp->flags = 0;
1815 }
1816 break;
1817
1818 case 36:
1819 #line 256 "yacc.y"
1820 {
1821 (yyval.group) = gp = new_group((yyvsp[(2) - (4)].string), lineno);
1822 if(gp) gp->flags = GF_USEKEYS;
1823 }
1824 break;
1825
1826 case 37:
1827 #line 264 "yacc.y"
1828 {
1829 (yyval.rule) = (yyvsp[(1) - (1)].rule);
1830 }
1831 break;
1832
1833 case 38:
1834 #line 268 "yacc.y"
1835 {
1836 (yyval.rule) = add_rule((yyvsp[(1) - (2)].rule), (yyvsp[(2) - (2)].rule));
1837 }
1838 break;
1839
1840 case 39:
1841 #line 275 "yacc.y"
1842 {
1843 (yyval.rule) = new_rule(gp, (yyvsp[(1) - (4)].items), (yyvsp[(3) - (4)].items), lineno);
1844 }
1845 break;
1846
1847 case 40:
1848 #line 279 "yacc.y"
1849 {
1850 new_store((yyvsp[(2) - (4)].string),(yyvsp[(3) - (4)].items),lineno); (yyval.rule) = NULL;
1851 }
1852 break;
1853
1854 case 41:
1855 #line 283 "yacc.y"
1856 {
1857 (yyval.rule) = NULL;
1858 }
1859 break;
1860
1861 case 42:
1862 #line 290 "yacc.y"
1863 {
1864 (yyval.items) = new_list((yyvsp[(1) - (1)].number));
1865 }
1866 break;
1867
1868 case 43:
1869 #line 294 "yacc.y"
1870 {
1871 (yyval.items) = items_from_string((yyvsp[(1) - (1)].string),lineno);
1872 }
1873 break;
1874
1875 case 44:
1876 #line 298 "yacc.y"
1877 {
1878 (yyval.items) = add_item_to_list((yyvsp[(2) - (2)].items),(yyvsp[(1) - (2)].number));
1879 }
1880 break;
1881
1882 case 45:
1883 #line 302 "yacc.y"
1884 {
1885 (yyval.items) = add_lists((yyvsp[(2) - (2)].items),items_from_string((yyvsp[(1) - (2)].string),lineno));
1886 }
1887 break;
1888
1889 case 46:
1890 #line 309 "yacc.y"
1891 {
1892 (yyval.number) = MAKE_ITEM(ITEM_CHAR,(yyvsp[(1) - (1)].number));
1893 }
1894 break;
1895
1896 case 47:
1897 #line 313 "yacc.y"
1898 {
1899 (yyval.number) = MAKE_ITEM(ITEM_KEYSYM,(yyvsp[(2) - (3)].number));
1900 }
1901 break;
1902
1903 case 48:
1904 #line 317 "yacc.y"
1905 {
1906 (yyval.number) = MAKE_ITEM(ITEM_PLUS,0); /* include in item list - remove later when testing validity */
1907 }
1908 break;
1909
1910 case 49:
1911 #line 321 "yacc.y"
1912 {
1913 if((n=store_number((yyvsp[(2) - (2)].string),lineno)) != UNDEFINED)
1914 {
1915 (yyval.number) = MAKE_ITEM(ITEM_ANY,n);
1916 }
1917 else
1918 {
1919 kmflcomp_warn(lineno,"store (%s) is undefined!",(yyvsp[(2) - (2)].string));
1920 (yyval.number) = 0;
1921 }
1922 }
1923 break;
1924
1925 case 50:
1926 #line 333 "yacc.y"
1927 {
1928 if((n=store_number((yyvsp[(2) - (2)].string),lineno)) != UNDEFINED)
1929 {
1930 (yyval.number) = MAKE_ITEM(ITEM_NOTANY,n);
1931 }
1932 else
1933 {
1934 kmflcomp_warn(lineno,"store (%s) is undefined!",(yyvsp[(2) - (2)].string));
1935 (yyval.number) = 0;
1936 }
1937 }
1938 break;
1939
1940 case 51:
1941 #line 345 "yacc.y"
1942 {
1943 if((n=store_number((yyvsp[(2) - (2)].string),lineno)) != UNDEFINED)
1944 {
1945 (yyval.number) = MAKE_ITEM(ITEM_OUTS,n);
1946 }
1947 else
1948 {
1949 kmflcomp_warn(lineno,"store (%s) is undefined!",(yyvsp[(2) - (2)].string));
1950 (yyval.number) = 0;
1951 }
1952 }
1953 break;
1954
1955 case 52:
1956 #line 357 "yacc.y"
1957 {
1958 (yyval.number) = MAKE_ITEM(ITEM_DEADKEY,deadkey_number((yyvsp[(2) - (2)].string), lineno));
1959 }
1960 break;
1961
1962 case 53:
1963 #line 361 "yacc.y"
1964 {
1965 (yyval.number) = MAKE_ITEM(ITEM_NUL,0);
1966 }
1967 break;
1968
1969 case 54:
1970 #line 365 "yacc.y"
1971 {
1972 if((n=store_number((yyvsp[(3) - (6)].string),lineno)) != UNDEFINED)
1973 {
1974 (yyval.number) = MAKE_PARAMETER_ITEM(ITEM_INDEX,atoi((yyvsp[(5) - (6)].string)),n);
1975 }
1976 else
1977 {
1978 kmflcomp_warn(lineno,"store (%s) is undefined!",(yyvsp[(3) - (6)].string));
1979 (yyval.number) = 0;
1980 }
1981 }
1982 break;
1983
1984 case 55:
1985 #line 377 "yacc.y"
1986 {
1987 kmflcomp_warn(lineno,"index(%s) must have TWO parameters!",(yyvsp[(3) - (4)].string));
1988 (yyval.number) = 0;
1989 }
1990 break;
1991
1992 case 56:
1993 #line 382 "yacc.y"
1994 {
1995 (yyval.number) = MAKE_ITEM(ITEM_RETURN,0);
1996 }
1997 break;
1998
1999 case 57:
2000 #line 386 "yacc.y"
2001 {
2002 (yyval.number) = MAKE_ITEM(ITEM_BEEP,0);
2003 }
2004 break;
2005
2006 case 58:
2007 #line 390 "yacc.y"
2008 {
2009 (yyval.number) = MAKE_ITEM(ITEM_CONTEXT,0);
2010 }
2011 break;
2012
2013 case 59:
2014 #line 394 "yacc.y"
2015 {
2016 (yyval.number) = MAKE_ITEM(ITEM_CONTEXT,atoi((yyvsp[(3) - (4)].string)));
2017 }
2018 break;
2019
2020 case 60:
2021 #line 398 "yacc.y"
2022 {
2023 (yyval.number) = MAKE_ITEM(ITEM_USE,group_number((yyvsp[(2) - (2)].string), lineno));
2024 }
2025 break;
2026
2027 case 61:
2028 #line 402 "yacc.y"
2029 {
2030 (yyval.number) = MAKE_ITEM(ITEM_MATCH,0);
2031 }
2032 break;
2033
2034 case 62:
2035 #line 406 "yacc.y"
2036 {
2037 (yyval.number) = MAKE_ITEM(ITEM_NOMATCH,0);
2038 }
2039 break;
2040
2041 case 63:
2042 #line 410 "yacc.y"
2043 {
2044 kmflcomp_error(lineno,"call keyword not implemented");
2045 fail(12,"unsupported keyword");
2046 }
2047 break;
2048
2049 case 64:
2050 #line 415 "yacc.y"
2051 {
2052 kmflcomp_error(lineno,"switch keyword not implemented");
2053 fail(11,"obsolete syntax");
2054 }
2055 break;
2056
2057 case 65:
2058 #line 420 "yacc.y"
2059 {
2060 STORE *sp; /* check for named constants */
2061 sp = find_store((yyvsp[(2) - (2)].string));
2062 if(sp)
2063 {
2064 (yyval.number) = *sp->items;
2065 }
2066 else
2067 {
2068 (yyval.number) = 0;
2069 kmflcomp_error(lineno,"undefined constant");
2070 }
2071 }
2072 break;
2073
2074 case 66:
2075 #line 434 "yacc.y"
2076 {
2077 kmflcomp_error(lineno,"illegal or unrecognized item in rule or store");
2078 }
2079 break;
2080
2081 case 67:
2082 #line 441 "yacc.y"
2083 {
2084 (yyval.string) = (yyvsp[(2) - (3)].string);
2085 }
2086 break;
2087
2088 case 68:
2089 #line 446 "yacc.y"
2090 {
2091 (yyval.string) = new_string(0); /* allow for empty strings */
2092 }
2093 break;
2094
2095 case 69:
2096 #line 453 "yacc.y"
2097 {
2098 (yyval.string) = (yyvsp[(2) - (3)].string);
2099 }
2100 break;
2101
2102 case 70:
2103 #line 460 "yacc.y"
2104 {
2105 (yyval.number) = make_keysym(lineno, 0,string_to_keysym((yyvsp[(1) - (1)].string),lineno));
2106 }
2107 break;
2108
2109 case 71:
2110 #line 465 "yacc.y"
2111 {
2112 (yyval.number) = make_keysym(lineno, 0,string_to_keysym((yyvsp[(2) - (2)].string),lineno));
2113 }
2114 break;
2115
2116 case 72:
2117 #line 470 "yacc.y"
2118 {
2119 (yyval.number) = make_keysym(lineno, (yyvsp[(1) - (2)].number),(yyvsp[(2) - (2)].number));
2120 }
2121 break;
2122
2123 case 73:
2124 #line 474 "yacc.y"
2125 {
2126 (yyval.number) = make_keysym(lineno, 0,(yyvsp[(1) - (1)].number));
2127 }
2128 break;
2129
2130 case 74:
2131 #line 478 "yacc.y"
2132 {
2133 (yyval.number) = make_xkeysym(lineno, (yyvsp[(1) - (2)].number), (yyvsp[(2) - (2)].number));
2134 }
2135 break;
2136
2137 case 75:
2138 #line 482 "yacc.y"
2139 {
2140 (yyval.number) = make_xkeysym(lineno, 0, (yyvsp[(1) - (1)].number));
2141 }
2142 break;
2143
2144 case 76:
2145 #line 489 "yacc.y"
2146 {
2147 (yyval.number) = (yyvsp[(1) - (2)].number) | (yyvsp[(2) - (2)].number);
2148 }
2149 break;
2150
2151 case 77:
2152 #line 493 "yacc.y"
2153 {
2154 (yyval.number) = (yyvsp[(1) - (1)].number);
2155 }
2156 break;
2157
2158 case 78:
2159 #line 500 "yacc.y"
2160 {
2161 (yyval.string) = new_string((yyvsp[(1) - (1)].number));
2162 }
2163 break;
2164
2165 case 79:
2166 #line 504 "yacc.y"
2167 {
2168 (yyval.string) = add_char((yyvsp[(2) - (2)].string),(yyvsp[(1) - (2)].number));
2169 }
2170 break;
2171
2172
2173 /* Line 1267 of yacc.c. */
2174 #line 2175 "yacc.c"
2175 default: break;
2176 }
2177 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2178
2179 YYPOPSTACK (yylen);
2180 yylen = 0;
2181 YY_STACK_PRINT (yyss, yyssp);
2182
2183 *++yyvsp = yyval;
2184
2185
2186 /* Now `shift' the result of the reduction. Determine what state
2187 that goes to, based on the state we popped back to and the rule
2188 number reduced by. */
2189
2190 yyn = yyr1[yyn];
2191
2192 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2193 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2194 yystate = yytable[yystate];
2195 else
2196 yystate = yydefgoto[yyn - YYNTOKENS];
2197
2198 goto yynewstate;
2199
2200
2201 /*------------------------------------.
2202 | yyerrlab -- here on detecting error |
2203 `------------------------------------*/
2204 yyerrlab:
2205 /* If not already recovering from an error, report this error. */
2206 if (!yyerrstatus)
2207 {
2208 ++yynerrs;
2209 #if ! YYERROR_VERBOSE
2210 yyerror (YY_("syntax error"));
2211 #else
2212 {
2213 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2214 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2215 {
2216 YYSIZE_T yyalloc = 2 * yysize;
2217 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2218 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2219 if (yymsg != yymsgbuf)
2220 YYSTACK_FREE (yymsg);
2221 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2222 if (yymsg)
2223 yymsg_alloc = yyalloc;
2224 else
2225 {
2226 yymsg = yymsgbuf;
2227 yymsg_alloc = sizeof yymsgbuf;
2228 }
2229 }
2230
2231 if (0 < yysize && yysize <= yymsg_alloc)
2232 {
2233 (void) yysyntax_error (yymsg, yystate, yychar);
2234 yyerror (yymsg);
2235 }
2236 else
2237 {
2238 yyerror (YY_("syntax error"));
2239 if (yysize != 0)
2240 goto yyexhaustedlab;
2241 }
2242 }
2243 #endif
2244 }
2245
2246
2247
2248 if (yyerrstatus == 3)
2249 {
2250 /* If just tried and failed to reuse look-ahead token after an
2251 error, discard it. */
2252
2253 if (yychar <= YYEOF)
2254 {
2255 /* Return failure if at end of input. */
2256 if (yychar == YYEOF)
2257 YYABORT;
2258 }
2259 else
2260 {
2261 yydestruct ("Error: discarding",
2262 yytoken, &yylval);
2263 yychar = YYEMPTY;
2264 }
2265 }
2266
2267 /* Else will try to reuse look-ahead token after shifting the error
2268 token. */
2269 goto yyerrlab1;
2270
2271
2272 /*---------------------------------------------------.
2273 | yyerrorlab -- error raised explicitly by YYERROR. |
2274 `---------------------------------------------------*/
2275 yyerrorlab:
2276
2277 /* Pacify compilers like GCC when the user code never invokes
2278 YYERROR and the label yyerrorlab therefore never appears in user
2279 code. */
2280 if (/*CONSTCOND*/ 0)
2281 goto yyerrorlab;
2282
2283 /* Do not reclaim the symbols of the rule which action triggered
2284 this YYERROR. */
2285 YYPOPSTACK (yylen);
2286 yylen = 0;
2287 YY_STACK_PRINT (yyss, yyssp);
2288 yystate = *yyssp;
2289 goto yyerrlab1;
2290
2291
2292 /*-------------------------------------------------------------.
2293 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2294 `-------------------------------------------------------------*/
2295 yyerrlab1:
2296 yyerrstatus = 3; /* Each real token shifted decrements this. */
2297
2298 for (;;)
2299 {
2300 yyn = yypact[yystate];
2301 if (yyn != YYPACT_NINF)
2302 {
2303 yyn += YYTERROR;
2304 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2305 {
2306 yyn = yytable[yyn];
2307 if (0 < yyn)
2308 break;
2309 }
2310 }
2311
2312 /* Pop the current state because it cannot handle the error token. */
2313 if (yyssp == yyss)
2314 YYABORT;
2315
2316
2317 yydestruct ("Error: popping",
2318 yystos[yystate], yyvsp);
2319 YYPOPSTACK (1);
2320 yystate = *yyssp;
2321 YY_STACK_PRINT (yyss, yyssp);
2322 }
2323
2324 if (yyn == YYFINAL)
2325 YYACCEPT;
2326
2327 *++yyvsp = yylval;
2328
2329
2330 /* Shift the error token. */
2331 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2332
2333 yystate = yyn;
2334 goto yynewstate;
2335
2336
2337 /*-------------------------------------.
2338 | yyacceptlab -- YYACCEPT comes here. |
2339 `-------------------------------------*/
2340 yyacceptlab:
2341 yyresult = 0;
2342 goto yyreturn;
2343
2344 /*-----------------------------------.
2345 | yyabortlab -- YYABORT comes here. |
2346 `-----------------------------------*/
2347 yyabortlab:
2348 yyresult = 1;
2349 goto yyreturn;
2350
2351 #ifndef yyoverflow
2352 /*-------------------------------------------------.
2353 | yyexhaustedlab -- memory exhaustion comes here. |
2354 `-------------------------------------------------*/
2355 yyexhaustedlab:
2356 yyerror (YY_("memory exhausted"));
2357 yyresult = 2;
2358 /* Fall through. */
2359 #endif
2360
2361 yyreturn:
2362 if (yychar != YYEOF && yychar != YYEMPTY)
2363 yydestruct ("Cleanup: discarding lookahead",
2364 yytoken, &yylval);
2365 /* Do not reclaim the symbols of the rule which action triggered
2366 this YYABORT or YYACCEPT. */
2367 YYPOPSTACK (yylen);
2368 YY_STACK_PRINT (yyss, yyssp);
2369 while (yyssp != yyss)
2370 {
2371 yydestruct ("Cleanup: popping",
2372 yystos[*yyssp], yyvsp);
2373 YYPOPSTACK (1);
2374 }
2375 #ifndef yyoverflow
2376 if (yyss != yyssa)
2377 YYSTACK_FREE (yyss);
2378 #endif
2379 #if YYERROR_VERBOSE
2380 if (yymsg != yymsgbuf)
2381 YYSTACK_FREE (yymsg);
2382 #endif
2383 /* Make sure YYID is used. */
2384 return YYID (yyresult);
2385 }
2386
2387
2388 #line 510 "yacc.y"
2389
2390
yyerror(char * str)2391 void yyerror(char *str)
2392 {
2393 fflush (stdout); (void) fflush (stderr);
2394 fprintf (stderr, "Error: %s (line %d)\n", str, lineno);
2395 fflush (stderr); errcount++;
2396 }
2397
2398 #ifdef _WIN32
yywrap(void)2399 int yywrap(void)
2400 {
2401 return 1;
2402 }
2403 #endif
2404
2405