1/* A Bison parser, made by GNU Bison 3.8.2. */ 2 3/* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, 6 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 3 of the License, or 11 (at your option) 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, see <https://www.gnu.org/licenses/>. */ 20 21/* As a special exception, you may create a larger work that contains 22 part or all of the Bison parser skeleton and distribute that work 23 under terms of your choice, so long as that work isn't itself a 24 parser generator using the skeleton or a modified version thereof 25 as a parser skeleton. Alternatively, if you modify or redistribute 26 the parser skeleton itself, you may (at your option) remove this 27 special exception, which will cause the skeleton and the resulting 28 Bison output files to be licensed under the GNU General Public 29 License without this special exception. 30 31 This special exception was added by the Free Software Foundation in 32 version 2.2 of Bison. */ 33 34/* C LALR(1) parser skeleton written by Richard Stallman, by 35 simplifying the original so-called "semantic" parser. */ 36 37/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, 38 especially those whose name start with YY_ or yy_. They are 39 private implementation details that can be changed or removed. */ 40 41/* All symbols defined below should begin with yy or YY, to avoid 42 infringing on user name space. This should be done even for local 43 variables, as they might otherwise be expanded by user macros. 44 There are some unavoidable exceptions within include files to 45 define necessary library symbols; they are noted "INFRINGES ON 46 USER NAME SPACE" below. */ 47 48/* Identify Bison output, and Bison version. */ 49#define YYBISON 30802 50 51/* Bison version string. */ 52#define YYBISON_VERSION "3.8.2" 53 54/* Skeleton name. */ 55#define YYSKELETON_NAME "yacc.c" 56 57/* Pure parsers. */ 58#define YYPURE 0 59 60/* Push parsers. */ 61#define YYPUSH 0 62 63/* Pull parsers. */ 64#define YYPULL 1 65 66 67 68 69/* First part of user prologue. */ 70#line 62 "cfgparse.y" 71 72#ifdef DEBUG 73#define YYDEBUG 1 74#endif 75#include "xkbevd.h" 76#include <stdlib.h> 77 78#line 79 "cfgparse.c" 79 80# ifndef YY_CAST 81# ifdef __cplusplus 82# define YY_CAST(Type, Val) static_cast<Type> (Val) 83# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) 84# else 85# define YY_CAST(Type, Val) ((Type) (Val)) 86# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) 87# endif 88# endif 89# ifndef YY_NULLPTR 90# if defined __cplusplus 91# if 201103L <= __cplusplus 92# define YY_NULLPTR nullptr 93# else 94# define YY_NULLPTR 0 95# endif 96# else 97# define YY_NULLPTR ((void*)0) 98# endif 99# endif 100 101 102/* Debug traces. */ 103#ifndef YYDEBUG 104# define YYDEBUG 0 105#endif 106#if YYDEBUG 107extern int yydebug; 108#endif 109 110/* Token kinds. */ 111#ifndef YYTOKENTYPE 112# define YYTOKENTYPE 113 enum yytokentype 114 { 115 YYEMPTY = -2, 116 END_OF_FILE = 0, /* END_OF_FILE */ 117 YYerror = 256, /* error */ 118 YYUNDEF = 257, /* "invalid token" */ 119 ERROR = 255, /* ERROR */ 120 BELL = 1, /* BELL */ 121 ACCESSX = 2, /* ACCESSX */ 122 MESSAGE = 3, /* MESSAGE */ 123 NONE = 20, /* NONE */ 124 IGNORE = 21, /* IGNORE */ 125 ECHO = 22, /* ECHO */ 126 PRINT_EV = 23, /* PRINT_EV */ 127 SHELL = 24, /* SHELL */ 128 SOUND = 25, /* SOUND */ 129 EQUALS = 40, /* EQUALS */ 130 PLUS = 41, /* PLUS */ 131 MINUS = 42, /* MINUS */ 132 DIVIDE = 43, /* DIVIDE */ 133 TIMES = 44, /* TIMES */ 134 OBRACE = 45, /* OBRACE */ 135 CBRACE = 46, /* CBRACE */ 136 OPAREN = 47, /* OPAREN */ 137 CPAREN = 48, /* CPAREN */ 138 OBRACKET = 49, /* OBRACKET */ 139 CBRACKET = 50, /* CBRACKET */ 140 DOT = 51, /* DOT */ 141 COMMA = 52, /* COMMA */ 142 SEMI = 53, /* SEMI */ 143 EXCLAM = 54, /* EXCLAM */ 144 INVERT = 55, /* INVERT */ 145 STRING = 60, /* STRING */ 146 INTEGER = 61, /* INTEGER */ 147 FLOAT = 62, /* FLOAT */ 148 IDENT = 63, /* IDENT */ 149 KEYNAME = 64 /* KEYNAME */ 150 }; 151 typedef enum yytokentype yytoken_kind_t; 152#endif 153/* Token kinds. */ 154#define YYEMPTY -2 155#define END_OF_FILE 0 156#define YYerror 256 157#define YYUNDEF 257 158#define ERROR 255 159#define BELL 1 160#define ACCESSX 2 161#define MESSAGE 3 162#define NONE 20 163#define IGNORE 21 164#define ECHO 22 165#define PRINT_EV 23 166#define SHELL 24 167#define SOUND 25 168#define EQUALS 40 169#define PLUS 41 170#define MINUS 42 171#define DIVIDE 43 172#define TIMES 44 173#define OBRACE 45 174#define CBRACE 46 175#define OPAREN 47 176#define CPAREN 48 177#define OBRACKET 49 178#define CBRACKET 50 179#define DOT 51 180#define COMMA 52 181#define SEMI 53 182#define EXCLAM 54 183#define INVERT 55 184#define STRING 60 185#define INTEGER 61 186#define FLOAT 62 187#define IDENT 63 188#define KEYNAME 64 189 190/* Value type. */ 191#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 192union YYSTYPE 193{ 194#line 75 "cfgparse.y" 195 196 char * str; 197 int ival; 198 CfgEntryPtr entry; 199 ActDefPtr act; 200 201#line 202 "cfgparse.c" 202 203}; 204typedef union YYSTYPE YYSTYPE; 205# define YYSTYPE_IS_TRIVIAL 1 206# define YYSTYPE_IS_DECLARED 1 207#endif 208 209 210extern YYSTYPE yylval; 211 212 213int yyparse (void); 214 215 216 217/* Symbol kind. */ 218enum yysymbol_kind_t 219{ 220 YYSYMBOL_YYEMPTY = -2, 221 YYSYMBOL_YYEOF = 0, /* END_OF_FILE */ 222 YYSYMBOL_YYerror = 1, /* error */ 223 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ 224 YYSYMBOL_ERROR = 3, /* ERROR */ 225 YYSYMBOL_BELL = 4, /* BELL */ 226 YYSYMBOL_ACCESSX = 5, /* ACCESSX */ 227 YYSYMBOL_MESSAGE = 6, /* MESSAGE */ 228 YYSYMBOL_NONE = 7, /* NONE */ 229 YYSYMBOL_IGNORE = 8, /* IGNORE */ 230 YYSYMBOL_ECHO = 9, /* ECHO */ 231 YYSYMBOL_PRINT_EV = 10, /* PRINT_EV */ 232 YYSYMBOL_SHELL = 11, /* SHELL */ 233 YYSYMBOL_SOUND = 12, /* SOUND */ 234 YYSYMBOL_EQUALS = 13, /* EQUALS */ 235 YYSYMBOL_PLUS = 14, /* PLUS */ 236 YYSYMBOL_MINUS = 15, /* MINUS */ 237 YYSYMBOL_DIVIDE = 16, /* DIVIDE */ 238 YYSYMBOL_TIMES = 17, /* TIMES */ 239 YYSYMBOL_OBRACE = 18, /* OBRACE */ 240 YYSYMBOL_CBRACE = 19, /* CBRACE */ 241 YYSYMBOL_OPAREN = 20, /* OPAREN */ 242 YYSYMBOL_CPAREN = 21, /* CPAREN */ 243 YYSYMBOL_OBRACKET = 22, /* OBRACKET */ 244 YYSYMBOL_CBRACKET = 23, /* CBRACKET */ 245 YYSYMBOL_DOT = 24, /* DOT */ 246 YYSYMBOL_COMMA = 25, /* COMMA */ 247 YYSYMBOL_SEMI = 26, /* SEMI */ 248 YYSYMBOL_EXCLAM = 27, /* EXCLAM */ 249 YYSYMBOL_INVERT = 28, /* INVERT */ 250 YYSYMBOL_STRING = 29, /* STRING */ 251 YYSYMBOL_INTEGER = 30, /* INTEGER */ 252 YYSYMBOL_FLOAT = 31, /* FLOAT */ 253 YYSYMBOL_IDENT = 32, /* IDENT */ 254 YYSYMBOL_KEYNAME = 33, /* KEYNAME */ 255 YYSYMBOL_YYACCEPT = 34, /* $accept */ 256 YYSYMBOL_CfgFile = 35, /* CfgFile */ 257 YYSYMBOL_CfgEntryList = 36, /* CfgEntryList */ 258 YYSYMBOL_CfgEntry = 37, /* CfgEntry */ 259 YYSYMBOL_VarDef = 38, /* VarDef */ 260 YYSYMBOL_EventDef = 39, /* EventDef */ 261 YYSYMBOL_EventType = 40, /* EventType */ 262 YYSYMBOL_ActionDef = 41, /* ActionDef */ 263 YYSYMBOL_ActionType = 42, /* ActionType */ 264 YYSYMBOL_OptNameSpec = 43, /* OptNameSpec */ 265 YYSYMBOL_NameSpec = 44, /* NameSpec */ 266 YYSYMBOL_Ident = 45, /* Ident */ 267 YYSYMBOL_OptString = 46, /* OptString */ 268 YYSYMBOL_String = 47 /* String */ 269}; 270typedef enum yysymbol_kind_t yysymbol_kind_t; 271 272 273 274 275#ifdef short 276# undef short 277#endif 278 279/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure 280 <limits.h> and (if available) <stdint.h> are included 281 so that the code can choose integer types of a good width. */ 282 283#ifndef __PTRDIFF_MAX__ 284# include <limits.h> /* INFRINGES ON USER NAME SPACE */ 285# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ 286# include <stdint.h> /* INFRINGES ON USER NAME SPACE */ 287# define YY_STDINT_H 288# endif 289#endif 290 291/* Narrow types that promote to a signed type and that can represent a 292 signed or unsigned integer of at least N bits. In tables they can 293 save space and decrease cache pressure. Promoting to a signed type 294 helps avoid bugs in integer arithmetic. */ 295 296#ifdef __INT_LEAST8_MAX__ 297typedef __INT_LEAST8_TYPE__ yytype_int8; 298#elif defined YY_STDINT_H 299typedef int_least8_t yytype_int8; 300#else 301typedef signed char yytype_int8; 302#endif 303 304#ifdef __INT_LEAST16_MAX__ 305typedef __INT_LEAST16_TYPE__ yytype_int16; 306#elif defined YY_STDINT_H 307typedef int_least16_t yytype_int16; 308#else 309typedef short yytype_int16; 310#endif 311 312/* Work around bug in HP-UX 11.23, which defines these macros 313 incorrectly for preprocessor constants. This workaround can likely 314 be removed in 2023, as HPE has promised support for HP-UX 11.23 315 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of 316 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */ 317#ifdef __hpux 318# undef UINT_LEAST8_MAX 319# undef UINT_LEAST16_MAX 320# define UINT_LEAST8_MAX 255 321# define UINT_LEAST16_MAX 65535 322#endif 323 324#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ 325typedef __UINT_LEAST8_TYPE__ yytype_uint8; 326#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ 327 && UINT_LEAST8_MAX <= INT_MAX) 328typedef uint_least8_t yytype_uint8; 329#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX 330typedef unsigned char yytype_uint8; 331#else 332typedef short yytype_uint8; 333#endif 334 335#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ 336typedef __UINT_LEAST16_TYPE__ yytype_uint16; 337#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ 338 && UINT_LEAST16_MAX <= INT_MAX) 339typedef uint_least16_t yytype_uint16; 340#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX 341typedef unsigned short yytype_uint16; 342#else 343typedef int yytype_uint16; 344#endif 345 346#ifndef YYPTRDIFF_T 347# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ 348# define YYPTRDIFF_T __PTRDIFF_TYPE__ 349# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ 350# elif defined PTRDIFF_MAX 351# ifndef ptrdiff_t 352# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 353# endif 354# define YYPTRDIFF_T ptrdiff_t 355# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX 356# else 357# define YYPTRDIFF_T long 358# define YYPTRDIFF_MAXIMUM LONG_MAX 359# endif 360#endif 361 362#ifndef YYSIZE_T 363# ifdef __SIZE_TYPE__ 364# define YYSIZE_T __SIZE_TYPE__ 365# elif defined size_t 366# define YYSIZE_T size_t 367# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ 368# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 369# define YYSIZE_T size_t 370# else 371# define YYSIZE_T unsigned 372# endif 373#endif 374 375#define YYSIZE_MAXIMUM \ 376 YY_CAST (YYPTRDIFF_T, \ 377 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ 378 ? YYPTRDIFF_MAXIMUM \ 379 : YY_CAST (YYSIZE_T, -1))) 380 381#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) 382 383 384/* Stored state numbers (used for stacks). */ 385typedef yytype_int8 yy_state_t; 386 387/* State numbers in computations. */ 388typedef int yy_state_fast_t; 389 390#ifndef YY_ 391# if defined YYENABLE_NLS && YYENABLE_NLS 392# if ENABLE_NLS 393# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 394# define YY_(Msgid) dgettext ("bison-runtime", Msgid) 395# endif 396# endif 397# ifndef YY_ 398# define YY_(Msgid) Msgid 399# endif 400#endif 401 402 403#ifndef YY_ATTRIBUTE_PURE 404# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) 405# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) 406# else 407# define YY_ATTRIBUTE_PURE 408# endif 409#endif 410 411#ifndef YY_ATTRIBUTE_UNUSED 412# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) 413# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 414# else 415# define YY_ATTRIBUTE_UNUSED 416# endif 417#endif 418 419/* Suppress unused-variable warnings by "using" E. */ 420#if ! defined lint || defined __GNUC__ 421# define YY_USE(E) ((void) (E)) 422#else 423# define YY_USE(E) /* empty */ 424#endif 425 426/* Suppress an incorrect diagnostic about yylval being uninitialized. */ 427#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ 428# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 429# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 430 _Pragma ("GCC diagnostic push") \ 431 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") 432# else 433# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 434 _Pragma ("GCC diagnostic push") \ 435 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ 436 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 437# endif 438# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 439 _Pragma ("GCC diagnostic pop") 440#else 441# define YY_INITIAL_VALUE(Value) Value 442#endif 443#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 444# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 445# define YY_IGNORE_MAYBE_UNINITIALIZED_END 446#endif 447#ifndef YY_INITIAL_VALUE 448# define YY_INITIAL_VALUE(Value) /* Nothing. */ 449#endif 450 451#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ 452# define YY_IGNORE_USELESS_CAST_BEGIN \ 453 _Pragma ("GCC diagnostic push") \ 454 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") 455# define YY_IGNORE_USELESS_CAST_END \ 456 _Pragma ("GCC diagnostic pop") 457#endif 458#ifndef YY_IGNORE_USELESS_CAST_BEGIN 459# define YY_IGNORE_USELESS_CAST_BEGIN 460# define YY_IGNORE_USELESS_CAST_END 461#endif 462 463 464#define YY_ASSERT(E) ((void) (0 && (E))) 465 466#if !defined yyoverflow 467 468/* The parser invokes alloca or malloc; define the necessary symbols. */ 469 470# ifdef YYSTACK_USE_ALLOCA 471# if YYSTACK_USE_ALLOCA 472# ifdef __GNUC__ 473# define YYSTACK_ALLOC __builtin_alloca 474# elif defined __BUILTIN_VA_ARG_INCR 475# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 476# elif defined _AIX 477# define YYSTACK_ALLOC __alloca 478# elif defined _MSC_VER 479# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 480# define alloca _alloca 481# else 482# define YYSTACK_ALLOC alloca 483# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 484# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 485 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 486# ifndef EXIT_SUCCESS 487# define EXIT_SUCCESS 0 488# endif 489# endif 490# endif 491# endif 492# endif 493 494# ifdef YYSTACK_ALLOC 495 /* Pacify GCC's 'empty if-body' warning. */ 496# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 497# ifndef YYSTACK_ALLOC_MAXIMUM 498 /* The OS might guarantee only one guard page at the bottom of the stack, 499 and a page size can be as small as 4096 bytes. So we cannot safely 500 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 501 to allow for a few compiler-allocated temporary stack slots. */ 502# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 503# endif 504# else 505# define YYSTACK_ALLOC YYMALLOC 506# define YYSTACK_FREE YYFREE 507# ifndef YYSTACK_ALLOC_MAXIMUM 508# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 509# endif 510# if (defined __cplusplus && ! defined EXIT_SUCCESS \ 511 && ! ((defined YYMALLOC || defined malloc) \ 512 && (defined YYFREE || defined free))) 513# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 514# ifndef EXIT_SUCCESS 515# define EXIT_SUCCESS 0 516# endif 517# endif 518# ifndef YYMALLOC 519# define YYMALLOC malloc 520# if ! defined malloc && ! defined EXIT_SUCCESS 521void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 522# endif 523# endif 524# ifndef YYFREE 525# define YYFREE free 526# if ! defined free && ! defined EXIT_SUCCESS 527void free (void *); /* INFRINGES ON USER NAME SPACE */ 528# endif 529# endif 530# endif 531#endif /* !defined yyoverflow */ 532 533#if (! defined yyoverflow \ 534 && (! defined __cplusplus \ 535 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 536 537/* A type that is properly aligned for any stack member. */ 538union yyalloc 539{ 540 yy_state_t yyss_alloc; 541 YYSTYPE yyvs_alloc; 542}; 543 544/* The size of the maximum gap between one aligned stack and the next. */ 545# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) 546 547/* The size of an array large to enough to hold all stacks, each with 548 N elements. */ 549# define YYSTACK_BYTES(N) \ 550 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ 551 + YYSTACK_GAP_MAXIMUM) 552 553# define YYCOPY_NEEDED 1 554 555/* Relocate STACK from its old location to the new one. The 556 local variables YYSIZE and YYSTACKSIZE give the old and new number of 557 elements in the stack, and YYPTR gives the new location of the 558 stack. Advance YYPTR to a properly aligned location for the next 559 stack. */ 560# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 561 do \ 562 { \ 563 YYPTRDIFF_T yynewbytes; \ 564 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 565 Stack = &yyptr->Stack_alloc; \ 566 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ 567 yyptr += yynewbytes / YYSIZEOF (*yyptr); \ 568 } \ 569 while (0) 570 571#endif 572 573#if defined YYCOPY_NEEDED && YYCOPY_NEEDED 574/* Copy COUNT objects from SRC to DST. The source and destination do 575 not overlap. */ 576# ifndef YYCOPY 577# if defined __GNUC__ && 1 < __GNUC__ 578# define YYCOPY(Dst, Src, Count) \ 579 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) 580# else 581# define YYCOPY(Dst, Src, Count) \ 582 do \ 583 { \ 584 YYPTRDIFF_T yyi; \ 585 for (yyi = 0; yyi < (Count); yyi++) \ 586 (Dst)[yyi] = (Src)[yyi]; \ 587 } \ 588 while (0) 589# endif 590# endif 591#endif /* !YYCOPY_NEEDED */ 592 593/* YYFINAL -- State number of the termination state. */ 594#define YYFINAL 12 595/* YYLAST -- Last index in YYTABLE. */ 596#define YYLAST 28 597 598/* YYNTOKENS -- Number of terminals. */ 599#define YYNTOKENS 34 600/* YYNNTS -- Number of nonterminals. */ 601#define YYNNTS 14 602/* YYNRULES -- Number of rules. */ 603#define YYNRULES 27 604/* YYNSTATES -- Number of states. */ 605#define YYNSTATES 33 606 607/* YYMAXUTOK -- Last valid token kind. */ 608#define YYMAXUTOK 257 609 610 611/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM 612 as returned by yylex, with out-of-bounds checking. */ 613#define YYTRANSLATE(YYX) \ 614 (0 <= (YYX) && (YYX) <= YYMAXUTOK \ 615 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ 616 : YYSYMBOL_YYUNDEF) 617 618/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 619 as returned by yylex. */ 620static const yytype_int8 yytranslate[] = 621{ 622 0, 4, 5, 6, 2, 2, 2, 2, 2, 2, 623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 624 7, 8, 9, 10, 11, 12, 2, 2, 2, 2, 625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 626 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 627 23, 24, 25, 26, 27, 28, 2, 2, 2, 2, 628 29, 30, 31, 32, 33, 2, 2, 2, 2, 2, 629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 647 2, 2, 2, 2, 2, 3, 1, 2 648}; 649 650#if YYDEBUG 651/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 652static const yytype_uint8 yyrline[] = 653{ 654 0, 86, 86, 90, 102, 105, 113, 116, 133, 150, 655 151, 152, 155, 167, 168, 169, 170, 171, 172, 173, 656 176, 177, 180, 181, 184, 187, 188, 191 657}; 658#endif 659 660/** Accessing symbol of state STATE. */ 661#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) 662 663#if YYDEBUG || 0 664/* The user-facing name of the symbol whose (internal) number is 665 YYSYMBOL. No bounds checking. */ 666static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; 667 668/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 669 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 670static const char *const yytname[] = 671{ 672 "END_OF_FILE", "error", "\"invalid token\"", "ERROR", "BELL", "ACCESSX", 673 "MESSAGE", "NONE", "IGNORE", "ECHO", "PRINT_EV", "SHELL", "SOUND", 674 "EQUALS", "PLUS", "MINUS", "DIVIDE", "TIMES", "OBRACE", "CBRACE", 675 "OPAREN", "CPAREN", "OBRACKET", "CBRACKET", "DOT", "COMMA", "SEMI", 676 "EXCLAM", "INVERT", "STRING", "INTEGER", "FLOAT", "IDENT", "KEYNAME", 677 "$accept", "CfgFile", "CfgEntryList", "CfgEntry", "VarDef", "EventDef", 678 "EventType", "ActionDef", "ActionType", "OptNameSpec", "NameSpec", 679 "Ident", "OptString", "String", YY_NULLPTR 680}; 681 682static const char * 683yysymbol_name (yysymbol_kind_t yysymbol) 684{ 685 return yytname[yysymbol]; 686} 687#endif 688 689#define YYPACT_NINF (-20) 690 691#define yypact_value_is_default(Yyn) \ 692 ((Yyn) == YYPACT_NINF) 693 694#define YYTABLE_NINF (-1) 695 696#define yytable_value_is_error(Yyn) \ 697 0 698 699/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 700 STATE-NUM. */ 701static const yytype_int8 yypact[] = 702{ 703 -4, -20, -20, -20, -20, 3, -4, -20, -20, -3, 704 -6, 2, -20, -20, -20, -20, -20, -20, -20, -20, 705 -20, -13, -19, -19, -20, -20, -20, -2, -20, -20, 706 -20, -20, -20 707}; 708 709/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 710 Performed when YYTABLE does not specify something else to do. Zero 711 means the default is an error. */ 712static const yytype_int8 yydefact[] = 713{ 714 0, 9, 10, 11, 24, 0, 2, 4, 6, 19, 715 0, 0, 1, 3, 13, 14, 15, 16, 17, 18, 716 5, 26, 21, 0, 27, 12, 25, 0, 20, 22, 717 23, 7, 8 718}; 719 720/* YYPGOTO[NTERM-NUM]. */ 721static const yytype_int8 yypgoto[] = 722{ 723 -20, -20, -20, 11, -20, -20, -20, -20, -20, -20, 724 -5, -11, -20, -1 725}; 726 727/* YYDEFGOTO[NTERM-NUM]. */ 728static const yytype_int8 yydefgoto[] = 729{ 730 0, 5, 6, 7, 8, 9, 10, 20, 21, 27, 731 28, 11, 25, 30 732}; 733 734/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 735 positive, shift that token. If negative, reduce the rule whose 736 number is the opposite. If YYTABLE_NINF, syntax error. */ 737static const yytype_int8 yytable[] = 738{ 739 1, 2, 3, 12, 14, 15, 16, 17, 18, 19, 740 24, 29, 29, 4, 22, 23, 24, 13, 31, 32, 741 26, 0, 0, 0, 0, 0, 0, 0, 4 742}; 743 744static const yytype_int8 yycheck[] = 745{ 746 4, 5, 6, 0, 7, 8, 9, 10, 11, 12, 747 29, 22, 23, 32, 20, 13, 29, 6, 23, 21, 748 21, -1, -1, -1, -1, -1, -1, -1, 32 749}; 750 751/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of 752 state STATE-NUM. */ 753static const yytype_int8 yystos[] = 754{ 755 0, 4, 5, 6, 32, 35, 36, 37, 38, 39, 756 40, 45, 0, 37, 7, 8, 9, 10, 11, 12, 757 41, 42, 20, 13, 29, 46, 47, 43, 44, 45, 758 47, 44, 21 759}; 760 761/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ 762static const yytype_int8 yyr1[] = 763{ 764 0, 34, 35, 36, 36, 37, 37, 38, 39, 40, 765 40, 40, 41, 42, 42, 42, 42, 42, 42, 42, 766 43, 43, 44, 44, 45, 46, 46, 47 767}; 768 769/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ 770static const yytype_int8 yyr2[] = 771{ 772 0, 2, 1, 2, 1, 2, 1, 3, 4, 1, 773 1, 1, 2, 1, 1, 1, 1, 1, 1, 0, 774 1, 0, 1, 1, 1, 1, 0, 1 775}; 776 777 778enum { YYENOMEM = -2 }; 779 780#define yyerrok (yyerrstatus = 0) 781#define yyclearin (yychar = YYEMPTY) 782 783#define YYACCEPT goto yyacceptlab 784#define YYABORT goto yyabortlab 785#define YYERROR goto yyerrorlab 786#define YYNOMEM goto yyexhaustedlab 787 788 789#define YYRECOVERING() (!!yyerrstatus) 790 791#define YYBACKUP(Token, Value) \ 792 do \ 793 if (yychar == YYEMPTY) \ 794 { \ 795 yychar = (Token); \ 796 yylval = (Value); \ 797 YYPOPSTACK (yylen); \ 798 yystate = *yyssp; \ 799 goto yybackup; \ 800 } \ 801 else \ 802 { \ 803 yyerror (YY_("syntax error: cannot back up")); \ 804 YYERROR; \ 805 } \ 806 while (0) 807 808/* Backward compatibility with an undocumented macro. 809 Use YYerror or YYUNDEF. */ 810#define YYERRCODE YYUNDEF 811 812 813/* Enable debugging if requested. */ 814#if YYDEBUG 815 816# ifndef YYFPRINTF 817# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 818# define YYFPRINTF fprintf 819# endif 820 821# define YYDPRINTF(Args) \ 822do { \ 823 if (yydebug) \ 824 YYFPRINTF Args; \ 825} while (0) 826 827 828 829 830# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ 831do { \ 832 if (yydebug) \ 833 { \ 834 YYFPRINTF (stderr, "%s ", Title); \ 835 yy_symbol_print (stderr, \ 836 Kind, Value); \ 837 YYFPRINTF (stderr, "\n"); \ 838 } \ 839} while (0) 840 841 842/*-----------------------------------. 843| Print this symbol's value on YYO. | 844`-----------------------------------*/ 845 846static void 847yy_symbol_value_print (FILE *yyo, 848 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) 849{ 850 FILE *yyoutput = yyo; 851 YY_USE (yyoutput); 852 if (!yyvaluep) 853 return; 854 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 855 YY_USE (yykind); 856 YY_IGNORE_MAYBE_UNINITIALIZED_END 857} 858 859 860/*---------------------------. 861| Print this symbol on YYO. | 862`---------------------------*/ 863 864static void 865yy_symbol_print (FILE *yyo, 866 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) 867{ 868 YYFPRINTF (yyo, "%s %s (", 869 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); 870 871 yy_symbol_value_print (yyo, yykind, yyvaluep); 872 YYFPRINTF (yyo, ")"); 873} 874 875/*------------------------------------------------------------------. 876| yy_stack_print -- Print the state stack from its BOTTOM up to its | 877| TOP (included). | 878`------------------------------------------------------------------*/ 879 880static void 881yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) 882{ 883 YYFPRINTF (stderr, "Stack now"); 884 for (; yybottom <= yytop; yybottom++) 885 { 886 int yybot = *yybottom; 887 YYFPRINTF (stderr, " %d", yybot); 888 } 889 YYFPRINTF (stderr, "\n"); 890} 891 892# define YY_STACK_PRINT(Bottom, Top) \ 893do { \ 894 if (yydebug) \ 895 yy_stack_print ((Bottom), (Top)); \ 896} while (0) 897 898 899/*------------------------------------------------. 900| Report that the YYRULE is going to be reduced. | 901`------------------------------------------------*/ 902 903static void 904yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, 905 int yyrule) 906{ 907 int yylno = yyrline[yyrule]; 908 int yynrhs = yyr2[yyrule]; 909 int yyi; 910 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", 911 yyrule - 1, yylno); 912 /* The symbols being reduced. */ 913 for (yyi = 0; yyi < yynrhs; yyi++) 914 { 915 YYFPRINTF (stderr, " $%d = ", yyi + 1); 916 yy_symbol_print (stderr, 917 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), 918 &yyvsp[(yyi + 1) - (yynrhs)]); 919 YYFPRINTF (stderr, "\n"); 920 } 921} 922 923# define YY_REDUCE_PRINT(Rule) \ 924do { \ 925 if (yydebug) \ 926 yy_reduce_print (yyssp, yyvsp, Rule); \ 927} while (0) 928 929/* Nonzero means print parse trace. It is left uninitialized so that 930 multiple parsers can coexist. */ 931int yydebug; 932#else /* !YYDEBUG */ 933# define YYDPRINTF(Args) ((void) 0) 934# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) 935# define YY_STACK_PRINT(Bottom, Top) 936# define YY_REDUCE_PRINT(Rule) 937#endif /* !YYDEBUG */ 938 939 940/* YYINITDEPTH -- initial size of the parser's stacks. */ 941#ifndef YYINITDEPTH 942# define YYINITDEPTH 200 943#endif 944 945/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 946 if the built-in stack extension method is used). 947 948 Do not make this value too large; the results are undefined if 949 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 950 evaluated with infinite-precision integer arithmetic. */ 951 952#ifndef YYMAXDEPTH 953# define YYMAXDEPTH 10000 954#endif 955 956 957 958 959 960 961/*-----------------------------------------------. 962| Release the memory associated to this symbol. | 963`-----------------------------------------------*/ 964 965static void 966yydestruct (const char *yymsg, 967 yysymbol_kind_t yykind, YYSTYPE *yyvaluep) 968{ 969 YY_USE (yyvaluep); 970 if (!yymsg) 971 yymsg = "Deleting"; 972 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); 973 974 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 975 YY_USE (yykind); 976 YY_IGNORE_MAYBE_UNINITIALIZED_END 977} 978 979 980/* Lookahead token kind. */ 981int yychar; 982 983/* The semantic value of the lookahead symbol. */ 984YYSTYPE yylval; 985/* Number of syntax errors so far. */ 986int yynerrs; 987 988 989 990 991/*----------. 992| yyparse. | 993`----------*/ 994 995int 996yyparse (void) 997{ 998 yy_state_fast_t yystate = 0; 999 /* Number of tokens to shift before error messages enabled. */ 1000 int yyerrstatus = 0; 1001 1002 /* Refer to the stacks through separate pointers, to allow yyoverflow 1003 to reallocate them elsewhere. */ 1004 1005 /* Their size. */ 1006 YYPTRDIFF_T yystacksize = YYINITDEPTH; 1007 1008 /* The state stack: array, bottom, top. */ 1009 yy_state_t yyssa[YYINITDEPTH]; 1010 yy_state_t *yyss = yyssa; 1011 yy_state_t *yyssp = yyss; 1012 1013 /* The semantic value stack: array, bottom, top. */ 1014 YYSTYPE yyvsa[YYINITDEPTH]; 1015 YYSTYPE *yyvs = yyvsa; 1016 YYSTYPE *yyvsp = yyvs; 1017 1018 int yyn; 1019 /* The return value of yyparse. */ 1020 int yyresult; 1021 /* Lookahead symbol kind. */ 1022 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; 1023 /* The variables used to return semantic value and location from the 1024 action routines. */ 1025 YYSTYPE yyval; 1026 1027 1028 1029#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1030 1031 /* The number of symbols on the RHS of the reduced rule. 1032 Keep to zero when no symbol should be popped. */ 1033 int yylen = 0; 1034 1035 YYDPRINTF ((stderr, "Starting parse\n")); 1036 1037 yychar = YYEMPTY; /* Cause a token to be read. */ 1038 1039 goto yysetstate; 1040 1041 1042/*------------------------------------------------------------. 1043| yynewstate -- push a new state, which is found in yystate. | 1044`------------------------------------------------------------*/ 1045yynewstate: 1046 /* In all cases, when you get here, the value and location stacks 1047 have just been pushed. So pushing a state here evens the stacks. */ 1048 yyssp++; 1049 1050 1051/*--------------------------------------------------------------------. 1052| yysetstate -- set current state (the top of the stack) to yystate. | 1053`--------------------------------------------------------------------*/ 1054yysetstate: 1055 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1056 YY_ASSERT (0 <= yystate && yystate < YYNSTATES); 1057 YY_IGNORE_USELESS_CAST_BEGIN 1058 *yyssp = YY_CAST (yy_state_t, yystate); 1059 YY_IGNORE_USELESS_CAST_END 1060 YY_STACK_PRINT (yyss, yyssp); 1061 1062 if (yyss + yystacksize - 1 <= yyssp) 1063#if !defined yyoverflow && !defined YYSTACK_RELOCATE 1064 YYNOMEM; 1065#else 1066 { 1067 /* Get the current used size of the three stacks, in elements. */ 1068 YYPTRDIFF_T yysize = yyssp - yyss + 1; 1069 1070# if defined yyoverflow 1071 { 1072 /* Give user a chance to reallocate the stack. Use copies of 1073 these so that the &'s don't force the real ones into 1074 memory. */ 1075 yy_state_t *yyss1 = yyss; 1076 YYSTYPE *yyvs1 = yyvs; 1077 1078 /* Each stack pointer address is followed by the size of the 1079 data in use in that stack, in bytes. This used to be a 1080 conditional around just the two extra args, but that might 1081 be undefined if yyoverflow is a macro. */ 1082 yyoverflow (YY_("memory exhausted"), 1083 &yyss1, yysize * YYSIZEOF (*yyssp), 1084 &yyvs1, yysize * YYSIZEOF (*yyvsp), 1085 &yystacksize); 1086 yyss = yyss1; 1087 yyvs = yyvs1; 1088 } 1089# else /* defined YYSTACK_RELOCATE */ 1090 /* Extend the stack our own way. */ 1091 if (YYMAXDEPTH <= yystacksize) 1092 YYNOMEM; 1093 yystacksize *= 2; 1094 if (YYMAXDEPTH < yystacksize) 1095 yystacksize = YYMAXDEPTH; 1096 1097 { 1098 yy_state_t *yyss1 = yyss; 1099 union yyalloc *yyptr = 1100 YY_CAST (union yyalloc *, 1101 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); 1102 if (! yyptr) 1103 YYNOMEM; 1104 YYSTACK_RELOCATE (yyss_alloc, yyss); 1105 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1106# undef YYSTACK_RELOCATE 1107 if (yyss1 != yyssa) 1108 YYSTACK_FREE (yyss1); 1109 } 1110# endif 1111 1112 yyssp = yyss + yysize - 1; 1113 yyvsp = yyvs + yysize - 1; 1114 1115 YY_IGNORE_USELESS_CAST_BEGIN 1116 YYDPRINTF ((stderr, "Stack size increased to %ld\n", 1117 YY_CAST (long, yystacksize))); 1118 YY_IGNORE_USELESS_CAST_END 1119 1120 if (yyss + yystacksize - 1 <= yyssp) 1121 YYABORT; 1122 } 1123#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ 1124 1125 1126 if (yystate == YYFINAL) 1127 YYACCEPT; 1128 1129 goto yybackup; 1130 1131 1132/*-----------. 1133| yybackup. | 1134`-----------*/ 1135yybackup: 1136 /* Do appropriate processing given the current state. Read a 1137 lookahead token if we need one and don't already have one. */ 1138 1139 /* First try to decide what to do without reference to lookahead token. */ 1140 yyn = yypact[yystate]; 1141 if (yypact_value_is_default (yyn)) 1142 goto yydefault; 1143 1144 /* Not known => get a lookahead token if don't already have one. */ 1145 1146 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ 1147 if (yychar == YYEMPTY) 1148 { 1149 YYDPRINTF ((stderr, "Reading a token\n")); 1150 yychar = yylex (); 1151 } 1152 1153 if (yychar <= END_OF_FILE) 1154 { 1155 yychar = END_OF_FILE; 1156 yytoken = YYSYMBOL_YYEOF; 1157 YYDPRINTF ((stderr, "Now at end of input.\n")); 1158 } 1159 else if (yychar == YYerror) 1160 { 1161 /* The scanner already issued an error message, process directly 1162 to error recovery. But do not keep the error token as 1163 lookahead, it is too special and may lead us to an endless 1164 loop in error recovery. */ 1165 yychar = YYUNDEF; 1166 yytoken = YYSYMBOL_YYerror; 1167 goto yyerrlab1; 1168 } 1169 else 1170 { 1171 yytoken = YYTRANSLATE (yychar); 1172 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1173 } 1174 1175 /* If the proper action on seeing token YYTOKEN is to reduce or to 1176 detect an error, take that action. */ 1177 yyn += yytoken; 1178 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1179 goto yydefault; 1180 yyn = yytable[yyn]; 1181 if (yyn <= 0) 1182 { 1183 if (yytable_value_is_error (yyn)) 1184 goto yyerrlab; 1185 yyn = -yyn; 1186 goto yyreduce; 1187 } 1188 1189 /* Count tokens shifted since error; after three, turn off error 1190 status. */ 1191 if (yyerrstatus) 1192 yyerrstatus--; 1193 1194 /* Shift the lookahead token. */ 1195 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1196 yystate = yyn; 1197 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1198 *++yyvsp = yylval; 1199 YY_IGNORE_MAYBE_UNINITIALIZED_END 1200 1201 /* Discard the shifted token. */ 1202 yychar = YYEMPTY; 1203 goto yynewstate; 1204 1205 1206/*-----------------------------------------------------------. 1207| yydefault -- do the default action for the current state. | 1208`-----------------------------------------------------------*/ 1209yydefault: 1210 yyn = yydefact[yystate]; 1211 if (yyn == 0) 1212 goto yyerrlab; 1213 goto yyreduce; 1214 1215 1216/*-----------------------------. 1217| yyreduce -- do a reduction. | 1218`-----------------------------*/ 1219yyreduce: 1220 /* yyn is the number of a rule to reduce with. */ 1221 yylen = yyr2[yyn]; 1222 1223 /* If YYLEN is nonzero, implement the default value of the action: 1224 '$$ = $1'. 1225 1226 Otherwise, the following line sets YYVAL to garbage. 1227 This behavior is undocumented and Bison 1228 users should not rely upon it. Assigning to YYVAL 1229 unconditionally makes the parser a bit smaller, and it avoids a 1230 GCC warning that YYVAL may be used uninitialized. */ 1231 yyval = yyvsp[1-yylen]; 1232 1233 1234 YY_REDUCE_PRINT (yyn); 1235 switch (yyn) 1236 { 1237 case 2: /* CfgFile: CfgEntryList */ 1238#line 87 "cfgparse.y" 1239 { InterpretConfigs((yyvsp[0].entry)); } 1240#line 1241 "cfgparse.c" 1241 break; 1242 1243 case 3: /* CfgEntryList: CfgEntryList CfgEntry */ 1244#line 91 "cfgparse.y" 1245 { 1246 CfgEntryPtr tmp; 1247 if ((yyvsp[-1].entry)!=NULL) { 1248 for (tmp=(yyvsp[-1].entry);tmp->next!=NULL;tmp=tmp->next) { 1249 /* conditional does the work */ 1250 } 1251 tmp->next= (yyvsp[0].entry); 1252 (yyval.entry)= (yyvsp[-1].entry); 1253 } 1254 else (yyval.entry)= (yyvsp[0].entry); 1255 } 1256#line 1257 "cfgparse.c" 1257 break; 1258 1259 case 4: /* CfgEntryList: CfgEntry */ 1260#line 102 "cfgparse.y" 1261 { (yyval.entry)= (yyvsp[0].entry); } 1262#line 1263 "cfgparse.c" 1263 break; 1264 1265 case 5: /* CfgEntry: EventDef ActionDef */ 1266#line 106 "cfgparse.y" 1267 { 1268 if (((yyvsp[-1].entry))&&((yyvsp[0].act))) 1269 (yyvsp[-1].entry)->action= *((yyvsp[0].act)); 1270 if ((yyvsp[0].act)) 1271 free((yyvsp[0].act)); 1272 (yyval.entry)= (yyvsp[-1].entry); 1273 } 1274#line 1275 "cfgparse.c" 1275 break; 1276 1277 case 6: /* CfgEntry: VarDef */ 1278#line 113 "cfgparse.y" 1279 { (yyval.entry)= (yyvsp[0].entry); } 1280#line 1281 "cfgparse.c" 1281 break; 1282 1283 case 7: /* VarDef: Ident EQUALS NameSpec */ 1284#line 117 "cfgparse.y" 1285 { 1286 CfgEntryPtr cfg; 1287 cfg= calloc(1,sizeof(CfgEntryRec)); 1288 if (cfg) { 1289 cfg->entry_type= VariableDef; 1290 cfg->event_type= 0; 1291 cfg->name.str= (yyvsp[-2].str); 1292 cfg->action.type= UnknownAction; 1293 cfg->action.text= (yyvsp[0].str); 1294 cfg->action.priv= 0; 1295 cfg->next= NULL; 1296 } 1297 (yyval.entry)= cfg; 1298 } 1299#line 1300 "cfgparse.c" 1300 break; 1301 1302 case 8: /* EventDef: EventType OPAREN OptNameSpec CPAREN */ 1303#line 134 "cfgparse.y" 1304 { 1305 CfgEntryPtr cfg; 1306 cfg= calloc(1,sizeof(CfgEntryRec)); 1307 if (cfg) { 1308 cfg->entry_type= EventDef; 1309 cfg->event_type= (yyvsp[-3].ival); 1310 cfg->name.str= (yyvsp[-1].str); 1311 cfg->action.type= UnknownAction; 1312 cfg->action.text= NULL; 1313 cfg->action.priv= 0; 1314 cfg->next= NULL; 1315 } 1316 (yyval.entry)= cfg; 1317 } 1318#line 1319 "cfgparse.c" 1319 break; 1320 1321 case 9: /* EventType: BELL */ 1322#line 150 "cfgparse.y" 1323 { (yyval.ival)= XkbBellNotify; } 1324#line 1325 "cfgparse.c" 1325 break; 1326 1327 case 10: /* EventType: ACCESSX */ 1328#line 151 "cfgparse.y" 1329 { (yyval.ival)= XkbAccessXNotify; } 1330#line 1331 "cfgparse.c" 1331 break; 1332 1333 case 11: /* EventType: MESSAGE */ 1334#line 152 "cfgparse.y" 1335 { (yyval.ival)= XkbActionMessage; } 1336#line 1337 "cfgparse.c" 1337 break; 1338 1339 case 12: /* ActionDef: ActionType OptString */ 1340#line 156 "cfgparse.y" 1341 { 1342 ActDefPtr act; 1343 act= calloc(1,sizeof(ActDefRec)); 1344 if (act) { 1345 act->type= (yyvsp[-1].ival); 1346 act->text= (yyvsp[0].str); 1347 } 1348 (yyval.act)= act; 1349 } 1350#line 1351 "cfgparse.c" 1351 break; 1352 1353 case 13: /* ActionType: NONE */ 1354#line 167 "cfgparse.y" 1355 { (yyval.ival) = NoAction; } 1356#line 1357 "cfgparse.c" 1357 break; 1358 1359 case 14: /* ActionType: IGNORE */ 1360#line 168 "cfgparse.y" 1361 { (yyval.ival) = NoAction; } 1362#line 1363 "cfgparse.c" 1363 break; 1364 1365 case 15: /* ActionType: ECHO */ 1366#line 169 "cfgparse.y" 1367 { (yyval.ival) = EchoAction; } 1368#line 1369 "cfgparse.c" 1369 break; 1370 1371 case 16: /* ActionType: PRINT_EV */ 1372#line 170 "cfgparse.y" 1373 { (yyval.ival) = PrintEvAction; } 1374#line 1375 "cfgparse.c" 1375 break; 1376 1377 case 17: /* ActionType: SHELL */ 1378#line 171 "cfgparse.y" 1379 { (yyval.ival) = ShellAction; } 1380#line 1381 "cfgparse.c" 1381 break; 1382 1383 case 18: /* ActionType: SOUND */ 1384#line 172 "cfgparse.y" 1385 { (yyval.ival) = SoundAction; } 1386#line 1387 "cfgparse.c" 1387 break; 1388 1389 case 19: /* ActionType: %empty */ 1390#line 173 "cfgparse.y" 1391 { (yyval.ival) = UnknownAction; } 1392#line 1393 "cfgparse.c" 1393 break; 1394 1395 case 20: /* OptNameSpec: NameSpec */ 1396#line 176 "cfgparse.y" 1397 { (yyval.str)= (yyvsp[0].str); } 1398#line 1399 "cfgparse.c" 1399 break; 1400 1401 case 21: /* OptNameSpec: %empty */ 1402#line 177 "cfgparse.y" 1403 { (yyval.str)= NULL; } 1404#line 1405 "cfgparse.c" 1405 break; 1406 1407 case 22: /* NameSpec: Ident */ 1408#line 180 "cfgparse.y" 1409 { (yyval.str)= (yyvsp[0].str); } 1410#line 1411 "cfgparse.c" 1411 break; 1412 1413 case 23: /* NameSpec: String */ 1414#line 181 "cfgparse.y" 1415 { (yyval.str)= (yyvsp[0].str); } 1416#line 1417 "cfgparse.c" 1417 break; 1418 1419 case 24: /* Ident: IDENT */ 1420#line 184 "cfgparse.y" 1421 { (yyval.str)= scanStr; scanStr= NULL; } 1422#line 1423 "cfgparse.c" 1423 break; 1424 1425 case 25: /* OptString: String */ 1426#line 187 "cfgparse.y" 1427 { (yyval.str)= (yyvsp[0].str); } 1428#line 1429 "cfgparse.c" 1429 break; 1430 1431 case 26: /* OptString: %empty */ 1432#line 188 "cfgparse.y" 1433 { (yyval.str)= NULL; } 1434#line 1435 "cfgparse.c" 1435 break; 1436 1437 case 27: /* String: STRING */ 1438#line 191 "cfgparse.y" 1439 { (yyval.str)= scanStr; scanStr= NULL; } 1440#line 1441 "cfgparse.c" 1441 break; 1442 1443 1444#line 1445 "cfgparse.c" 1445 1446 default: break; 1447 } 1448 /* User semantic actions sometimes alter yychar, and that requires 1449 that yytoken be updated with the new translation. We take the 1450 approach of translating immediately before every use of yytoken. 1451 One alternative is translating here after every semantic action, 1452 but that translation would be missed if the semantic action invokes 1453 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 1454 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 1455 incorrect destructor might then be invoked immediately. In the 1456 case of YYERROR or YYBACKUP, subsequent parser actions might lead 1457 to an incorrect destructor call or verbose syntax error message 1458 before the lookahead is translated. */ 1459 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); 1460 1461 YYPOPSTACK (yylen); 1462 yylen = 0; 1463 1464 *++yyvsp = yyval; 1465 1466 /* Now 'shift' the result of the reduction. Determine what state 1467 that goes to, based on the state we popped back to and the rule 1468 number reduced by. */ 1469 { 1470 const int yylhs = yyr1[yyn] - YYNTOKENS; 1471 const int yyi = yypgoto[yylhs] + *yyssp; 1472 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp 1473 ? yytable[yyi] 1474 : yydefgoto[yylhs]); 1475 } 1476 1477 goto yynewstate; 1478 1479 1480/*--------------------------------------. 1481| yyerrlab -- here on detecting error. | 1482`--------------------------------------*/ 1483yyerrlab: 1484 /* Make sure we have latest lookahead translation. See comments at 1485 user semantic actions for why this is necessary. */ 1486 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); 1487 /* If not already recovering from an error, report this error. */ 1488 if (!yyerrstatus) 1489 { 1490 ++yynerrs; 1491 yyerror (YY_("syntax error")); 1492 } 1493 1494 if (yyerrstatus == 3) 1495 { 1496 /* If just tried and failed to reuse lookahead token after an 1497 error, discard it. */ 1498 1499 if (yychar <= END_OF_FILE) 1500 { 1501 /* Return failure if at end of input. */ 1502 if (yychar == END_OF_FILE) 1503 YYABORT; 1504 } 1505 else 1506 { 1507 yydestruct ("Error: discarding", 1508 yytoken, &yylval); 1509 yychar = YYEMPTY; 1510 } 1511 } 1512 1513 /* Else will try to reuse lookahead token after shifting the error 1514 token. */ 1515 goto yyerrlab1; 1516 1517 1518/*---------------------------------------------------. 1519| yyerrorlab -- error raised explicitly by YYERROR. | 1520`---------------------------------------------------*/ 1521yyerrorlab: 1522 /* Pacify compilers when the user code never invokes YYERROR and the 1523 label yyerrorlab therefore never appears in user code. */ 1524 if (0) 1525 YYERROR; 1526 ++yynerrs; 1527 1528 /* Do not reclaim the symbols of the rule whose action triggered 1529 this YYERROR. */ 1530 YYPOPSTACK (yylen); 1531 yylen = 0; 1532 YY_STACK_PRINT (yyss, yyssp); 1533 yystate = *yyssp; 1534 goto yyerrlab1; 1535 1536 1537/*-------------------------------------------------------------. 1538| yyerrlab1 -- common code for both syntax error and YYERROR. | 1539`-------------------------------------------------------------*/ 1540yyerrlab1: 1541 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1542 1543 /* Pop stack until we find a state that shifts the error token. */ 1544 for (;;) 1545 { 1546 yyn = yypact[yystate]; 1547 if (!yypact_value_is_default (yyn)) 1548 { 1549 yyn += YYSYMBOL_YYerror; 1550 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) 1551 { 1552 yyn = yytable[yyn]; 1553 if (0 < yyn) 1554 break; 1555 } 1556 } 1557 1558 /* Pop the current state because it cannot handle the error token. */ 1559 if (yyssp == yyss) 1560 YYABORT; 1561 1562 1563 yydestruct ("Error: popping", 1564 YY_ACCESSING_SYMBOL (yystate), yyvsp); 1565 YYPOPSTACK (1); 1566 yystate = *yyssp; 1567 YY_STACK_PRINT (yyss, yyssp); 1568 } 1569 1570 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1571 *++yyvsp = yylval; 1572 YY_IGNORE_MAYBE_UNINITIALIZED_END 1573 1574 1575 /* Shift the error token. */ 1576 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); 1577 1578 yystate = yyn; 1579 goto yynewstate; 1580 1581 1582/*-------------------------------------. 1583| yyacceptlab -- YYACCEPT comes here. | 1584`-------------------------------------*/ 1585yyacceptlab: 1586 yyresult = 0; 1587 goto yyreturnlab; 1588 1589 1590/*-----------------------------------. 1591| yyabortlab -- YYABORT comes here. | 1592`-----------------------------------*/ 1593yyabortlab: 1594 yyresult = 1; 1595 goto yyreturnlab; 1596 1597 1598/*-----------------------------------------------------------. 1599| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | 1600`-----------------------------------------------------------*/ 1601yyexhaustedlab: 1602 yyerror (YY_("memory exhausted")); 1603 yyresult = 2; 1604 goto yyreturnlab; 1605 1606 1607/*----------------------------------------------------------. 1608| yyreturnlab -- parsing is finished, clean up and return. | 1609`----------------------------------------------------------*/ 1610yyreturnlab: 1611 if (yychar != YYEMPTY) 1612 { 1613 /* Make sure we have latest lookahead translation. See comments at 1614 user semantic actions for why this is necessary. */ 1615 yytoken = YYTRANSLATE (yychar); 1616 yydestruct ("Cleanup: discarding lookahead", 1617 yytoken, &yylval); 1618 } 1619 /* Do not reclaim the symbols of the rule whose action triggered 1620 this YYABORT or YYACCEPT. */ 1621 YYPOPSTACK (yylen); 1622 YY_STACK_PRINT (yyss, yyssp); 1623 while (yyssp != yyss) 1624 { 1625 yydestruct ("Cleanup: popping", 1626 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); 1627 YYPOPSTACK (1); 1628 } 1629#ifndef yyoverflow 1630 if (yyss != yyssa) 1631 YYSTACK_FREE (yyss); 1632#endif 1633 1634 return yyresult; 1635} 1636 1637#line 193 "cfgparse.y" 1638 1639int 1640yyerror(char *s) 1641{ 1642 (void)fprintf(stderr,"%s: line %d of %s\n",s,lineNum, 1643 (scanFile?scanFile:"(unknown)")); 1644 if (scanStr) 1645 (void)fprintf(stderr,"last scanned symbol is: %s\n",scanStr); 1646 return 1; 1647} 1648 1649 1650int 1651yywrap(void) 1652{ 1653 return 1; 1654} 1655 1656int 1657CFGParseFile(FILE *file) 1658{ 1659 if (file) { 1660 yyin= file; 1661 if (yyparse()==0) { 1662 return 1; 1663 } 1664 return 0; 1665 } 1666 return 1; 1667} 1668