67#define YYBISON_VERSION "2.4.1"
70#define YYSKELETON_NAME "yacc.c"
96extern int yylex(
void);
97extern int yyerror(
const char*);
99extern cmd_t* cmds[MAX_CMDS];
107char* quote_char(
char c);
108void combine_strings(
char* dest,
const char* head,
const char* tail);
109cmd_t* make_cmd(
unsigned int scancode,
unsigned int upoint,
char* val);
110void set_cmds(
unsigned int scancode,
struct cmd_list* cl);
113void add_define(
char* str,
int n);
114int lookup_define(
char* str);
125#ifdef YYERROR_VERBOSE
126#undef YYERROR_VERBOSE
127#define YYERROR_VERBOSE 1
129#define YYERROR_VERBOSE 0
134#define YYTOKEN_TABLE 0
153 CTRL_SHIFT_ALT = 268,
156 CTRL_SHIFT_ALTGR = 271,
177#define CTRL_SHIFT 265
180#define CTRL_SHIFT_ALT 268
181#define SHIFT_ALTGR 269
182#define CTRL_ALTGR 270
183#define CTRL_SHIFT_ALTGR 271
184#define SET_COMBINE 272
189#define QUOTED_CHAR 277
190#define CODE_POINT 278
195#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED
209#define YYSTYPE_IS_TRIVIAL 1
210#define yystype YYSTYPE
211#define YYSTYPE_IS_DECLARED 1
224typedef YYTYPE_UINT8 yytype_uint8;
226typedef unsigned char yytype_uint8;
230typedef YYTYPE_INT8 yytype_int8;
231#elif (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
232typedef signed char yytype_int8;
234typedef short int yytype_int8;
238typedef YYTYPE_UINT16 yytype_uint16;
240typedef unsigned short int yytype_uint16;
244typedef YYTYPE_INT16 yytype_int16;
246typedef short int yytype_int16;
251#define YYSIZE_T __SIZE_TYPE__
253#define YYSIZE_T size_t
254#elif !defined YYSIZE_T && \
255 (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
257#define YYSIZE_T size_t
259#define YYSIZE_T unsigned int
263#define YYSIZE_MAXIMUM ((YYSIZE_T) - 1)
269#define YY_(msgid) dgettext("bison-runtime", msgid)
273#define YY_(msgid) msgid
278#if !defined lint || defined __GNUC__
279#define YYUSE(e) ((void)(e))
288#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
289static int YYID(
int yyi)
299#if !defined yyoverflow || YYERROR_VERBOSE
303#ifdef YYSTACK_USE_ALLOCA
304#if YYSTACK_USE_ALLOCA
306#define YYSTACK_ALLOC __builtin_alloca
307#elif defined __BUILTIN_VA_ARG_INCR
310#define YYSTACK_ALLOC __alloca
311#elif defined _MSC_VER
313#define alloca _alloca
315#define YYSTACK_ALLOC alloca
316#if !defined _ALLOCA_H && !defined _STDLIB_H && \
317 (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
329#define YYSTACK_FREE(Ptr) \
333#ifndef YYSTACK_ALLOC_MAXIMUM
338#define YYSTACK_ALLOC_MAXIMUM 4032
341#define YYSTACK_ALLOC YYMALLOC
342#define YYSTACK_FREE YYFREE
343#ifndef YYSTACK_ALLOC_MAXIMUM
344#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
346#if (defined __cplusplus && !defined _STDLIB_H && \
347 !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free)))
354#define YYMALLOC malloc
355#if !defined malloc && !defined _STDLIB_H && \
356 (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
357void* malloc(YYSIZE_T);
362#if !defined free && !defined _STDLIB_H && \
363 (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
370#if (!defined yyoverflow && \
371 (!defined __cplusplus || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
375 yytype_int16 yyss_alloc;
380#define YYSTACK_GAP_MAXIMUM (sizeof(union yyalloc) - 1)
384#define YYSTACK_BYTES(N) ((N) * (sizeof(yytype_int16) + sizeof(YYSTYPE)) + YYSTACK_GAP_MAXIMUM)
389#if defined __GNUC__ && 1 < __GNUC__
390#define YYCOPY(To, From, Count) __builtin_memcpy(To, From, (Count) * sizeof(*(From)))
392#define YYCOPY(To, From, Count) \
395 for (yyi = 0; yyi < (Count); yyi++) \
396 (To)[yyi] = (From)[yyi]; \
406#define YYSTACK_RELOCATE(Stack_alloc, Stack) \
408 YYSIZE_T yynewbytes; \
409 YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \
410 Stack = &yyptr->Stack_alloc; \
411 yynewbytes = yystacksize * sizeof(*Stack) + YYSTACK_GAP_MAXIMUM; \
412 yyptr += yynewbytes / sizeof(*yyptr); \
435#define YYTRANSLATE(YYX) ((unsigned int)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
438static const yytype_uint8 yytranslate[] = {
439 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
449 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
454static const yytype_uint8 yyprhs[] = {0, 0, 3, 7, 10, 12, 16, 20, 23, 24, 27, 29,
455 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 64,
456 66, 72, 78, 80, 82, 84, 92, 100, 104, 105, 108};
459static const yytype_int8 yyrhs[] = {
460 28, 0, -1, 29, 3, 28, -1, 3, 28, -1, 26, -1, 21, 5, 24, -1, 21, 5, 23, -1, 24, 30, -1,
461 -1, 31, 30, -1, 32, -1, 6, 32, -1, 7, 32, -1, 10, 32, -1, 8, 32, -1, 9, 32, -1, 12, 32,
462 -1, 11, 32, -1, 13, 32, -1, 15, 32, -1, 14, 32, -1, 16, 32, -1, 33, -1, 34, -1, 18, 19, 24,
463 20, 33, -1, 18, 19, 5, 20, 33, -1, 23, -1, 35, -1, 5, -1, 17, 19, 24, 20, 19, 23, 20, -1,
464 17, 19, 5, 20, 19, 23, 20, -1, 4, 36, 4, -1, -1, 5, 36, -1, 22, 36, -1};
467static const yytype_uint8 yyrline[] = {0, 51, 51, 52, 53, 56, 57, 58, 61, 62, 65, 66,
468 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 79, 80,
469 81, 82, 85, 86, 87, 90, 91, 94, 97, 98, 99};
472#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
475static const char*
const yytname[] = {
"$end",
518static const yytype_uint16 yytoknum[] = {0, 256, 257, 258, 259, 260, 261, 262, 263,
519 264, 265, 266, 267, 268, 269, 270, 271, 272,
520 273, 274, 275, 276, 277, 278, 279, 280, 281};
524static const yytype_uint8 yyr1[] = {0, 27, 28, 28, 28, 29, 29, 29, 30, 30, 31, 31,
525 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32,
526 32, 32, 33, 33, 33, 34, 34, 35, 36, 36, 36};
529static const yytype_uint8 yyr2[] = {0, 2, 3, 2, 1, 3, 3, 2, 0, 2, 1, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 1, 1, 5, 5, 1, 1, 1, 7, 7, 3, 0, 2, 2};
535static const yytype_uint8 yydefact[] = {
536 0, 0, 0, 8, 4, 0, 0, 3, 0, 32, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
537 26, 7, 8, 10, 22, 23, 27, 1, 0, 6, 5, 32, 32, 0, 11, 12, 14, 15, 13, 17, 16, 18, 20, 19,
538 21, 0, 0, 9, 2, 33, 34, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 24, 0, 0, 30, 29};
541static const yytype_int8 yydefgoto[] = {-1, 5, 6, 25, 26, 27, 28, 29, 30, 37};
545#define YYPACT_NINF -34
546static const yytype_int8 yypact[] = {
547 -2, -2, 30, 0, -34, 38, 37, -34, -21, 27, -34, 16, 16, 16, 16, 16, 16, 16,
548 16, 16, 16, 16, 24, 26, -34, -34, 0, -34, -34, -34, -34, -34, -2, -34, -34, 27,
549 27, 44, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 22, 23, -34, -34, -34,
550 -34, -34, 41, 42, 43, 45, 47, 48, 21, 21, 18, 19, -34, -34, 49, 50, -34, -34};
553static const yytype_int8 yypgoto[] = {-34, -1, -34, 46, -34, 39, -33, -34, -34, 1};
559#define YYTABLE_NINF -1
560static const yytype_uint8 yytable[] = {7, 1, 33, 34, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
561 20, 21, 22, 23, 2, 9, 10, 3, 24, 4, 9, 10, 56, 58, 66,
562 67, 52, 35, 22, 23, 8, 53, 54, 31, 24, 32, 68, 69, 49, 24,
563 50, 57, 59, 55, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
564 48, 60, 61, 62, 0, 63, 64, 65, 0, 70, 71, 0, 51};
566static const yytype_int8 yycheck[] = {1, 3, 23, 24, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
567 15, 16, 17, 18, 21, 4, 5, 24, 23, 26, 4, 5, 5, 5, 62,
568 63, 32, 5, 17, 18, 5, 35, 36, 0, 23, 3, 23, 23, 19, 23,
569 19, 24, 24, 4, 22, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
570 21, 20, 20, 20, -1, 20, 19, 19, -1, 20, 20, -1, 26};
574static const yytype_uint8 yystos[] = {
575 0, 3, 21, 24, 26, 28, 29, 28, 5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
576 23, 30, 31, 32, 33, 34, 35, 0, 3, 23, 24, 5, 22, 36, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
577 32, 19, 19, 30, 28, 36, 36, 4, 5, 24, 5, 24, 20, 20, 20, 20, 19, 19, 33, 33, 23, 23, 20, 20};
579#define yyerrok (yyerrstatus = 0)
580#define yyclearin (yychar = YYEMPTY)
584#define YYACCEPT goto yyacceptlab
585#define YYABORT goto yyabortlab
586#define YYERROR goto yyerrorlab
592#define YYFAIL goto yyerrlab
594#define YYRECOVERING() (!!yyerrstatus)
596#define YYBACKUP(Token, Value) \
598 if (yychar == YYEMPTY && yylen == 1) { \
601 yytoken = YYTRANSLATE(yychar); \
605 yyerror(YY_("syntax error: cannot back up")); \
617#define YYRHSLOC(Rhs, K) ((Rhs)[K])
618#ifndef YYLLOC_DEFAULT
619#define YYLLOC_DEFAULT(Current, Rhs, N) \
622 (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
623 (Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
624 (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
625 (Current).last_column = YYRHSLOC(Rhs, N).last_column; \
627 (Current).first_line = (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \
628 (Current).first_column = (Current).last_column = YYRHSLOC(Rhs, 0).last_column; \
637#ifndef YY_LOCATION_PRINT
638#if YYLTYPE_IS_TRIVIAL
639#define YY_LOCATION_PRINT(File, Loc) \
640 fprintf(File, "%d.%d-%d.%d", (Loc).first_line, (Loc).first_column, (Loc).last_line, \
643#define YY_LOCATION_PRINT(File, Loc) ((void)0)
650#define YYLEX yylex(YYLEX_PARAM)
660#define YYFPRINTF fprintf
663#define YYDPRINTF(Args) \
669#define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
672 YYFPRINTF(stderr, "%s ", Title); \
673 yy_symbol_print(stderr, Type, Value); \
674 YYFPRINTF(stderr, "\n"); \
683#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
684static void yy_symbol_value_print(FILE* yyoutput,
int yytype,
YYSTYPE const*
const yyvaluep)
686static void yy_symbol_value_print(yyoutput, yytype, yyvaluep) FILE* yyoutput;
694 if (yytype < YYNTOKENS)
695 YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep);
709#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
710static void yy_symbol_print(FILE* yyoutput,
int yytype,
YYSTYPE const*
const yyvaluep)
712static void yy_symbol_print(yyoutput, yytype, yyvaluep) FILE* yyoutput;
717 if (yytype < YYNTOKENS)
718 YYFPRINTF(yyoutput,
"token %s (", yytname[yytype]);
720 YYFPRINTF(yyoutput,
"nterm %s (", yytname[yytype]);
722 yy_symbol_value_print(yyoutput, yytype, yyvaluep);
723 YYFPRINTF(yyoutput,
")");
731#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
732static void yy_stack_print(yytype_int16* yybottom, yytype_int16* yytop)
734static void yy_stack_print(yybottom, yytop) yytype_int16* yybottom;
738 YYFPRINTF(stderr,
"Stack now");
739 for (; yybottom <= yytop; yybottom++) {
740 int yybot = *yybottom;
741 YYFPRINTF(stderr,
" %d", yybot);
743 YYFPRINTF(stderr,
"\n");
746#define YY_STACK_PRINT(Bottom, Top) \
749 yy_stack_print((Bottom), (Top)); \
756#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
757static void yy_reduce_print(
YYSTYPE* yyvsp,
int yyrule)
759static void yy_reduce_print(yyvsp, yyrule)
YYSTYPE* yyvsp;
763 int yynrhs = yyr2[yyrule];
765 unsigned long int yylno = yyrline[yyrule];
766 YYFPRINTF(stderr,
"Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno);
768 for (yyi = 0; yyi < yynrhs; yyi++) {
769 YYFPRINTF(stderr,
" $%d = ", yyi + 1);
770 yy_symbol_print(stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]));
771 YYFPRINTF(stderr,
"\n");
775#define YY_REDUCE_PRINT(Rule) \
778 yy_reduce_print(yyvsp, Rule); \
785#define YYDPRINTF(Args)
786#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
787#define YY_STACK_PRINT(Bottom, Top)
788#define YY_REDUCE_PRINT(Rule)
793#define YYINITDEPTH 200
804#define YYMAXDEPTH 10000
810#if defined __GLIBC__ && defined _STRING_H
811#define yystrlen strlen
814#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
815static YYSIZE_T yystrlen(
const char* yystr)
817static YYSIZE_T yystrlen(yystr)
const char* yystr;
821 for (yylen = 0; yystr[yylen]; yylen++)
829#if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
830#define yystpcpy stpcpy
834#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
835static char* yystpcpy(
char* yydest,
const char* yysrc)
837static char* yystpcpy(yydest, yysrc)
843 const char* yys = yysrc;
845 while ((*yyd++ = *yys++) !=
'\0')
861static YYSIZE_T yytnamerr(
char* yyres,
const char* yystr) {
864 char const* yyp = yystr;
870 goto do_not_strip_quotes;
874 goto do_not_strip_quotes;
887 do_not_strip_quotes:;
891 return yystrlen(yystr);
893 return yystpcpy(yyres, yystr) - yyres;
904static YYSIZE_T yysyntax_error(
char* yyresult,
int yystate,
int yychar) {
905 int yyn = yypact[yystate];
907 if (!(YYPACT_NINF < yyn && yyn <= YYLAST))
910 int yytype = YYTRANSLATE(yychar);
911 YYSIZE_T yysize0 = yytnamerr(0, yytname[yytype]);
912 YYSIZE_T yysize = yysize0;
914 int yysize_overflow = 0;
915 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
916 char const* yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
922 YY_(
"syntax error, unexpected %s");
923 YY_(
"syntax error, unexpected %s, expecting %s");
924 YY_(
"syntax error, unexpected %s, expecting %s or %s");
925 YY_(
"syntax error, unexpected %s, expecting %s or %s or %s");
926 YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s");
930 static char const yyunexpected[] =
"syntax error, unexpected %s";
931 static char const yyexpecting[] =
", expecting %s";
932 static char const yyor[] =
" or %s";
933 char yyformat[
sizeof yyunexpected +
sizeof yyexpecting - 1 +
934 ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (
sizeof yyor - 1))];
935 char const* yyprefix = yyexpecting;
939 int yyxbegin = yyn < 0 ? -yyn : 0;
942 int yychecklim = YYLAST - yyn + 1;
943 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
946 yyarg[0] = yytname[yytype];
947 yyfmt = yystpcpy(yyformat, yyunexpected);
949 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
950 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) {
951 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) {
954 yyformat[
sizeof yyunexpected - 1] =
'\0';
957 yyarg[yycount++] = yytname[yyx];
958 yysize1 = yysize + yytnamerr(0, yytname[yyx]);
959 yysize_overflow |= (yysize1 < yysize);
961 yyfmt = yystpcpy(yyfmt, yyprefix);
966 yysize1 = yysize + yystrlen(yyf);
967 yysize_overflow |= (yysize1 < yysize);
971 return YYSIZE_MAXIMUM;
977 char* yyp = yyresult;
979 while ((*yyp = *yyf) !=
'\0') {
980 if (*yyp ==
'%' && yyf[1] ==
's' && yyi < yycount) {
981 yyp += yytnamerr(yyp, yyarg[yyi++]);
999#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
1000static void yydestruct(
const char* yymsg,
int yytype,
YYSTYPE* yyvaluep)
1002static void yydestruct(yymsg, yytype, yyvaluep)
const char* yymsg;
1011 YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp);
1021#if defined __STDC__ || defined __cplusplus
1022int yyparse(
void* YYPARSE_PARAM);
1027#if defined __STDC__ || defined __cplusplus
1048#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
1049int yyparse(
void* YYPARSE_PARAM)
1051int yyparse(YYPARSE_PARAM)
void* YYPARSE_PARAM;
1054#if (defined __STDC__ || defined __C99__FUNC__ || defined __cplusplus || defined _MSC_VER)
1074 yytype_int16 yyssa[YYINITDEPTH];
1076 yytype_int16* yyssp;
1083 YYSIZE_T yystacksize;
1096 char* yymsg = yymsgbuf;
1097 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1100#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1109 yystacksize = YYINITDEPTH;
1111 YYDPRINTF((stderr,
"Starting parse\n"));
1138 if (yyss + yystacksize - 1 <= yyssp) {
1140 YYSIZE_T yysize = yyssp - yyss + 1;
1148 yytype_int16* yyss1 = yyss;
1154 yyoverflow(YY_(
"memory exhausted"), &yyss1, yysize *
sizeof(*yyssp), &yyvs1,
1155 yysize *
sizeof(*yyvsp), &yystacksize);
1161#ifndef YYSTACK_RELOCATE
1162 goto yyexhaustedlab;
1165 if (YYMAXDEPTH <= yystacksize)
1166 goto yyexhaustedlab;
1168 if (YYMAXDEPTH < yystacksize)
1169 yystacksize = YYMAXDEPTH;
1172 yytype_int16* yyss1 = yyss;
1173 union yyalloc* yyptr = (
union yyalloc*)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize));
1175 goto yyexhaustedlab;
1176 YYSTACK_RELOCATE(yyss_alloc, yyss);
1177 YYSTACK_RELOCATE(yyvs_alloc, yyvs);
1178#undef YYSTACK_RELOCATE
1180 YYSTACK_FREE(yyss1);
1185 yyssp = yyss + yysize - 1;
1186 yyvsp = yyvs + yysize - 1;
1188 YYDPRINTF((stderr,
"Stack size increased to %lu\n", (
unsigned long int)yystacksize));
1190 if (yyss + yystacksize - 1 <= yyssp)
1194 YYDPRINTF((stderr,
"Entering state %d\n", yystate));
1196 if (yystate == YYFINAL)
1210 yyn = yypact[yystate];
1211 if (yyn == YYPACT_NINF)
1217 if (yychar == YYEMPTY) {
1218 YYDPRINTF((stderr,
"Reading a token: "));
1222 if (yychar <= YYEOF) {
1223 yychar = yytoken = YYEOF;
1224 YYDPRINTF((stderr,
"Now at end of input.\n"));
1226 yytoken = YYTRANSLATE(yychar);
1227 YY_SYMBOL_PRINT(
"Next token is", yytoken, &yylval, &yylloc);
1233 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1237 if (yyn == 0 || yyn == YYTABLE_NINF)
1249 YY_SYMBOL_PRINT(
"Shifting", yytoken, &yylval, &yylloc);
1263 yyn = yydefact[yystate];
1283 yyval = yyvsp[1 - yylen];
1285 YY_REDUCE_PRINT(yyn);
1304 (yyval.cmd_list) = 0;
1305 add_define((yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].n));
1312 (yyval.cmd_list) = 0;
1313 add_define((yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].n));
1320 (yyval.cmd_list) = (yyvsp[(2) - (2)].
cmd_list);
1321 set_cmds((yyvsp[(1) - (2)].n), (yyval.cmd_list));
1328 (yyval.cmd_list) = 0;
1335 (yyval.cmd_list) = add_to_cmd_list((yyvsp[(2) - (2)].
cmd_list), (yyvsp[(1) - (2)].cmd));
1342 (yyval.cmd) = (yyvsp[(1) - (1)].
cmd);
1349 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1350 (yyval.cmd)->modifiers = CTRL_I;
1357 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1358 (yyval.cmd)->modifiers = SHIFT_I;
1365 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1366 (yyval.cmd)->modifiers = CTRL_I | SHIFT_I;
1373 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1374 (yyval.cmd)->modifiers = ALT_I;
1381 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1382 (yyval.cmd)->modifiers = ALTGR_I;
1389 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1390 (yyval.cmd)->modifiers = CTRL_I | ALT_I;
1397 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1398 (yyval.cmd)->modifiers = SHIFT_I | ALT_I;
1405 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1406 (yyval.cmd)->modifiers = CTRL_I | SHIFT_I | ALT_I;
1413 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1414 (yyval.cmd)->modifiers = CTRL_I | ALTGR_I;
1421 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1422 (yyval.cmd)->modifiers = SHIFT_I | ALTGR_I;
1429 (yyval.cmd) = (yyvsp[(2) - (2)].
cmd);
1430 (yyval.cmd)->modifiers = CTRL_I | SHIFT_I | ALTGR_I;
1437 (yyval.cmd) = (yyvsp[(1) - (1)].
cmd);
1444 (yyval.cmd) = (yyvsp[(1) - (1)].
cmd);
1451 (yyval.cmd) = (yyvsp[(5) - (5)].
cmd);
1452 (yyval.cmd)->combinators = (yyvsp[(3) - (5)].n);
1459 (yyval.cmd) = (yyvsp[(5) - (5)].
cmd);
1460 (yyval.cmd)->combinators = lookup_define((yyvsp[(3) - (5)].str));
1467 (yyval.cmd) = make_cmd(0, (yyvsp[(1) - (1)].n), (
char*)
"");
1474 (yyval.cmd) = make_cmd(0, 0, (yyvsp[(1) - (1)].str));
1481 (yyval.cmd) = make_cmd(0, lookup_define((yyvsp[(1) - (1)].str)), (
char*)
"");
1488 (yyval.cmd) = make_cmd(0, (yyvsp[(6) - (7)].n), (
char*)
"");
1489 (yyval.cmd)->set_modifiers = (yyvsp[(3) - (7)].n);
1496 (yyval.cmd) = make_cmd(0, (yyvsp[(6) - (7)].n), (
char*)
"");
1497 (yyval.cmd)->set_modifiers = lookup_define((yyvsp[(3) - (7)].str));
1504 strcpy((yyval.str), (yyvsp[(2) - (3)].str));
1511 strcpy((yyval.str),
"");
1518 combine_strings((yyval.str), (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str));
1525 combine_strings((yyval.str), quote_char((yyvsp[(1) - (2)].c)), (yyvsp[(2) - (2)].str));
1529#line 1682 "parser.c"
1533 YY_SYMBOL_PRINT(
"-> $$ =", yyr1[yyn], &yyval, &yyloc);
1537 YY_STACK_PRINT(yyss, yyssp);
1547 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1548 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1549 yystate = yytable[yystate];
1551 yystate = yydefgoto[yyn - YYNTOKENS];
1563 yyerror(YY_(
"syntax error"));
1566 YYSIZE_T yysize = yysyntax_error(0, yystate, yychar);
1567 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) {
1568 YYSIZE_T
yyalloc = 2 * yysize;
1570 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1571 if (yymsg != yymsgbuf)
1572 YYSTACK_FREE(yymsg);
1573 yymsg = (
char*)YYSTACK_ALLOC(
yyalloc);
1578 yymsg_alloc =
sizeof yymsgbuf;
1582 if (0 < yysize && yysize <= yymsg_alloc) {
1583 (void)yysyntax_error(yymsg, yystate, yychar);
1586 yyerror(YY_(
"syntax error"));
1588 goto yyexhaustedlab;
1594 if (yyerrstatus == 3) {
1598 if (yychar <= YYEOF) {
1600 if (yychar == YYEOF)
1603 yydestruct(
"Error: discarding", yytoken, &yylval);
1627 YY_STACK_PRINT(yyss, yyssp);
1638 yyn = yypact[yystate];
1639 if (yyn != YYPACT_NINF) {
1641 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) {
1652 yydestruct(
"Error: popping", yystos[yystate], yyvsp);
1655 YY_STACK_PRINT(yyss, yyssp);
1661 YY_SYMBOL_PRINT(
"Shifting", yystos[yyn], yyvsp, yylsp);
1680#if !defined(yyoverflow) || YYERROR_VERBOSE
1685 yyerror(YY_(
"memory exhausted"));
1691 if (yychar != YYEMPTY)
1692 yydestruct(
"Cleanup: discarding lookahead", yytoken, &yylval);
1696 YY_STACK_PRINT(yyss, yyssp);
1697 while (yyssp != yyss) {
1698 yydestruct(
"Cleanup: popping", yystos[*yyssp], yyvsp);
1706 if (yymsg != yymsgbuf)
1707 YYSTACK_FREE(yymsg);
1710 return YYID(yyresult);
1716char* quote_char(
char c) {
1725void combine_strings(
char* dest,
const char* head,
const char* tail) {
1726 size_t head_len = strlen(head);
1727 size_t tail_len = strlen(tail);
1728 if (head_len >= 256 || tail_len >= (256 - head_len)) {
1729 fprintf(stderr,
"Keymap string is too long.\n");
1733 memcpy(dest, head, head_len);
1734 memcpy(dest + head_len, tail, tail_len + 1);
1753cmd_t* make_cmd(
unsigned int scancode,
unsigned int unicode_point,
char* val) {
1754 if (n_cmds >= MAX_CMDS) {
1755 fprintf(stderr,
"Too many keymap commands.\n");
1758 if (val && strlen(val) >
sizeof(unicode_point)) {
1759 fprintf(stderr,
"Special key values cannot exceed four bytes.\n");
1764 c->scancode = scancode;
1765 c->unicode_point = unicode_point;
1767 c->val = strdup(val);
1776void set_cmds(
unsigned int scancode,
struct cmd_list* cl) {
1778 cl->cmd->scancode = scancode;
1789void add_define(
char* str,
int n) {
1790 if (ndefines >= (
int)(
sizeof(defines) /
sizeof(defines[0]))) {
1791 fprintf(stderr,
"Too many keymap definitions.\n");
1794 if (strlen(str) >=
sizeof(defines[0].str)) {
1795 fprintf(stderr,
"Keymap definition name is too long.\n");
1799 memset(defines[ndefines].str, 0, 32);
1800 strcpy(defines[ndefines].str, str);
1801 defines[ndefines++].n = n;
1804int lookup_define(
char* str) {
1806 for (i = 0; i < ndefines; i++) {
1807 if (!strcmp(defines[i].str, str))
1808 return defines[i].n;
1810 fprintf(stderr,
"Error: define `%s' not found.\n", str);