1 /* A Bison parser, made by GNU Bison 3.0.5. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.5"
50 #define YYSKELETON_NAME "yacc.c"
64 /* Copy the first part of user declarations. */
65 #line 12 "parser.y" /* yacc.c:339 */
68 #include "libcommon.h"
72 #include "modifiers.h"
77 #line 78 "parser.c" /* yacc.c:339 */
80 # if defined __cplusplus && 201103L <= __cplusplus
81 # define YY_NULLPTR nullptr
87 /* Enabling verbose error messages. */
88 #ifdef YYERROR_VERBOSE
89 # undef YYERROR_VERBOSE
90 # define YYERROR_VERBOSE 1
92 # define YYERROR_VERBOSE 1
95 /* In a future release of Bison, this section will be replaced
96 by #include "y.tab.h". */
97 #ifndef YY_YY_PARSER_H_INCLUDED
98 # define YY_YY_PARSER_H_INCLUDED
106 /* "%code requires" blocks. */
107 #line 24 "parser.y" /* yacc.c:355 */
112 #ifndef STRDATA_STRUCT
113 #define STRDATA_STRUCT
114 #define MAX_PARSER_STRING 512
117 unsigned char data[MAX_PARSER_STRING];
121 #line 122 "parser.c" /* yacc.c:355 */
180 #define CAPSSHIFT 274
184 #define STRLITERAL 278
191 #define ALT_IS_META 285
199 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
203 #line 57 "parser.y" /* yacc.c:355 */
208 #line 209 "parser.c" /* yacc.c:355 */
211 typedef union YYSTYPE YYSTYPE;
212 # define YYSTYPE_IS_TRIVIAL 1
213 # define YYSTYPE_IS_DECLARED 1
218 int yyparse (void *scanner, struct lk_ctx *ctx);
220 #endif /* !YY_YY_PARSER_H_INCLUDED */
222 /* Copy the second part of user declarations. */
223 #line 70 "parser.y" /* yacc.c:358 */
226 yyerror(yyscan_t scanner __attribute__ ((unused)),
227 struct lk_ctx *ctx, const char *s)
234 strings_as_usual(struct lk_ctx *ctx)
237 * 26 strings, mostly inspired by the VT100 family
239 const char *stringvalues[30] = {
241 "\033[[A", "\033[[B", "\033[[C", "\033[[D", "\033[[E",
242 "\033[17~", "\033[18~", "\033[19~", "\033[20~", "\033[21~",
243 "\033[23~", "\033[24~", "\033[25~", "\033[26~",
244 "\033[28~", "\033[29~",
245 "\033[31~", "\033[32~", "\033[33~", "\033[34~",
246 /* Find, Insert, Remove, Select, Prior */
247 "\033[1~", "\033[2~", "\033[3~", "\033[4~", "\033[5~",
248 /* Next, Macro, Help, Do, Pause */
249 "\033[6~", 0, 0, 0, 0
253 for (i = 0; i < 30; i++) {
254 if (stringvalues[i]) {
257 strncpy((char *)ke.kb_string, stringvalues[i], sizeof(ke.kb_string));
258 ke.kb_string[sizeof(ke.kb_string) - 1] = 0;
260 if (lk_add_func(ctx, &ke) == -1)
268 compose_as_usual(struct lk_ctx *ctx, char *charset)
270 if (charset && strcmp(charset, "iso-8859-1")) {
271 ERR(ctx, _("loadkeys: don't know how to compose for %s"), charset);
276 unsigned char c1, c2, c3;
277 } def_latin1_composes[68] = {
278 { '`', 'A', 0300 }, { '`', 'a', 0340 },
279 { '\'', 'A', 0301 }, { '\'', 'a', 0341 },
280 { '^', 'A', 0302 }, { '^', 'a', 0342 },
281 { '~', 'A', 0303 }, { '~', 'a', 0343 },
282 { '"', 'A', 0304 }, { '"', 'a', 0344 },
283 { 'O', 'A', 0305 }, { 'o', 'a', 0345 },
284 { '0', 'A', 0305 }, { '0', 'a', 0345 },
285 { 'A', 'A', 0305 }, { 'a', 'a', 0345 },
286 { 'A', 'E', 0306 }, { 'a', 'e', 0346 },
287 { ',', 'C', 0307 }, { ',', 'c', 0347 },
288 { '`', 'E', 0310 }, { '`', 'e', 0350 },
289 { '\'', 'E', 0311 }, { '\'', 'e', 0351 },
290 { '^', 'E', 0312 }, { '^', 'e', 0352 },
291 { '"', 'E', 0313 }, { '"', 'e', 0353 },
292 { '`', 'I', 0314 }, { '`', 'i', 0354 },
293 { '\'', 'I', 0315 }, { '\'', 'i', 0355 },
294 { '^', 'I', 0316 }, { '^', 'i', 0356 },
295 { '"', 'I', 0317 }, { '"', 'i', 0357 },
296 { '-', 'D', 0320 }, { '-', 'd', 0360 },
297 { '~', 'N', 0321 }, { '~', 'n', 0361 },
298 { '`', 'O', 0322 }, { '`', 'o', 0362 },
299 { '\'', 'O', 0323 }, { '\'', 'o', 0363 },
300 { '^', 'O', 0324 }, { '^', 'o', 0364 },
301 { '~', 'O', 0325 }, { '~', 'o', 0365 },
302 { '"', 'O', 0326 }, { '"', 'o', 0366 },
303 { '/', 'O', 0330 }, { '/', 'o', 0370 },
304 { '`', 'U', 0331 }, { '`', 'u', 0371 },
305 { '\'', 'U', 0332 }, { '\'', 'u', 0372 },
306 { '^', 'U', 0333 }, { '^', 'u', 0373 },
307 { '"', 'U', 0334 }, { '"', 'u', 0374 },
308 { '\'', 'Y', 0335 }, { '\'', 'y', 0375 },
309 { 'T', 'H', 0336 }, { 't', 'h', 0376 },
310 { 's', 's', 0337 }, { '"', 'y', 0377 },
311 { 's', 'z', 0337 }, { 'i', 'j', 0377 }
314 for (i = 0; i < 68; i++) {
315 struct lk_kbdiacr ptr;
316 struct ccc c = def_latin1_composes[i];
322 if (lk_append_compose(ctx, &ptr) == -1)
330 #line 331 "parser.c" /* yacc.c:358 */
337 typedef YYTYPE_UINT8 yytype_uint8;
339 typedef unsigned char yytype_uint8;
343 typedef YYTYPE_INT8 yytype_int8;
345 typedef signed char yytype_int8;
349 typedef YYTYPE_UINT16 yytype_uint16;
351 typedef unsigned short int yytype_uint16;
355 typedef YYTYPE_INT16 yytype_int16;
357 typedef short int yytype_int16;
361 # ifdef __SIZE_TYPE__
362 # define YYSIZE_T __SIZE_TYPE__
363 # elif defined size_t
364 # define YYSIZE_T size_t
365 # elif ! defined YYSIZE_T
366 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
367 # define YYSIZE_T size_t
369 # define YYSIZE_T unsigned int
373 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
376 # if defined YYENABLE_NLS && YYENABLE_NLS
378 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
379 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
383 # define YY_(Msgid) Msgid
388 # if (defined __GNUC__ \
389 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
390 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
391 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
393 # define YY_ATTRIBUTE(Spec) /* empty */
397 #ifndef YY_ATTRIBUTE_PURE
398 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
401 #ifndef YY_ATTRIBUTE_UNUSED
402 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
405 #if !defined _Noreturn \
406 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
407 # if defined _MSC_VER && 1200 <= _MSC_VER
408 # define _Noreturn __declspec (noreturn)
410 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
414 /* Suppress unused-variable warnings by "using" E. */
415 #if ! defined lint || defined __GNUC__
416 # define YYUSE(E) ((void) (E))
418 # define YYUSE(E) /* empty */
421 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
422 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
423 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
424 _Pragma ("GCC diagnostic push") \
425 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
426 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
427 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
428 _Pragma ("GCC diagnostic pop")
430 # define YY_INITIAL_VALUE(Value) Value
432 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
433 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
434 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
436 #ifndef YY_INITIAL_VALUE
437 # define YY_INITIAL_VALUE(Value) /* Nothing. */
441 #if ! defined yyoverflow || YYERROR_VERBOSE
443 /* The parser invokes alloca or malloc; define the necessary symbols. */
445 # ifdef YYSTACK_USE_ALLOCA
446 # if YYSTACK_USE_ALLOCA
448 # define YYSTACK_ALLOC __builtin_alloca
449 # elif defined __BUILTIN_VA_ARG_INCR
450 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
452 # define YYSTACK_ALLOC __alloca
453 # elif defined _MSC_VER
454 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
455 # define alloca _alloca
457 # define YYSTACK_ALLOC alloca
458 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
459 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
460 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
461 # ifndef EXIT_SUCCESS
462 # define EXIT_SUCCESS 0
469 # ifdef YYSTACK_ALLOC
470 /* Pacify GCC's 'empty if-body' warning. */
471 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
472 # ifndef YYSTACK_ALLOC_MAXIMUM
473 /* The OS might guarantee only one guard page at the bottom of the stack,
474 and a page size can be as small as 4096 bytes. So we cannot safely
475 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
476 to allow for a few compiler-allocated temporary stack slots. */
477 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
480 # define YYSTACK_ALLOC YYMALLOC
481 # define YYSTACK_FREE YYFREE
482 # ifndef YYSTACK_ALLOC_MAXIMUM
483 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
485 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
486 && ! ((defined YYMALLOC || defined malloc) \
487 && (defined YYFREE || defined free)))
488 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
489 # ifndef EXIT_SUCCESS
490 # define EXIT_SUCCESS 0
494 # define YYMALLOC malloc
495 # if ! defined malloc && ! defined EXIT_SUCCESS
496 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
501 # if ! defined free && ! defined EXIT_SUCCESS
502 void free (void *); /* INFRINGES ON USER NAME SPACE */
506 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
509 #if (! defined yyoverflow \
510 && (! defined __cplusplus \
511 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
513 /* A type that is properly aligned for any stack member. */
516 yytype_int16 yyss_alloc;
520 /* The size of the maximum gap between one aligned stack and the next. */
521 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
523 /* The size of an array large to enough to hold all stacks, each with
525 # define YYSTACK_BYTES(N) \
526 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
527 + YYSTACK_GAP_MAXIMUM)
529 # define YYCOPY_NEEDED 1
531 /* Relocate STACK from its old location to the new one. The
532 local variables YYSIZE and YYSTACKSIZE give the old and new number of
533 elements in the stack, and YYPTR gives the new location of the
534 stack. Advance YYPTR to a properly aligned location for the next
536 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
539 YYSIZE_T yynewbytes; \
540 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
541 Stack = &yyptr->Stack_alloc; \
542 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
543 yyptr += yynewbytes / sizeof (*yyptr); \
549 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
550 /* Copy COUNT objects from SRC to DST. The source and destination do
553 # if defined __GNUC__ && 1 < __GNUC__
554 # define YYCOPY(Dst, Src, Count) \
555 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
557 # define YYCOPY(Dst, Src, Count) \
561 for (yyi = 0; yyi < (Count); yyi++) \
562 (Dst)[yyi] = (Src)[yyi]; \
567 #endif /* !YYCOPY_NEEDED */
569 /* YYFINAL -- State number of the termination state. */
571 /* YYLAST -- Last index in YYTABLE. */
574 /* YYNTOKENS -- Number of terminals. */
576 /* YYNNTS -- Number of nonterminals. */
578 /* YYNRULES -- Number of rules. */
580 /* YYNSTATES -- Number of states. */
583 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
584 by yylex, with out-of-bounds checking. */
586 #define YYMAXUTOK 290
588 #define YYTRANSLATE(YYX) \
589 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
591 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
592 as returned by yylex, without out-of-bounds checking. */
593 static const yytype_uint8 yytranslate[] =
595 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
603 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
604 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
605 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
621 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
622 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
623 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
628 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
629 static const yytype_uint16 yyrline[] =
631 0, 178, 178, 179, 181, 182, 183, 184, 185, 186,
632 187, 188, 189, 191, 208, 213, 220, 225, 231, 236,
633 237, 239, 247, 253, 275, 285, 296, 297, 299, 359,
634 365, 372, 373, 375, 376, 377, 378, 379, 380, 381,
635 382, 383, 387, 388, 390, 396, 397, 398, 399, 400,
640 #if YYDEBUG || YYERROR_VERBOSE || 1
641 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
642 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
643 static const char *const yytname[] =
645 "$end", "error", "$undefined", "EOL", "NUMBER", "LITERAL", "CHARSET",
646 "KEYMAPS", "KEYCODE", "EQUALS", "PLAIN", "SHIFT", "CONTROL", "ALT",
647 "ALTGR", "SHIFTL", "SHIFTR", "CTRLL", "CTRLR", "CAPSSHIFT", "COMMA",
648 "DASH", "STRING", "STRLITERAL", "COMPOSE", "TO", "CCHAR", "ERROR",
649 "PLUS", "UNUMBER", "ALT_IS_META", "STRINGS", "AS", "USUAL", "ON", "FOR",
650 "$accept", "keytable", "line", "charsetline", "altismetaline",
651 "usualstringsline", "usualcomposeline", "keymapline", "range", "range0",
652 "strline", "compline", "compsym", "singleline", "modifiers", "modifier",
653 "rvalue0", "rvalue1", "rvalue", YY_NULLPTR
658 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
659 (internal) symbol number NUM (which must be that of a token). */
660 static const yytype_uint16 yytoknum[] =
662 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
663 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
664 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
665 285, 286, 287, 288, 289, 290
669 #define YYPACT_NINF -31
671 #define yypact_value_is_default(Yystate) \
672 (!!((Yystate) == (-31)))
674 #define YYTABLE_NINF -1
676 #define yytable_value_is_error(Yytable_value) \
679 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
681 static const yytype_int8 yypact[] =
683 -31, 3, -31, -31, -22, -2, 4, -1, -31, -31,
684 -31, -31, -31, -31, -31, -31, -31, 7, 10, 35,
685 8, -31, -31, -31, -31, -31, -31, -31, -31, -31,
686 45, -31, 41, 24, 32, -31, 42, 46, 56, -31,
687 -31, 21, 20, -31, 33, 63, -31, -31, 64, -31,
688 -2, 19, 60, 47, -3, 48, 68, 65, -31, -31,
689 -31, -31, 26, -31, 69, 19, -31, 19, 72, -31,
690 53, 0, -31, 19, -31, -31, -31, -31, -31, 74,
691 -31, 75, 76, 77, 78, -31, -31, -31, -31, -31
694 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
695 Performed when YYTABLE does not specify something else to do. Zero
696 means the default is an error. */
697 static const yytype_uint8 yydefact[] =
699 2, 0, 1, 4, 0, 0, 0, 0, 33, 34,
700 35, 36, 37, 38, 39, 40, 41, 0, 0, 0,
701 0, 3, 5, 6, 7, 8, 9, 11, 12, 10,
702 0, 32, 0, 22, 0, 20, 0, 0, 0, 26,
703 27, 0, 0, 14, 0, 0, 31, 13, 0, 18,
704 0, 42, 0, 0, 0, 0, 0, 0, 21, 19,
705 45, 49, 0, 47, 0, 42, 44, 0, 0, 17,
706 0, 0, 15, 0, 46, 50, 48, 28, 43, 0,
707 23, 0, 0, 0, 0, 30, 16, 24, 25, 29
710 /* YYPGOTO[NTERM-NUM]. */
711 static const yytype_int8 yypgoto[] =
713 -31, -31, -31, -31, -31, -31, -31, -31, -31, 34,
714 -31, -31, 40, -31, -31, 55, 18, -31, -30
717 /* YYDEFGOTO[NTERM-NUM]. */
718 static const yytype_int8 yydefgoto[] =
720 -1, 1, 21, 22, 23, 24, 25, 26, 34, 35,
721 27, 28, 42, 29, 30, 31, 64, 65, 66
724 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
725 positive, shift that token. If negative, reduce the rule whose
726 number is the opposite. If YYTABLE_NINF, syntax error. */
727 static const yytype_uint8 yytable[] =
729 69, 32, 33, 2, 60, 61, 3, 37, 36, 4,
730 5, 6, 38, 7, 8, 9, 10, 11, 12, 13,
731 14, 15, 16, 60, 61, 17, 82, 18, 62, 63,
732 74, 75, 70, 19, 20, 49, 39, 79, 43, 40,
733 44, 83, 41, 84, 47, 48, 39, 62, 63, 40,
734 52, 51, 50, 45, 54, 76, 8, 9, 10, 11,
735 12, 13, 14, 15, 16, 53, 56, 57, 58, 67,
736 68, 72, 77, 71, 73, 80, 81, 85, 86, 87,
737 88, 89, 55, 78, 59, 46
740 static const yytype_uint8 yycheck[] =
742 3, 23, 4, 0, 4, 5, 3, 8, 4, 6,
743 7, 8, 5, 10, 11, 12, 13, 14, 15, 16,
744 17, 18, 19, 4, 5, 22, 26, 24, 28, 29,
745 4, 5, 35, 30, 31, 3, 26, 67, 3, 29,
746 32, 71, 32, 73, 3, 21, 26, 28, 29, 29,
747 4, 9, 20, 8, 33, 29, 11, 12, 13, 14,
748 15, 16, 17, 18, 19, 9, 33, 4, 4, 9,
749 23, 3, 3, 25, 9, 3, 23, 3, 3, 3,
753 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
754 symbol of state STATE-NUM. */
755 static const yytype_uint8 yystos[] =
757 0, 37, 0, 3, 6, 7, 8, 10, 11, 12,
758 13, 14, 15, 16, 17, 18, 19, 22, 24, 30,
759 31, 38, 39, 40, 41, 42, 43, 46, 47, 49,
760 50, 51, 23, 4, 44, 45, 4, 8, 5, 26,
761 29, 32, 48, 3, 32, 8, 51, 3, 21, 3,
762 20, 9, 4, 9, 33, 48, 33, 4, 4, 45,
763 4, 5, 28, 29, 52, 53, 54, 9, 23, 3,
764 35, 25, 3, 9, 4, 5, 29, 3, 52, 54,
765 3, 23, 26, 54, 54, 3, 3, 3, 3, 3
768 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
769 static const yytype_uint8 yyr1[] =
771 0, 36, 37, 37, 38, 38, 38, 38, 38, 38,
772 38, 38, 38, 39, 40, 41, 42, 42, 43, 44,
773 44, 45, 45, 46, 47, 47, 48, 48, 49, 49,
774 49, 50, 50, 51, 51, 51, 51, 51, 51, 51,
775 51, 51, 52, 52, 53, 54, 54, 54, 54, 54,
779 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
780 static const yytype_uint8 yyr2[] =
782 0, 2, 0, 2, 1, 1, 1, 1, 1, 1,
783 1, 1, 1, 3, 2, 4, 6, 4, 3, 3,
784 1, 3, 1, 5, 6, 6, 1, 1, 5, 6,
785 6, 2, 1, 1, 1, 1, 1, 1, 1, 1,
786 1, 1, 0, 2, 1, 1, 2, 1, 2, 1,
791 #define yyerrok (yyerrstatus = 0)
792 #define yyclearin (yychar = YYEMPTY)
796 #define YYACCEPT goto yyacceptlab
797 #define YYABORT goto yyabortlab
798 #define YYERROR goto yyerrorlab
801 #define YYRECOVERING() (!!yyerrstatus)
803 #define YYBACKUP(Token, Value) \
805 if (yychar == YYEMPTY) \
809 YYPOPSTACK (yylen); \
815 yyerror (scanner, ctx, YY_("syntax error: cannot back up")); \
820 /* Error token number */
822 #define YYERRCODE 256
826 /* Enable debugging if requested. */
830 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
831 # define YYFPRINTF fprintf
834 # define YYDPRINTF(Args) \
840 /* This macro is provided for backward compatibility. */
841 #ifndef YY_LOCATION_PRINT
842 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
846 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
850 YYFPRINTF (stderr, "%s ", Title); \
851 yy_symbol_print (stderr, \
852 Type, Value, scanner, ctx); \
853 YYFPRINTF (stderr, "\n"); \
858 /*----------------------------------------.
859 | Print this symbol's value on YYOUTPUT. |
860 `----------------------------------------*/
863 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct lk_ctx *ctx)
865 FILE *yyo = yyoutput;
872 if (yytype < YYNTOKENS)
873 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
879 /*--------------------------------.
880 | Print this symbol on YYOUTPUT. |
881 `--------------------------------*/
884 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *scanner, struct lk_ctx *ctx)
886 YYFPRINTF (yyoutput, "%s %s (",
887 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
889 yy_symbol_value_print (yyoutput, yytype, yyvaluep, scanner, ctx);
890 YYFPRINTF (yyoutput, ")");
893 /*------------------------------------------------------------------.
894 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
896 `------------------------------------------------------------------*/
899 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
901 YYFPRINTF (stderr, "Stack now");
902 for (; yybottom <= yytop; yybottom++)
904 int yybot = *yybottom;
905 YYFPRINTF (stderr, " %d", yybot);
907 YYFPRINTF (stderr, "\n");
910 # define YY_STACK_PRINT(Bottom, Top) \
913 yy_stack_print ((Bottom), (Top)); \
917 /*------------------------------------------------.
918 | Report that the YYRULE is going to be reduced. |
919 `------------------------------------------------*/
922 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, void *scanner, struct lk_ctx *ctx)
924 unsigned long int yylno = yyrline[yyrule];
925 int yynrhs = yyr2[yyrule];
927 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
929 /* The symbols being reduced. */
930 for (yyi = 0; yyi < yynrhs; yyi++)
932 YYFPRINTF (stderr, " $%d = ", yyi + 1);
933 yy_symbol_print (stderr,
934 yystos[yyssp[yyi + 1 - yynrhs]],
935 &(yyvsp[(yyi + 1) - (yynrhs)])
937 YYFPRINTF (stderr, "\n");
941 # define YY_REDUCE_PRINT(Rule) \
944 yy_reduce_print (yyssp, yyvsp, Rule, scanner, ctx); \
947 /* Nonzero means print parse trace. It is left uninitialized so that
948 multiple parsers can coexist. */
951 # define YYDPRINTF(Args)
952 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
953 # define YY_STACK_PRINT(Bottom, Top)
954 # define YY_REDUCE_PRINT(Rule)
955 #endif /* !YYDEBUG */
958 /* YYINITDEPTH -- initial size of the parser's stacks. */
960 # define YYINITDEPTH 200
963 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
964 if the built-in stack extension method is used).
966 Do not make this value too large; the results are undefined if
967 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
968 evaluated with infinite-precision integer arithmetic. */
971 # define YYMAXDEPTH 10000
978 # if defined __GLIBC__ && defined _STRING_H
979 # define yystrlen strlen
981 /* Return the length of YYSTR. */
983 yystrlen (const char *yystr)
986 for (yylen = 0; yystr[yylen]; yylen++)
994 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
995 # define yystpcpy stpcpy
997 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1000 yystpcpy (char *yydest, const char *yysrc)
1003 const char *yys = yysrc;
1005 while ((*yyd++ = *yys++) != '\0')
1014 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1015 quotes and backslashes, so that it's suitable for yyerror. The
1016 heuristic is that double-quoting is unnecessary unless the string
1017 contains an apostrophe, a comma, or backslash (other than
1018 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1019 null, do not copy; instead, return the length of what the result
1022 yytnamerr (char *yyres, const char *yystr)
1027 char const *yyp = yystr;
1034 goto do_not_strip_quotes;
1038 goto do_not_strip_quotes;
1051 do_not_strip_quotes: ;
1055 return yystrlen (yystr);
1057 return yystpcpy (yyres, yystr) - yyres;
1061 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1062 about the unexpected token YYTOKEN for the state stack whose top is
1065 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1066 not large enough to hold the message. In that case, also set
1067 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1068 required number of bytes is too large to store. */
1070 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1071 yytype_int16 *yyssp, int yytoken)
1073 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1074 YYSIZE_T yysize = yysize0;
1075 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1076 /* Internationalized format string. */
1077 const char *yyformat = YY_NULLPTR;
1078 /* Arguments of yyformat. */
1079 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1080 /* Number of reported tokens (one for the "unexpected", one per
1084 /* There are many possibilities here to consider:
1085 - If this state is a consistent state with a default action, then
1086 the only way this function was invoked is if the default action
1087 is an error action. In that case, don't check for expected
1088 tokens because there are none.
1089 - The only way there can be no lookahead present (in yychar) is if
1090 this state is a consistent state with a default action. Thus,
1091 detecting the absence of a lookahead is sufficient to determine
1092 that there is no unexpected or expected token to report. In that
1093 case, just report a simple "syntax error".
1094 - Don't assume there isn't a lookahead just because this state is a
1095 consistent state with a default action. There might have been a
1096 previous inconsistent state, consistent state with a non-default
1097 action, or user semantic action that manipulated yychar.
1098 - Of course, the expected token list depends on states to have
1099 correct lookahead information, and it depends on the parser not
1100 to perform extra reductions after fetching a lookahead from the
1101 scanner and before detecting a syntax error. Thus, state merging
1102 (from LALR or IELR) and default reductions corrupt the expected
1103 token list. However, the list is correct for canonical LR with
1104 one exception: it will still contain any token that will not be
1105 accepted due to an error action in a later state.
1107 if (yytoken != YYEMPTY)
1109 int yyn = yypact[*yyssp];
1110 yyarg[yycount++] = yytname[yytoken];
1111 if (!yypact_value_is_default (yyn))
1113 /* Start YYX at -YYN if negative to avoid negative indexes in
1114 YYCHECK. In other words, skip the first -YYN actions for
1115 this state because they are default actions. */
1116 int yyxbegin = yyn < 0 ? -yyn : 0;
1117 /* Stay within bounds of both yycheck and yytname. */
1118 int yychecklim = YYLAST - yyn + 1;
1119 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1122 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1123 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1124 && !yytable_value_is_error (yytable[yyx + yyn]))
1126 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1132 yyarg[yycount++] = yytname[yyx];
1134 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1135 if (! (yysize <= yysize1
1136 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1146 # define YYCASE_(N, S) \
1150 default: /* Avoid compiler warnings. */
1151 YYCASE_(0, YY_("syntax error"));
1152 YYCASE_(1, YY_("syntax error, unexpected %s"));
1153 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1154 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1155 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1156 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1161 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1162 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1167 if (*yymsg_alloc < yysize)
1169 *yymsg_alloc = 2 * yysize;
1170 if (! (yysize <= *yymsg_alloc
1171 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1172 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1176 /* Avoid sprintf, as that infringes on the user's name space.
1177 Don't have undefined behavior even if the translation
1178 produced a string with the wrong number of "%s"s. */
1182 while ((*yyp = *yyformat) != '\0')
1183 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1185 yyp += yytnamerr (yyp, yyarg[yyi++]);
1196 #endif /* YYERROR_VERBOSE */
1198 /*-----------------------------------------------.
1199 | Release the memory associated to this symbol. |
1200 `-----------------------------------------------*/
1203 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *scanner, struct lk_ctx *ctx)
1210 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1212 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1214 YY_IGNORE_MAYBE_UNINITIALIZED_END
1225 yyparse (void *scanner, struct lk_ctx *ctx)
1227 /* The lookahead symbol. */
1231 /* The semantic value of the lookahead symbol. */
1232 /* Default value used for initialization, for pacifying older GCCs
1233 or non-GCC compilers. */
1234 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1235 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1237 /* Number of syntax errors so far. */
1241 /* Number of tokens to shift before error messages enabled. */
1244 /* The stacks and their tools:
1245 'yyss': related to states.
1246 'yyvs': related to semantic values.
1248 Refer to the stacks through separate pointers, to allow yyoverflow
1249 to reallocate them elsewhere. */
1251 /* The state stack. */
1252 yytype_int16 yyssa[YYINITDEPTH];
1254 yytype_int16 *yyssp;
1256 /* The semantic value stack. */
1257 YYSTYPE yyvsa[YYINITDEPTH];
1261 YYSIZE_T yystacksize;
1265 /* Lookahead token as an internal (translated) token number. */
1267 /* The variables used to return semantic value and location from the
1272 /* Buffer for error messages, and its allocated size. */
1274 char *yymsg = yymsgbuf;
1275 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1278 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1280 /* The number of symbols on the RHS of the reduced rule.
1281 Keep to zero when no symbol should be popped. */
1284 yyssp = yyss = yyssa;
1285 yyvsp = yyvs = yyvsa;
1286 yystacksize = YYINITDEPTH;
1288 YYDPRINTF ((stderr, "Starting parse\n"));
1293 yychar = YYEMPTY; /* Cause a token to be read. */
1296 /*------------------------------------------------------------.
1297 | yynewstate -- Push a new state, which is found in yystate. |
1298 `------------------------------------------------------------*/
1300 /* In all cases, when you get here, the value and location stacks
1301 have just been pushed. So pushing a state here evens the stacks. */
1307 if (yyss + yystacksize - 1 <= yyssp)
1309 /* Get the current used size of the three stacks, in elements. */
1310 YYSIZE_T yysize = yyssp - yyss + 1;
1314 /* Give user a chance to reallocate the stack. Use copies of
1315 these so that the &'s don't force the real ones into
1317 YYSTYPE *yyvs1 = yyvs;
1318 yytype_int16 *yyss1 = yyss;
1320 /* Each stack pointer address is followed by the size of the
1321 data in use in that stack, in bytes. This used to be a
1322 conditional around just the two extra args, but that might
1323 be undefined if yyoverflow is a macro. */
1324 yyoverflow (YY_("memory exhausted"),
1325 &yyss1, yysize * sizeof (*yyssp),
1326 &yyvs1, yysize * sizeof (*yyvsp),
1332 #else /* no yyoverflow */
1333 # ifndef YYSTACK_RELOCATE
1334 goto yyexhaustedlab;
1336 /* Extend the stack our own way. */
1337 if (YYMAXDEPTH <= yystacksize)
1338 goto yyexhaustedlab;
1340 if (YYMAXDEPTH < yystacksize)
1341 yystacksize = YYMAXDEPTH;
1344 yytype_int16 *yyss1 = yyss;
1345 union yyalloc *yyptr =
1346 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1348 goto yyexhaustedlab;
1349 YYSTACK_RELOCATE (yyss_alloc, yyss);
1350 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1351 # undef YYSTACK_RELOCATE
1353 YYSTACK_FREE (yyss1);
1356 #endif /* no yyoverflow */
1358 yyssp = yyss + yysize - 1;
1359 yyvsp = yyvs + yysize - 1;
1361 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1362 (unsigned long int) yystacksize));
1364 if (yyss + yystacksize - 1 <= yyssp)
1368 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1370 if (yystate == YYFINAL)
1380 /* Do appropriate processing given the current state. Read a
1381 lookahead token if we need one and don't already have one. */
1383 /* First try to decide what to do without reference to lookahead token. */
1384 yyn = yypact[yystate];
1385 if (yypact_value_is_default (yyn))
1388 /* Not known => get a lookahead token if don't already have one. */
1390 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1391 if (yychar == YYEMPTY)
1393 YYDPRINTF ((stderr, "Reading a token: "));
1394 yychar = yylex (&yylval, scanner);
1397 if (yychar <= YYEOF)
1399 yychar = yytoken = YYEOF;
1400 YYDPRINTF ((stderr, "Now at end of input.\n"));
1404 yytoken = YYTRANSLATE (yychar);
1405 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1408 /* If the proper action on seeing token YYTOKEN is to reduce or to
1409 detect an error, take that action. */
1411 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1416 if (yytable_value_is_error (yyn))
1422 /* Count tokens shifted since error; after three, turn off error
1427 /* Shift the lookahead token. */
1428 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1430 /* Discard the shifted token. */
1434 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1436 YY_IGNORE_MAYBE_UNINITIALIZED_END
1441 /*-----------------------------------------------------------.
1442 | yydefault -- do the default action for the current state. |
1443 `-----------------------------------------------------------*/
1445 yyn = yydefact[yystate];
1451 /*-----------------------------.
1452 | yyreduce -- Do a reduction. |
1453 `-----------------------------*/
1455 /* yyn is the number of a rule to reduce with. */
1458 /* If YYLEN is nonzero, implement the default value of the action:
1461 Otherwise, the following line sets YYVAL to garbage.
1462 This behavior is undocumented and Bison
1463 users should not rely upon it. Assigning to YYVAL
1464 unconditionally makes the parser a bit smaller, and it avoids a
1465 GCC warning that YYVAL may be used uninitialized. */
1466 yyval = yyvsp[1-yylen];
1469 YY_REDUCE_PRINT (yyn);
1473 #line 192 "parser.y" /* yacc.c:1648 */
1475 if (lk_set_charset(ctx, (char *) (yyvsp[-1].str).data)) {
1477 _("unknown charset %s - ignoring charset request\n"),
1478 (char *) (yyvsp[-1].str).data);
1481 ctx->keywords |= LK_KEYWORD_CHARSET;
1483 /* Unicode: The first 256 code points were made
1484 identical to the content of ISO 8859-1 */
1485 if (ctx->flags & LK_FLAG_PREFER_UNICODE &&
1486 !strcasecmp((char *) (yyvsp[-1].str).data, "iso-8859-1"))
1487 ctx->flags ^= LK_FLAG_PREFER_UNICODE;
1489 #line 1490 "parser.c" /* yacc.c:1648 */
1493 #line 209 "parser.y" /* yacc.c:1648 */
1495 ctx->keywords |= LK_KEYWORD_ALTISMETA;
1497 #line 1498 "parser.c" /* yacc.c:1648 */
1501 #line 214 "parser.y" /* yacc.c:1648 */
1503 if (strings_as_usual(ctx) == -1)
1505 ctx->keywords |= LK_KEYWORD_STRASUSUAL;
1507 #line 1508 "parser.c" /* yacc.c:1648 */
1511 #line 221 "parser.y" /* yacc.c:1648 */
1513 if (compose_as_usual(ctx, (char *) (yyvsp[-1].str).data) == -1)
1516 #line 1517 "parser.c" /* yacc.c:1648 */
1520 #line 226 "parser.y" /* yacc.c:1648 */
1522 if (compose_as_usual(ctx, 0) == -1)
1525 #line 1526 "parser.c" /* yacc.c:1648 */
1529 #line 232 "parser.y" /* yacc.c:1648 */
1531 ctx->keywords |= LK_KEYWORD_KEYMAPS;
1533 #line 1534 "parser.c" /* yacc.c:1648 */
1537 #line 240 "parser.y" /* yacc.c:1648 */
1540 for (i = (yyvsp[-2].num); i <= (yyvsp[0].num); i++) {
1541 if (lk_add_map(ctx, i) == -1)
1545 #line 1546 "parser.c" /* yacc.c:1648 */
1549 #line 248 "parser.y" /* yacc.c:1648 */
1551 if (lk_add_map(ctx, (yyvsp[0].num)) == -1)
1554 #line 1555 "parser.c" /* yacc.c:1648 */
1558 #line 254 "parser.y" /* yacc.c:1648 */
1562 if (KTYP((yyvsp[-3].num)) != KT_FN) {
1563 ERR(ctx, _("'%s' is not a function key symbol"),
1564 get_sym(ctx, KTYP((yyvsp[-3].num)), KVAL((yyvsp[-3].num))));
1568 ke.kb_func = (unsigned char) KVAL((yyvsp[-3].num));
1570 strncpy((char *) ke.kb_string,
1571 (char *) (yyvsp[-1].str).data,
1572 sizeof(ke.kb_string));
1574 ke.kb_string[sizeof(ke.kb_string) - 1] = 0;
1576 if (lk_add_func(ctx, &ke) == -1)
1579 #line 1580 "parser.c" /* yacc.c:1648 */
1583 #line 276 "parser.y" /* yacc.c:1648 */
1585 struct lk_kbdiacr ptr;
1586 ptr.diacr = (unsigned int) (yyvsp[-4].num);
1587 ptr.base = (unsigned int) (yyvsp[-3].num);
1588 ptr.result = (unsigned int) (yyvsp[-1].num);
1590 if (lk_append_compose(ctx, &ptr) == -1)
1593 #line 1594 "parser.c" /* yacc.c:1648 */
1597 #line 286 "parser.y" /* yacc.c:1648 */
1599 struct lk_kbdiacr ptr;
1600 ptr.diacr = (unsigned int) (yyvsp[-4].num);
1601 ptr.base = (unsigned int) (yyvsp[-3].num);
1602 ptr.result = (unsigned int) (yyvsp[-1].num);
1604 if (lk_append_compose(ctx, &ptr) == -1)
1607 #line 1608 "parser.c" /* yacc.c:1648 */
1611 #line 296 "parser.y" /* yacc.c:1648 */
1612 { (yyval.num) = (yyvsp[0].num); }
1613 #line 1614 "parser.c" /* yacc.c:1648 */
1617 #line 297 "parser.y" /* yacc.c:1648 */
1618 { (yyval.num) = (yyvsp[0].num) ^ 0xf000; }
1619 #line 1620 "parser.c" /* yacc.c:1648 */
1623 #line 300 "parser.y" /* yacc.c:1648 */
1628 if (ctx->key_line->count == 1) {
1630 /* Some files do not have a keymaps line, and
1631 * we have to wait until all input has been read
1632 * before we know which maps to fill. */
1633 lk_array_set(ctx->key_constant, (yyvsp[-3].num), &one);
1635 /* On the other hand, we now have include files,
1636 * and it should be possible to override lines
1637 * from an include file. So, kill old defs. */
1638 for (j = 0; j < ctx->keymap->total; j++) {
1639 if (!lk_map_exists(ctx, j))
1642 if (lk_del_key(ctx, j, (yyvsp[-3].num)) < 0)
1647 if (ctx->keywords & LK_KEYWORD_KEYMAPS) {
1650 for (j = 0; j < ctx->keymap->total; j++) {
1651 if (!lk_map_exists(ctx, j))
1654 if (ctx->key_line->count != 1 || i == 0) {
1657 if (i < ctx->key_line->count) {
1658 val = lk_array_get(ctx->key_line, i);
1662 if (lk_add_key(ctx, j, (yyvsp[-3].num), keycode) < 0)
1668 if (i < ctx->key_line->count) {
1669 ERR(ctx, _("too many (%ld) entries on one line"),
1670 ctx->key_line->count);
1674 for (i = 0; i < ctx->key_line->count; i++) {
1675 val = lk_array_get(ctx->key_line, i);
1677 if (lk_add_key(ctx, i, (yyvsp[-3].num), *val) < 0)
1682 #line 1683 "parser.c" /* yacc.c:1648 */
1686 #line 360 "parser.y" /* yacc.c:1648 */
1688 if (lk_add_key(ctx, ctx->mod, (yyvsp[-3].num), (yyvsp[-1].num)) < 0)
1692 #line 1693 "parser.c" /* yacc.c:1648 */
1696 #line 366 "parser.y" /* yacc.c:1648 */
1698 if (lk_add_key(ctx, 0, (yyvsp[-3].num), (yyvsp[-1].num)) < 0)
1702 #line 1703 "parser.c" /* yacc.c:1648 */
1706 #line 375 "parser.y" /* yacc.c:1648 */
1707 { ctx->mod |= M_SHIFT; }
1708 #line 1709 "parser.c" /* yacc.c:1648 */
1712 #line 376 "parser.y" /* yacc.c:1648 */
1713 { ctx->mod |= M_CTRL; }
1714 #line 1715 "parser.c" /* yacc.c:1648 */
1718 #line 377 "parser.y" /* yacc.c:1648 */
1719 { ctx->mod |= M_ALT; }
1720 #line 1721 "parser.c" /* yacc.c:1648 */
1724 #line 378 "parser.y" /* yacc.c:1648 */
1725 { ctx->mod |= M_ALTGR; }
1726 #line 1727 "parser.c" /* yacc.c:1648 */
1730 #line 379 "parser.y" /* yacc.c:1648 */
1731 { ctx->mod |= M_SHIFTL; }
1732 #line 1733 "parser.c" /* yacc.c:1648 */
1736 #line 380 "parser.y" /* yacc.c:1648 */
1737 { ctx->mod |= M_SHIFTR; }
1738 #line 1739 "parser.c" /* yacc.c:1648 */
1742 #line 381 "parser.y" /* yacc.c:1648 */
1743 { ctx->mod |= M_CTRLL; }
1744 #line 1745 "parser.c" /* yacc.c:1648 */
1748 #line 382 "parser.y" /* yacc.c:1648 */
1749 { ctx->mod |= M_CTRLR; }
1750 #line 1751 "parser.c" /* yacc.c:1648 */
1754 #line 383 "parser.y" /* yacc.c:1648 */
1755 { ctx->mod |= M_CAPSSHIFT; }
1756 #line 1757 "parser.c" /* yacc.c:1648 */
1760 #line 391 "parser.y" /* yacc.c:1648 */
1762 int val = (yyvsp[0].num);
1763 lk_array_append(ctx->key_line, &val);
1765 #line 1766 "parser.c" /* yacc.c:1648 */
1769 #line 396 "parser.y" /* yacc.c:1648 */
1770 { (yyval.num) = convert_code(ctx, (yyvsp[0].num), TO_AUTO); }
1771 #line 1772 "parser.c" /* yacc.c:1648 */
1775 #line 397 "parser.y" /* yacc.c:1648 */
1776 { (yyval.num) = add_capslock(ctx, (yyvsp[0].num)); }
1777 #line 1778 "parser.c" /* yacc.c:1648 */
1781 #line 398 "parser.y" /* yacc.c:1648 */
1782 { (yyval.num) = convert_code(ctx, (yyvsp[0].num)^0xf000, TO_AUTO); }
1783 #line 1784 "parser.c" /* yacc.c:1648 */
1787 #line 399 "parser.y" /* yacc.c:1648 */
1788 { (yyval.num) = add_capslock(ctx, (yyvsp[0].num)^0xf000); }
1789 #line 1790 "parser.c" /* yacc.c:1648 */
1793 #line 400 "parser.y" /* yacc.c:1648 */
1794 { (yyval.num) = (yyvsp[0].num); }
1795 #line 1796 "parser.c" /* yacc.c:1648 */
1799 #line 401 "parser.y" /* yacc.c:1648 */
1800 { (yyval.num) = add_capslock(ctx, (yyvsp[0].num)); }
1801 #line 1802 "parser.c" /* yacc.c:1648 */
1805 #line 1806 "parser.c" /* yacc.c:1648 */
1808 /* User semantic actions sometimes alter yychar, and that requires
1809 that yytoken be updated with the new translation. We take the
1810 approach of translating immediately before every use of yytoken.
1811 One alternative is translating here after every semantic action,
1812 but that translation would be missed if the semantic action invokes
1813 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1814 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1815 incorrect destructor might then be invoked immediately. In the
1816 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1817 to an incorrect destructor call or verbose syntax error message
1818 before the lookahead is translated. */
1819 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1823 YY_STACK_PRINT (yyss, yyssp);
1827 /* Now 'shift' the result of the reduction. Determine what state
1828 that goes to, based on the state we popped back to and the rule
1829 number reduced by. */
1833 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1834 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1835 yystate = yytable[yystate];
1837 yystate = yydefgoto[yyn - YYNTOKENS];
1842 /*--------------------------------------.
1843 | yyerrlab -- here on detecting error. |
1844 `--------------------------------------*/
1846 /* Make sure we have latest lookahead translation. See comments at
1847 user semantic actions for why this is necessary. */
1848 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1850 /* If not already recovering from an error, report this error. */
1854 #if ! YYERROR_VERBOSE
1855 yyerror (scanner, ctx, YY_("syntax error"));
1857 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1860 char const *yymsgp = YY_("syntax error");
1861 int yysyntax_error_status;
1862 yysyntax_error_status = YYSYNTAX_ERROR;
1863 if (yysyntax_error_status == 0)
1865 else if (yysyntax_error_status == 1)
1867 if (yymsg != yymsgbuf)
1868 YYSTACK_FREE (yymsg);
1869 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1873 yymsg_alloc = sizeof yymsgbuf;
1874 yysyntax_error_status = 2;
1878 yysyntax_error_status = YYSYNTAX_ERROR;
1882 yyerror (scanner, ctx, yymsgp);
1883 if (yysyntax_error_status == 2)
1884 goto yyexhaustedlab;
1886 # undef YYSYNTAX_ERROR
1892 if (yyerrstatus == 3)
1894 /* If just tried and failed to reuse lookahead token after an
1895 error, discard it. */
1897 if (yychar <= YYEOF)
1899 /* Return failure if at end of input. */
1900 if (yychar == YYEOF)
1905 yydestruct ("Error: discarding",
1906 yytoken, &yylval, scanner, ctx);
1911 /* Else will try to reuse lookahead token after shifting the error
1916 /*---------------------------------------------------.
1917 | yyerrorlab -- error raised explicitly by YYERROR. |
1918 `---------------------------------------------------*/
1921 /* Pacify compilers like GCC when the user code never invokes
1922 YYERROR and the label yyerrorlab therefore never appears in user
1924 if (/*CONSTCOND*/ 0)
1927 /* Do not reclaim the symbols of the rule whose action triggered
1931 YY_STACK_PRINT (yyss, yyssp);
1936 /*-------------------------------------------------------------.
1937 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1938 `-------------------------------------------------------------*/
1940 yyerrstatus = 3; /* Each real token shifted decrements this. */
1944 yyn = yypact[yystate];
1945 if (!yypact_value_is_default (yyn))
1948 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1956 /* Pop the current state because it cannot handle the error token. */
1961 yydestruct ("Error: popping",
1962 yystos[yystate], yyvsp, scanner, ctx);
1965 YY_STACK_PRINT (yyss, yyssp);
1968 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1970 YY_IGNORE_MAYBE_UNINITIALIZED_END
1973 /* Shift the error token. */
1974 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1980 /*-------------------------------------.
1981 | yyacceptlab -- YYACCEPT comes here. |
1982 `-------------------------------------*/
1987 /*-----------------------------------.
1988 | yyabortlab -- YYABORT comes here. |
1989 `-----------------------------------*/
1994 #if !defined yyoverflow || YYERROR_VERBOSE
1995 /*-------------------------------------------------.
1996 | yyexhaustedlab -- memory exhaustion comes here. |
1997 `-------------------------------------------------*/
1999 yyerror (scanner, ctx, YY_("memory exhausted"));
2005 if (yychar != YYEMPTY)
2007 /* Make sure we have latest lookahead translation. See comments at
2008 user semantic actions for why this is necessary. */
2009 yytoken = YYTRANSLATE (yychar);
2010 yydestruct ("Cleanup: discarding lookahead",
2011 yytoken, &yylval, scanner, ctx);
2013 /* Do not reclaim the symbols of the rule whose action triggered
2014 this YYABORT or YYACCEPT. */
2016 YY_STACK_PRINT (yyss, yyssp);
2017 while (yyssp != yyss)
2019 yydestruct ("Cleanup: popping",
2020 yystos[*yyssp], yyvsp, scanner, ctx);
2025 YYSTACK_FREE (yyss);
2028 if (yymsg != yymsgbuf)
2029 YYSTACK_FREE (yymsg);
2033 #line 403 "parser.y" /* yacc.c:1907 */
2037 lk_parse_keymap(struct lk_ctx *ctx, struct kbdfile *fp)
2044 yylex_init_extra(ctx, &scanner);
2046 INFO(ctx, _("Loading %s"), kbdfile_get_pathname(fp));
2048 if (stack_push(ctx, fp, scanner) == -1)
2051 if (yyparse(scanner, ctx))
2057 stack_pop(ctx, scanner);
2059 yylex_destroy(scanner);