cfgparse.c revision 76910425
1/* A Bison parser, made by GNU Bison 2.1. */ 2 3/* Skeleton parser for Yacc-like parsing with Bison, 4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 Boston, MA 02110-1301, USA. */ 20 21/* As a special exception, when this file is copied by Bison into a 22 Bison output file, you may use that output file without restriction. 23 This special exception was added by the Free Software Foundation 24 in version 1.24 of Bison. */ 25 26/* Written by Richard Stallman by simplifying the original so called 27 ``semantic'' parser. */ 28 29/* All symbols defined below should begin with yy or YY, to avoid 30 infringing on user name space. This should be done even for local 31 variables, as they might otherwise be expanded by user macros. 32 There are some unavoidable exceptions within include files to 33 define necessary library symbols; they are noted "INFRINGES ON 34 USER NAME SPACE" below. */ 35 36/* Identify Bison output. */ 37#define YYBISON 1 38 39/* Bison version. */ 40#define YYBISON_VERSION "2.1" 41 42/* Skeleton name. */ 43#define YYSKELETON_NAME "yacc.c" 44 45/* Pure parsers. */ 46#define YYPURE 0 47 48/* Using locations. */ 49#define YYLSP_NEEDED 0 50 51 52 53/* Tokens. */ 54#ifndef YYTOKENTYPE 55# define YYTOKENTYPE 56 /* Put the tokens into the symbol table, so that GDB and other debuggers 57 know about them. */ 58 enum yytokentype { 59 END_OF_FILE = 0, 60 ERROR = 255, 61 BELL = 1, 62 ACCESSX = 2, 63 MESSAGE = 3, 64 NONE = 20, 65 IGNORE = 21, 66 ECHO = 22, 67 PRINT_EV = 23, 68 SHELL = 24, 69 SOUND = 25, 70 EQUALS = 40, 71 PLUS = 41, 72 MINUS = 42, 73 DIVIDE = 43, 74 TIMES = 44, 75 OBRACE = 45, 76 CBRACE = 46, 77 OPAREN = 47, 78 CPAREN = 48, 79 OBRACKET = 49, 80 CBRACKET = 50, 81 DOT = 51, 82 COMMA = 52, 83 SEMI = 53, 84 EXCLAM = 54, 85 INVERT = 55, 86 STRING = 60, 87 INTEGER = 61, 88 FLOAT = 62, 89 IDENT = 63, 90 KEYNAME = 64 91 }; 92#endif 93/* Tokens. */ 94#define END_OF_FILE 0 95#define ERROR 255 96#define BELL 1 97#define ACCESSX 2 98#define MESSAGE 3 99#define NONE 20 100#define IGNORE 21 101#define ECHO 22 102#define PRINT_EV 23 103#define SHELL 24 104#define SOUND 25 105#define EQUALS 40 106#define PLUS 41 107#define MINUS 42 108#define DIVIDE 43 109#define TIMES 44 110#define OBRACE 45 111#define CBRACE 46 112#define OPAREN 47 113#define CPAREN 48 114#define OBRACKET 49 115#define CBRACKET 50 116#define DOT 51 117#define COMMA 52 118#define SEMI 53 119#define EXCLAM 54 120#define INVERT 55 121#define STRING 60 122#define INTEGER 61 123#define FLOAT 62 124#define IDENT 63 125#define KEYNAME 64 126 127 128 129 130/* Copy the first part of user declarations. */ 131#line 64 "cfgparse.y" 132 133#ifdef DEBUG 134#define YYDEBUG 1 135#endif 136#define DEBUG_VAR parseDebug 137#include "xkbevd.h" 138 139 140/* Enabling traces. */ 141#ifndef YYDEBUG 142# define YYDEBUG 0 143#endif 144 145/* Enabling verbose error messages. */ 146#ifdef YYERROR_VERBOSE 147# undef YYERROR_VERBOSE 148# define YYERROR_VERBOSE 1 149#else 150# define YYERROR_VERBOSE 0 151#endif 152 153/* Enabling the token table. */ 154#ifndef YYTOKEN_TABLE 155# define YYTOKEN_TABLE 0 156#endif 157 158#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) 159#line 77 "cfgparse.y" 160typedef union YYSTYPE { 161 char * str; 162 int ival; 163 CfgEntryPtr entry; 164 ActDefPtr act; 165} YYSTYPE; 166/* Line 196 of yacc.c. */ 167#line 168 "cfgparse.c" 168# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 169# define YYSTYPE_IS_DECLARED 1 170# define YYSTYPE_IS_TRIVIAL 1 171#endif 172 173 174 175/* Copy the second part of user declarations. */ 176 177 178/* Line 219 of yacc.c. */ 179#line 180 "cfgparse.c" 180 181#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) 182# define YYSIZE_T __SIZE_TYPE__ 183#endif 184#if ! defined (YYSIZE_T) && defined (size_t) 185# define YYSIZE_T size_t 186#endif 187#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) 188# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 189# define YYSIZE_T size_t 190#endif 191#if ! defined (YYSIZE_T) 192# define YYSIZE_T unsigned int 193#endif 194 195#ifndef YY_ 196# if YYENABLE_NLS 197# if ENABLE_NLS 198# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 199# define YY_(msgid) dgettext ("bison-runtime", msgid) 200# endif 201# endif 202# ifndef YY_ 203# define YY_(msgid) msgid 204# endif 205#endif 206 207#if ! defined (yyoverflow) || YYERROR_VERBOSE 208 209/* The parser invokes alloca or malloc; define the necessary symbols. */ 210 211# ifdef YYSTACK_USE_ALLOCA 212# if YYSTACK_USE_ALLOCA 213# ifdef __GNUC__ 214# define YYSTACK_ALLOC __builtin_alloca 215# else 216# define YYSTACK_ALLOC alloca 217# if defined (__STDC__) || defined (__cplusplus) 218# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 219# define YYINCLUDED_STDLIB_H 220# endif 221# endif 222# endif 223# endif 224 225# ifdef YYSTACK_ALLOC 226 /* Pacify GCC's `empty if-body' warning. */ 227# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 228# ifndef YYSTACK_ALLOC_MAXIMUM 229 /* The OS might guarantee only one guard page at the bottom of the stack, 230 and a page size can be as small as 4096 bytes. So we cannot safely 231 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 232 to allow for a few compiler-allocated temporary stack slots. */ 233# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ 234# endif 235# else 236# define YYSTACK_ALLOC YYMALLOC 237# define YYSTACK_FREE YYFREE 238# ifndef YYSTACK_ALLOC_MAXIMUM 239# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) 240# endif 241# ifdef __cplusplus 242extern "C" { 243# endif 244# ifndef YYMALLOC 245# define YYMALLOC malloc 246# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ 247 && (defined (__STDC__) || defined (__cplusplus))) 248void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 249# endif 250# endif 251# ifndef YYFREE 252# define YYFREE free 253# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ 254 && (defined (__STDC__) || defined (__cplusplus))) 255void free (void *); /* INFRINGES ON USER NAME SPACE */ 256# endif 257# endif 258# ifdef __cplusplus 259} 260# endif 261# endif 262#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ 263 264 265#if (! defined (yyoverflow) \ 266 && (! defined (__cplusplus) \ 267 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) 268 269/* A type that is properly aligned for any stack member. */ 270union yyalloc 271{ 272 short int yyss; 273 YYSTYPE yyvs; 274 }; 275 276/* The size of the maximum gap between one aligned stack and the next. */ 277# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 278 279/* The size of an array large to enough to hold all stacks, each with 280 N elements. */ 281# define YYSTACK_BYTES(N) \ 282 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ 283 + YYSTACK_GAP_MAXIMUM) 284 285/* Copy COUNT objects from FROM to TO. The source and destination do 286 not overlap. */ 287# ifndef YYCOPY 288# if defined (__GNUC__) && 1 < __GNUC__ 289# define YYCOPY(To, From, Count) \ 290 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 291# else 292# define YYCOPY(To, From, Count) \ 293 do \ 294 { \ 295 YYSIZE_T yyi; \ 296 for (yyi = 0; yyi < (Count); yyi++) \ 297 (To)[yyi] = (From)[yyi]; \ 298 } \ 299 while (0) 300# endif 301# endif 302 303/* Relocate STACK from its old location to the new one. The 304 local variables YYSIZE and YYSTACKSIZE give the old and new number of 305 elements in the stack, and YYPTR gives the new location of the 306 stack. Advance YYPTR to a properly aligned location for the next 307 stack. */ 308# define YYSTACK_RELOCATE(Stack) \ 309 do \ 310 { \ 311 YYSIZE_T yynewbytes; \ 312 YYCOPY (&yyptr->Stack, Stack, yysize); \ 313 Stack = &yyptr->Stack; \ 314 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 315 yyptr += yynewbytes / sizeof (*yyptr); \ 316 } \ 317 while (0) 318 319#endif 320 321#if defined (__STDC__) || defined (__cplusplus) 322 typedef signed char yysigned_char; 323#else 324 typedef short int yysigned_char; 325#endif 326 327/* YYFINAL -- State number of the termination state. */ 328#define YYFINAL 12 329/* YYLAST -- Last index in YYTABLE. */ 330#define YYLAST 28 331 332/* YYNTOKENS -- Number of terminals. */ 333#define YYNTOKENS 34 334/* YYNNTS -- Number of nonterminals. */ 335#define YYNNTS 14 336/* YYNRULES -- Number of rules. */ 337#define YYNRULES 27 338/* YYNRULES -- Number of states. */ 339#define YYNSTATES 33 340 341/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 342#define YYUNDEFTOK 2 343#define YYMAXUTOK 257 344 345#define YYTRANSLATE(YYX) \ 346 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 347 348/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 349static const unsigned char yytranslate[] = 350{ 351 0, 4, 5, 6, 2, 2, 2, 2, 2, 2, 352 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 353 7, 8, 9, 10, 11, 12, 2, 2, 2, 2, 354 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 355 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 356 23, 24, 25, 26, 27, 28, 2, 2, 2, 2, 357 29, 30, 31, 32, 33, 2, 2, 2, 2, 2, 358 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 359 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 360 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 361 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 362 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 363 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 364 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 365 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 366 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 367 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 368 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 369 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 370 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 371 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 372 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 373 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 374 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 375 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 376 2, 2, 2, 2, 2, 3, 1, 2 377}; 378 379#if YYDEBUG 380/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 381 YYRHS. */ 382static const unsigned char yyprhs[] = 383{ 384 0, 0, 3, 5, 8, 10, 13, 15, 19, 24, 385 26, 28, 30, 33, 35, 37, 39, 41, 43, 45, 386 46, 48, 49, 51, 53, 55, 57, 58 387}; 388 389/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 390static const yysigned_char yyrhs[] = 391{ 392 35, 0, -1, 36, -1, 36, 37, -1, 37, -1, 393 39, 41, -1, 38, -1, 45, 13, 44, -1, 40, 394 20, 43, 21, -1, 4, -1, 5, -1, 6, -1, 395 42, 46, -1, 7, -1, 8, -1, 9, -1, 10, 396 -1, 11, -1, 12, -1, -1, 44, -1, -1, 45, 397 -1, 47, -1, 32, -1, 47, -1, -1, 29, -1 398}; 399 400/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 401static const unsigned char yyrline[] = 402{ 403 0, 88, 88, 92, 104, 107, 115, 118, 135, 152, 404 153, 154, 157, 169, 170, 171, 172, 173, 174, 175, 405 178, 179, 182, 183, 186, 189, 190, 193 406}; 407#endif 408 409#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 410/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 411 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 412static const char *const yytname[] = 413{ 414 "END_OF_FILE", "error", "$undefined", "ERROR", "BELL", "ACCESSX", 415 "MESSAGE", "NONE", "IGNORE", "ECHO", "PRINT_EV", "SHELL", "SOUND", 416 "EQUALS", "PLUS", "MINUS", "DIVIDE", "TIMES", "OBRACE", "CBRACE", 417 "OPAREN", "CPAREN", "OBRACKET", "CBRACKET", "DOT", "COMMA", "SEMI", 418 "EXCLAM", "INVERT", "STRING", "INTEGER", "FLOAT", "IDENT", "KEYNAME", 419 "$accept", "CfgFile", "CfgEntryList", "CfgEntry", "VarDef", "EventDef", 420 "EventType", "ActionDef", "ActionType", "OptNameSpec", "NameSpec", 421 "Ident", "OptString", "String", 0 422}; 423#endif 424 425# ifdef YYPRINT 426/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 427 token YYLEX-NUM. */ 428static const unsigned short int yytoknum[] = 429{ 430 0, 256, 257, 255, 1, 2, 3, 20, 21, 22, 431 23, 24, 25, 40, 41, 42, 43, 44, 45, 46, 432 47, 48, 49, 50, 51, 52, 53, 54, 55, 60, 433 61, 62, 63, 64 434}; 435# endif 436 437/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 438static const unsigned char yyr1[] = 439{ 440 0, 34, 35, 36, 36, 37, 37, 38, 39, 40, 441 40, 40, 41, 42, 42, 42, 42, 42, 42, 42, 442 43, 43, 44, 44, 45, 46, 46, 47 443}; 444 445/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 446static const unsigned char yyr2[] = 447{ 448 0, 2, 1, 2, 1, 2, 1, 3, 4, 1, 449 1, 1, 2, 1, 1, 1, 1, 1, 1, 0, 450 1, 0, 1, 1, 1, 1, 0, 1 451}; 452 453/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 454 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 455 means the default is an error. */ 456static const unsigned char yydefact[] = 457{ 458 0, 9, 10, 11, 24, 0, 2, 4, 6, 19, 459 0, 0, 1, 3, 13, 14, 15, 16, 17, 18, 460 5, 26, 21, 0, 27, 12, 25, 0, 20, 22, 461 23, 7, 8 462}; 463 464/* YYDEFGOTO[NTERM-NUM]. */ 465static const yysigned_char yydefgoto[] = 466{ 467 -1, 5, 6, 7, 8, 9, 10, 20, 21, 27, 468 28, 11, 25, 30 469}; 470 471/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 472 STATE-NUM. */ 473#define YYPACT_NINF -20 474static const yysigned_char yypact[] = 475{ 476 -4, -20, -20, -20, -20, 3, -4, -20, -20, -3, 477 -6, 2, -20, -20, -20, -20, -20, -20, -20, -20, 478 -20, -13, -19, -19, -20, -20, -20, -2, -20, -20, 479 -20, -20, -20 480}; 481 482/* YYPGOTO[NTERM-NUM]. */ 483static const yysigned_char yypgoto[] = 484{ 485 -20, -20, -20, 11, -20, -20, -20, -20, -20, -20, 486 -5, -11, -20, -1 487}; 488 489/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 490 positive, shift that token. If negative, reduce the rule which 491 number is the opposite. If zero, do what YYDEFACT says. 492 If YYTABLE_NINF, syntax error. */ 493#define YYTABLE_NINF -1 494static const unsigned char yytable[] = 495{ 496 1, 2, 3, 12, 14, 15, 16, 17, 18, 19, 497 24, 29, 29, 4, 22, 23, 24, 13, 31, 32, 498 26, 0, 0, 0, 0, 0, 0, 0, 4 499}; 500 501static const yysigned_char yycheck[] = 502{ 503 4, 5, 6, 0, 7, 8, 9, 10, 11, 12, 504 29, 22, 23, 32, 20, 13, 29, 6, 23, 21, 505 21, -1, -1, -1, -1, -1, -1, -1, 32 506}; 507 508/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 509 symbol of state STATE-NUM. */ 510static const unsigned char yystos[] = 511{ 512 0, 4, 5, 6, 32, 35, 36, 37, 38, 39, 513 40, 45, 0, 37, 7, 8, 9, 10, 11, 12, 514 41, 42, 20, 13, 29, 46, 47, 43, 44, 45, 515 47, 44, 21 516}; 517 518#define yyerrok (yyerrstatus = 0) 519#define yyclearin (yychar = YYEMPTY) 520#define YYEMPTY (-2) 521#define YYEOF 0 522 523#define YYACCEPT goto yyacceptlab 524#define YYABORT goto yyabortlab 525#define YYERROR goto yyerrorlab 526 527 528/* Like YYERROR except do call yyerror. This remains here temporarily 529 to ease the transition to the new meaning of YYERROR, for GCC. 530 Once GCC version 2 has supplanted version 1, this can go. */ 531 532#define YYFAIL goto yyerrlab 533 534#define YYRECOVERING() (!!yyerrstatus) 535 536#define YYBACKUP(Token, Value) \ 537do \ 538 if (yychar == YYEMPTY && yylen == 1) \ 539 { \ 540 yychar = (Token); \ 541 yylval = (Value); \ 542 yytoken = YYTRANSLATE (yychar); \ 543 YYPOPSTACK; \ 544 goto yybackup; \ 545 } \ 546 else \ 547 { \ 548 yyerror (YY_("syntax error: cannot back up")); \ 549 YYERROR; \ 550 } \ 551while (0) 552 553 554#define YYTERROR 1 555#define YYERRCODE 256 556 557 558/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 559 If N is 0, then set CURRENT to the empty location which ends 560 the previous symbol: RHS[0] (always defined). */ 561 562#define YYRHSLOC(Rhs, K) ((Rhs)[K]) 563#ifndef YYLLOC_DEFAULT 564# define YYLLOC_DEFAULT(Current, Rhs, N) \ 565 do \ 566 if (N) \ 567 { \ 568 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 569 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 570 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 571 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 572 } \ 573 else \ 574 { \ 575 (Current).first_line = (Current).last_line = \ 576 YYRHSLOC (Rhs, 0).last_line; \ 577 (Current).first_column = (Current).last_column = \ 578 YYRHSLOC (Rhs, 0).last_column; \ 579 } \ 580 while (0) 581#endif 582 583 584/* YY_LOCATION_PRINT -- Print the location on the stream. 585 This macro was not mandated originally: define only if we know 586 we won't break user code: when these are the locations we know. */ 587 588#ifndef YY_LOCATION_PRINT 589# if YYLTYPE_IS_TRIVIAL 590# define YY_LOCATION_PRINT(File, Loc) \ 591 fprintf (File, "%d.%d-%d.%d", \ 592 (Loc).first_line, (Loc).first_column, \ 593 (Loc).last_line, (Loc).last_column) 594# else 595# define YY_LOCATION_PRINT(File, Loc) ((void) 0) 596# endif 597#endif 598 599 600/* YYLEX -- calling `yylex' with the right arguments. */ 601 602#ifdef YYLEX_PARAM 603# define YYLEX yylex (YYLEX_PARAM) 604#else 605# define YYLEX yylex () 606#endif 607 608/* Enable debugging if requested. */ 609#if YYDEBUG 610 611# ifndef YYFPRINTF 612# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 613# define YYFPRINTF fprintf 614# endif 615 616# define YYDPRINTF(Args) \ 617do { \ 618 if (yydebug) \ 619 YYFPRINTF Args; \ 620} while (0) 621 622# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 623do { \ 624 if (yydebug) \ 625 { \ 626 YYFPRINTF (stderr, "%s ", Title); \ 627 yysymprint (stderr, \ 628 Type, Value); \ 629 YYFPRINTF (stderr, "\n"); \ 630 } \ 631} while (0) 632 633/*------------------------------------------------------------------. 634| yy_stack_print -- Print the state stack from its BOTTOM up to its | 635| TOP (included). | 636`------------------------------------------------------------------*/ 637 638#if defined (__STDC__) || defined (__cplusplus) 639static void 640yy_stack_print (short int *bottom, short int *top) 641#else 642static void 643yy_stack_print (bottom, top) 644 short int *bottom; 645 short int *top; 646#endif 647{ 648 YYFPRINTF (stderr, "Stack now"); 649 for (/* Nothing. */; bottom <= top; ++bottom) 650 YYFPRINTF (stderr, " %d", *bottom); 651 YYFPRINTF (stderr, "\n"); 652} 653 654# define YY_STACK_PRINT(Bottom, Top) \ 655do { \ 656 if (yydebug) \ 657 yy_stack_print ((Bottom), (Top)); \ 658} while (0) 659 660 661/*------------------------------------------------. 662| Report that the YYRULE is going to be reduced. | 663`------------------------------------------------*/ 664 665#if defined (__STDC__) || defined (__cplusplus) 666static void 667yy_reduce_print (int yyrule) 668#else 669static void 670yy_reduce_print (yyrule) 671 int yyrule; 672#endif 673{ 674 int yyi; 675 unsigned long int yylno = yyrline[yyrule]; 676 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", 677 yyrule - 1, yylno); 678 /* Print the symbols being reduced, and their result. */ 679 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) 680 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); 681 YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); 682} 683 684# define YY_REDUCE_PRINT(Rule) \ 685do { \ 686 if (yydebug) \ 687 yy_reduce_print (Rule); \ 688} while (0) 689 690/* Nonzero means print parse trace. It is left uninitialized so that 691 multiple parsers can coexist. */ 692int yydebug; 693#else /* !YYDEBUG */ 694# define YYDPRINTF(Args) 695# define YY_SYMBOL_PRINT(Title, Type, Value, Location) 696# define YY_STACK_PRINT(Bottom, Top) 697# define YY_REDUCE_PRINT(Rule) 698#endif /* !YYDEBUG */ 699 700 701/* YYINITDEPTH -- initial size of the parser's stacks. */ 702#ifndef YYINITDEPTH 703# define YYINITDEPTH 200 704#endif 705 706/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 707 if the built-in stack extension method is used). 708 709 Do not make this value too large; the results are undefined if 710 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 711 evaluated with infinite-precision integer arithmetic. */ 712 713#ifndef YYMAXDEPTH 714# define YYMAXDEPTH 10000 715#endif 716 717 718 719#if YYERROR_VERBOSE 720 721# ifndef yystrlen 722# if defined (__GLIBC__) && defined (_STRING_H) 723# define yystrlen strlen 724# else 725/* Return the length of YYSTR. */ 726static YYSIZE_T 727# if defined (__STDC__) || defined (__cplusplus) 728yystrlen (const char *yystr) 729# else 730yystrlen (yystr) 731 const char *yystr; 732# endif 733{ 734 const char *yys = yystr; 735 736 while (*yys++ != '\0') 737 continue; 738 739 return yys - yystr - 1; 740} 741# endif 742# endif 743 744# ifndef yystpcpy 745# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) 746# define yystpcpy stpcpy 747# else 748/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 749 YYDEST. */ 750static char * 751# if defined (__STDC__) || defined (__cplusplus) 752yystpcpy (char *yydest, const char *yysrc) 753# else 754yystpcpy (yydest, yysrc) 755 char *yydest; 756 const char *yysrc; 757# endif 758{ 759 char *yyd = yydest; 760 const char *yys = yysrc; 761 762 while ((*yyd++ = *yys++) != '\0') 763 continue; 764 765 return yyd - 1; 766} 767# endif 768# endif 769 770# ifndef yytnamerr 771/* Copy to YYRES the contents of YYSTR after stripping away unnecessary 772 quotes and backslashes, so that it's suitable for yyerror. The 773 heuristic is that double-quoting is unnecessary unless the string 774 contains an apostrophe, a comma, or backslash (other than 775 backslash-backslash). YYSTR is taken from yytname. If YYRES is 776 null, do not copy; instead, return the length of what the result 777 would have been. */ 778static YYSIZE_T 779yytnamerr (char *yyres, const char *yystr) 780{ 781 if (*yystr == '"') 782 { 783 size_t yyn = 0; 784 char const *yyp = yystr; 785 786 for (;;) 787 switch (*++yyp) 788 { 789 case '\'': 790 case ',': 791 goto do_not_strip_quotes; 792 793 case '\\': 794 if (*++yyp != '\\') 795 goto do_not_strip_quotes; 796 /* Fall through. */ 797 default: 798 if (yyres) 799 yyres[yyn] = *yyp; 800 yyn++; 801 break; 802 803 case '"': 804 if (yyres) 805 yyres[yyn] = '\0'; 806 return yyn; 807 } 808 do_not_strip_quotes: ; 809 } 810 811 if (! yyres) 812 return yystrlen (yystr); 813 814 return yystpcpy (yyres, yystr) - yyres; 815} 816# endif 817 818#endif /* YYERROR_VERBOSE */ 819 820 821 822#if YYDEBUG 823/*--------------------------------. 824| Print this symbol on YYOUTPUT. | 825`--------------------------------*/ 826 827#if defined (__STDC__) || defined (__cplusplus) 828static void 829yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) 830#else 831static void 832yysymprint (yyoutput, yytype, yyvaluep) 833 FILE *yyoutput; 834 int yytype; 835 YYSTYPE *yyvaluep; 836#endif 837{ 838 /* Pacify ``unused variable'' warnings. */ 839 (void) yyvaluep; 840 841 if (yytype < YYNTOKENS) 842 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 843 else 844 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 845 846 847# ifdef YYPRINT 848 if (yytype < YYNTOKENS) 849 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 850# endif 851 switch (yytype) 852 { 853 default: 854 break; 855 } 856 YYFPRINTF (yyoutput, ")"); 857} 858 859#endif /* ! YYDEBUG */ 860/*-----------------------------------------------. 861| Release the memory associated to this symbol. | 862`-----------------------------------------------*/ 863 864#if defined (__STDC__) || defined (__cplusplus) 865static void 866yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 867#else 868static void 869yydestruct (yymsg, yytype, yyvaluep) 870 const char *yymsg; 871 int yytype; 872 YYSTYPE *yyvaluep; 873#endif 874{ 875 /* Pacify ``unused variable'' warnings. */ 876 (void) yyvaluep; 877 878 if (!yymsg) 879 yymsg = "Deleting"; 880 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 881 882 switch (yytype) 883 { 884 885 default: 886 break; 887 } 888} 889 890 891/* Prevent warnings from -Wmissing-prototypes. */ 892 893#ifdef YYPARSE_PARAM 894# if defined (__STDC__) || defined (__cplusplus) 895int yyparse (void *YYPARSE_PARAM); 896# else 897int yyparse (); 898# endif 899#else /* ! YYPARSE_PARAM */ 900#if defined (__STDC__) || defined (__cplusplus) 901int yyparse (void); 902#else 903int yyparse (); 904#endif 905#endif /* ! YYPARSE_PARAM */ 906 907 908 909/* The look-ahead symbol. */ 910int yychar; 911 912/* The semantic value of the look-ahead symbol. */ 913YYSTYPE yylval; 914 915/* Number of syntax errors so far. */ 916int yynerrs; 917 918 919 920/*----------. 921| yyparse. | 922`----------*/ 923 924#ifdef YYPARSE_PARAM 925# if defined (__STDC__) || defined (__cplusplus) 926int yyparse (void *YYPARSE_PARAM) 927# else 928int yyparse (YYPARSE_PARAM) 929 void *YYPARSE_PARAM; 930# endif 931#else /* ! YYPARSE_PARAM */ 932#if defined (__STDC__) || defined (__cplusplus) 933int 934yyparse (void) 935#else 936int 937yyparse () 938 ; 939#endif 940#endif 941{ 942 943 int yystate; 944 int yyn; 945 int yyresult; 946 /* Number of tokens to shift before error messages enabled. */ 947 int yyerrstatus; 948 /* Look-ahead token as an internal (translated) token number. */ 949 int yytoken = 0; 950 951 /* Three stacks and their tools: 952 `yyss': related to states, 953 `yyvs': related to semantic values, 954 `yyls': related to locations. 955 956 Refer to the stacks thru separate pointers, to allow yyoverflow 957 to reallocate them elsewhere. */ 958 959 /* The state stack. */ 960 short int yyssa[YYINITDEPTH]; 961 short int *yyss = yyssa; 962 short int *yyssp; 963 964 /* The semantic value stack. */ 965 YYSTYPE yyvsa[YYINITDEPTH]; 966 YYSTYPE *yyvs = yyvsa; 967 YYSTYPE *yyvsp; 968 969 970 971#define YYPOPSTACK (yyvsp--, yyssp--) 972 973 YYSIZE_T yystacksize = YYINITDEPTH; 974 975 /* The variables used to return semantic value and location from the 976 action routines. */ 977 YYSTYPE yyval; 978 979 980 /* When reducing, the number of symbols on the RHS of the reduced 981 rule. */ 982 int yylen; 983 984 YYDPRINTF ((stderr, "Starting parse\n")); 985 986 yystate = 0; 987 yyerrstatus = 0; 988 yynerrs = 0; 989 yychar = YYEMPTY; /* Cause a token to be read. */ 990 991 /* Initialize stack pointers. 992 Waste one element of value and location stack 993 so that they stay on the same level as the state stack. 994 The wasted elements are never initialized. */ 995 996 yyssp = yyss; 997 yyvsp = yyvs; 998 999 goto yysetstate; 1000 1001/*------------------------------------------------------------. 1002| yynewstate -- Push a new state, which is found in yystate. | 1003`------------------------------------------------------------*/ 1004 yynewstate: 1005 /* In all cases, when you get here, the value and location stacks 1006 have just been pushed. so pushing a state here evens the stacks. 1007 */ 1008 yyssp++; 1009 1010 yysetstate: 1011 *yyssp = yystate; 1012 1013 if (yyss + yystacksize - 1 <= yyssp) 1014 { 1015 /* Get the current used size of the three stacks, in elements. */ 1016 YYSIZE_T yysize = yyssp - yyss + 1; 1017 1018#ifdef yyoverflow 1019 { 1020 /* Give user a chance to reallocate the stack. Use copies of 1021 these so that the &'s don't force the real ones into 1022 memory. */ 1023 YYSTYPE *yyvs1 = yyvs; 1024 short int *yyss1 = yyss; 1025 1026 1027 /* Each stack pointer address is followed by the size of the 1028 data in use in that stack, in bytes. This used to be a 1029 conditional around just the two extra args, but that might 1030 be undefined if yyoverflow is a macro. */ 1031 yyoverflow (YY_("memory exhausted"), 1032 &yyss1, yysize * sizeof (*yyssp), 1033 &yyvs1, yysize * sizeof (*yyvsp), 1034 1035 &yystacksize); 1036 1037 yyss = yyss1; 1038 yyvs = yyvs1; 1039 } 1040#else /* no yyoverflow */ 1041# ifndef YYSTACK_RELOCATE 1042 goto yyexhaustedlab; 1043# else 1044 /* Extend the stack our own way. */ 1045 if (YYMAXDEPTH <= yystacksize) 1046 goto yyexhaustedlab; 1047 yystacksize *= 2; 1048 if (YYMAXDEPTH < yystacksize) 1049 yystacksize = YYMAXDEPTH; 1050 1051 { 1052 short int *yyss1 = yyss; 1053 union yyalloc *yyptr = 1054 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1055 if (! yyptr) 1056 goto yyexhaustedlab; 1057 YYSTACK_RELOCATE (yyss); 1058 YYSTACK_RELOCATE (yyvs); 1059 1060# undef YYSTACK_RELOCATE 1061 if (yyss1 != yyssa) 1062 YYSTACK_FREE (yyss1); 1063 } 1064# endif 1065#endif /* no yyoverflow */ 1066 1067 yyssp = yyss + yysize - 1; 1068 yyvsp = yyvs + yysize - 1; 1069 1070 1071 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1072 (unsigned long int) yystacksize)); 1073 1074 if (yyss + yystacksize - 1 <= yyssp) 1075 YYABORT; 1076 } 1077 1078 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1079 1080 goto yybackup; 1081 1082/*-----------. 1083| yybackup. | 1084`-----------*/ 1085yybackup: 1086 1087/* Do appropriate processing given the current state. */ 1088/* Read a look-ahead token if we need one and don't already have one. */ 1089/* yyresume: */ 1090 1091 /* First try to decide what to do without reference to look-ahead token. */ 1092 1093 yyn = yypact[yystate]; 1094 if (yyn == YYPACT_NINF) 1095 goto yydefault; 1096 1097 /* Not known => get a look-ahead token if don't already have one. */ 1098 1099 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ 1100 if (yychar == YYEMPTY) 1101 { 1102 YYDPRINTF ((stderr, "Reading a token: ")); 1103 yychar = YYLEX; 1104 } 1105 1106 if (yychar <= YYEOF) 1107 { 1108 yychar = yytoken = YYEOF; 1109 YYDPRINTF ((stderr, "Now at end of input.\n")); 1110 } 1111 else 1112 { 1113 yytoken = YYTRANSLATE (yychar); 1114 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1115 } 1116 1117 /* If the proper action on seeing token YYTOKEN is to reduce or to 1118 detect an error, take that action. */ 1119 yyn += yytoken; 1120 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1121 goto yydefault; 1122 yyn = yytable[yyn]; 1123 if (yyn <= 0) 1124 { 1125 if (yyn == 0 || yyn == YYTABLE_NINF) 1126 goto yyerrlab; 1127 yyn = -yyn; 1128 goto yyreduce; 1129 } 1130 1131 if (yyn == YYFINAL) 1132 YYACCEPT; 1133 1134 /* Shift the look-ahead token. */ 1135 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1136 1137 /* Discard the token being shifted unless it is eof. */ 1138 if (yychar != YYEOF) 1139 yychar = YYEMPTY; 1140 1141 *++yyvsp = yylval; 1142 1143 1144 /* Count tokens shifted since error; after three, turn off error 1145 status. */ 1146 if (yyerrstatus) 1147 yyerrstatus--; 1148 1149 yystate = yyn; 1150 goto yynewstate; 1151 1152 1153/*-----------------------------------------------------------. 1154| yydefault -- do the default action for the current state. | 1155`-----------------------------------------------------------*/ 1156yydefault: 1157 yyn = yydefact[yystate]; 1158 if (yyn == 0) 1159 goto yyerrlab; 1160 goto yyreduce; 1161 1162 1163/*-----------------------------. 1164| yyreduce -- Do a reduction. | 1165`-----------------------------*/ 1166yyreduce: 1167 /* yyn is the number of a rule to reduce with. */ 1168 yylen = yyr2[yyn]; 1169 1170 /* If YYLEN is nonzero, implement the default value of the action: 1171 `$$ = $1'. 1172 1173 Otherwise, the following line sets YYVAL to garbage. 1174 This behavior is undocumented and Bison 1175 users should not rely upon it. Assigning to YYVAL 1176 unconditionally makes the parser a bit smaller, and it avoids a 1177 GCC warning that YYVAL may be used uninitialized. */ 1178 yyval = yyvsp[1-yylen]; 1179 1180 1181 YY_REDUCE_PRINT (yyn); 1182 switch (yyn) 1183 { 1184 case 2: 1185#line 89 "cfgparse.y" 1186 { InterpretConfigs((yyvsp[0].entry)); } 1187 break; 1188 1189 case 3: 1190#line 93 "cfgparse.y" 1191 { 1192 CfgEntryPtr tmp; 1193 if ((yyvsp[-1].entry)!=NULL) { 1194 for (tmp=(yyvsp[-1].entry);tmp->next!=NULL;tmp=tmp->next) { 1195 /* conditional does the work */ 1196 } 1197 tmp->next= (yyvsp[0].entry); 1198 (yyval.entry)= (yyvsp[-1].entry); 1199 } 1200 else (yyval.entry)= (yyvsp[0].entry); 1201 } 1202 break; 1203 1204 case 4: 1205#line 104 "cfgparse.y" 1206 { (yyval.entry)= (yyvsp[0].entry); } 1207 break; 1208 1209 case 5: 1210#line 108 "cfgparse.y" 1211 { 1212 if (((yyvsp[-1].entry))&&((yyvsp[0].act))) 1213 (yyvsp[-1].entry)->action= *((yyvsp[0].act)); 1214 if ((yyvsp[0].act)) 1215 uFree((yyvsp[0].act)); 1216 (yyval.entry)= (yyvsp[-1].entry); 1217 } 1218 break; 1219 1220 case 6: 1221#line 115 "cfgparse.y" 1222 { (yyval.entry)= (yyvsp[0].entry); } 1223 break; 1224 1225 case 7: 1226#line 119 "cfgparse.y" 1227 { 1228 CfgEntryPtr cfg; 1229 cfg= uTypedCalloc(1,CfgEntryRec); 1230 if (cfg) { 1231 cfg->entry_type= VariableDef; 1232 cfg->event_type= 0; 1233 cfg->name.str= (yyvsp[-2].str); 1234 cfg->action.type= UnknownAction; 1235 cfg->action.text= (yyvsp[0].str); 1236 cfg->action.priv= 0; 1237 cfg->next= NULL; 1238 } 1239 (yyval.entry)= cfg; 1240 } 1241 break; 1242 1243 case 8: 1244#line 136 "cfgparse.y" 1245 { 1246 CfgEntryPtr cfg; 1247 cfg= uTypedCalloc(1,CfgEntryRec); 1248 if (cfg) { 1249 cfg->entry_type= EventDef; 1250 cfg->event_type= (yyvsp[-3].ival); 1251 cfg->name.str= (yyvsp[-1].str); 1252 cfg->action.type= UnknownAction; 1253 cfg->action.text= NULL; 1254 cfg->action.priv= 0; 1255 cfg->next= NULL; 1256 } 1257 (yyval.entry)= cfg; 1258 } 1259 break; 1260 1261 case 9: 1262#line 152 "cfgparse.y" 1263 { (yyval.ival)= XkbBellNotify; } 1264 break; 1265 1266 case 10: 1267#line 153 "cfgparse.y" 1268 { (yyval.ival)= XkbAccessXNotify; } 1269 break; 1270 1271 case 11: 1272#line 154 "cfgparse.y" 1273 { (yyval.ival)= XkbActionMessage; } 1274 break; 1275 1276 case 12: 1277#line 158 "cfgparse.y" 1278 { 1279 ActDefPtr act; 1280 act= uTypedCalloc(1,ActDefRec); 1281 if (act) { 1282 act->type= (yyvsp[-1].ival); 1283 act->text= (yyvsp[0].str); 1284 } 1285 (yyval.act)= act; 1286 } 1287 break; 1288 1289 case 13: 1290#line 169 "cfgparse.y" 1291 { (yyval.ival) = NoAction; } 1292 break; 1293 1294 case 14: 1295#line 170 "cfgparse.y" 1296 { (yyval.ival) = NoAction; } 1297 break; 1298 1299 case 15: 1300#line 171 "cfgparse.y" 1301 { (yyval.ival) = EchoAction; } 1302 break; 1303 1304 case 16: 1305#line 172 "cfgparse.y" 1306 { (yyval.ival) = PrintEvAction; } 1307 break; 1308 1309 case 17: 1310#line 173 "cfgparse.y" 1311 { (yyval.ival) = ShellAction; } 1312 break; 1313 1314 case 18: 1315#line 174 "cfgparse.y" 1316 { (yyval.ival) = SoundAction; } 1317 break; 1318 1319 case 19: 1320#line 175 "cfgparse.y" 1321 { (yyval.ival) = UnknownAction; } 1322 break; 1323 1324 case 20: 1325#line 178 "cfgparse.y" 1326 { (yyval.str)= (yyvsp[0].str); } 1327 break; 1328 1329 case 21: 1330#line 179 "cfgparse.y" 1331 { (yyval.str)= NULL; } 1332 break; 1333 1334 case 22: 1335#line 182 "cfgparse.y" 1336 { (yyval.str)= (yyvsp[0].str); } 1337 break; 1338 1339 case 23: 1340#line 183 "cfgparse.y" 1341 { (yyval.str)= (yyvsp[0].str); } 1342 break; 1343 1344 case 24: 1345#line 186 "cfgparse.y" 1346 { (yyval.str)= scanStr; scanStr= NULL; } 1347 break; 1348 1349 case 25: 1350#line 189 "cfgparse.y" 1351 { (yyval.str)= (yyvsp[0].str); } 1352 break; 1353 1354 case 26: 1355#line 190 "cfgparse.y" 1356 { (yyval.str)= NULL; } 1357 break; 1358 1359 case 27: 1360#line 193 "cfgparse.y" 1361 { (yyval.str)= scanStr; scanStr= NULL; } 1362 break; 1363 1364 1365 default: break; 1366 } 1367 1368/* Line 1126 of yacc.c. */ 1369#line 1370 "cfgparse.c" 1370 1371 yyvsp -= yylen; 1372 yyssp -= yylen; 1373 1374 1375 YY_STACK_PRINT (yyss, yyssp); 1376 1377 *++yyvsp = yyval; 1378 1379 1380 /* Now `shift' the result of the reduction. Determine what state 1381 that goes to, based on the state we popped back to and the rule 1382 number reduced by. */ 1383 1384 yyn = yyr1[yyn]; 1385 1386 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1387 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1388 yystate = yytable[yystate]; 1389 else 1390 yystate = yydefgoto[yyn - YYNTOKENS]; 1391 1392 goto yynewstate; 1393 1394 1395/*------------------------------------. 1396| yyerrlab -- here on detecting error | 1397`------------------------------------*/ 1398yyerrlab: 1399 /* If not already recovering from an error, report this error. */ 1400 if (!yyerrstatus) 1401 { 1402 ++yynerrs; 1403#if YYERROR_VERBOSE 1404 yyn = yypact[yystate]; 1405 1406 if (YYPACT_NINF < yyn && yyn < YYLAST) 1407 { 1408 int yytype = YYTRANSLATE (yychar); 1409 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1410 YYSIZE_T yysize = yysize0; 1411 YYSIZE_T yysize1; 1412 int yysize_overflow = 0; 1413 char *yymsg = 0; 1414# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 1415 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1416 int yyx; 1417 1418#if 0 1419 /* This is so xgettext sees the translatable formats that are 1420 constructed on the fly. */ 1421 YY_("syntax error, unexpected %s"); 1422 YY_("syntax error, unexpected %s, expecting %s"); 1423 YY_("syntax error, unexpected %s, expecting %s or %s"); 1424 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1425 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1426#endif 1427 char *yyfmt; 1428 char const *yyf; 1429 static char const yyunexpected[] = "syntax error, unexpected %s"; 1430 static char const yyexpecting[] = ", expecting %s"; 1431 static char const yyor[] = " or %s"; 1432 char yyformat[sizeof yyunexpected 1433 + sizeof yyexpecting - 1 1434 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1435 * (sizeof yyor - 1))]; 1436 char const *yyprefix = yyexpecting; 1437 1438 /* Start YYX at -YYN if negative to avoid negative indexes in 1439 YYCHECK. */ 1440 int yyxbegin = yyn < 0 ? -yyn : 0; 1441 1442 /* Stay within bounds of both yycheck and yytname. */ 1443 int yychecklim = YYLAST - yyn; 1444 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1445 int yycount = 1; 1446 1447 yyarg[0] = yytname[yytype]; 1448 yyfmt = yystpcpy (yyformat, yyunexpected); 1449 1450 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1451 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 1452 { 1453 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1454 { 1455 yycount = 1; 1456 yysize = yysize0; 1457 yyformat[sizeof yyunexpected - 1] = '\0'; 1458 break; 1459 } 1460 yyarg[yycount++] = yytname[yyx]; 1461 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 1462 yysize_overflow |= yysize1 < yysize; 1463 yysize = yysize1; 1464 yyfmt = yystpcpy (yyfmt, yyprefix); 1465 yyprefix = yyor; 1466 } 1467 1468 yyf = YY_(yyformat); 1469 yysize1 = yysize + yystrlen (yyf); 1470 yysize_overflow |= yysize1 < yysize; 1471 yysize = yysize1; 1472 1473 if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) 1474 yymsg = (char *) YYSTACK_ALLOC (yysize); 1475 if (yymsg) 1476 { 1477 /* Avoid sprintf, as that infringes on the user's name space. 1478 Don't have undefined behavior even if the translation 1479 produced a string with the wrong number of "%s"s. */ 1480 char *yyp = yymsg; 1481 int yyi = 0; 1482 while ((*yyp = *yyf)) 1483 { 1484 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 1485 { 1486 yyp += yytnamerr (yyp, yyarg[yyi++]); 1487 yyf += 2; 1488 } 1489 else 1490 { 1491 yyp++; 1492 yyf++; 1493 } 1494 } 1495 yyerror (yymsg); 1496 YYSTACK_FREE (yymsg); 1497 } 1498 else 1499 { 1500 yyerror (YY_("syntax error")); 1501 goto yyexhaustedlab; 1502 } 1503 } 1504 else 1505#endif /* YYERROR_VERBOSE */ 1506 yyerror (YY_("syntax error")); 1507 } 1508 1509 1510 1511 if (yyerrstatus == 3) 1512 { 1513 /* If just tried and failed to reuse look-ahead token after an 1514 error, discard it. */ 1515 1516 if (yychar <= YYEOF) 1517 { 1518 /* Return failure if at end of input. */ 1519 if (yychar == YYEOF) 1520 YYABORT; 1521 } 1522 else 1523 { 1524 yydestruct ("Error: discarding", yytoken, &yylval); 1525 yychar = YYEMPTY; 1526 } 1527 } 1528 1529 /* Else will try to reuse look-ahead token after shifting the error 1530 token. */ 1531 goto yyerrlab1; 1532 1533 1534/*---------------------------------------------------. 1535| yyerrorlab -- error raised explicitly by YYERROR. | 1536`---------------------------------------------------*/ 1537yyerrorlab: 1538 1539 /* Pacify compilers like GCC when the user code never invokes 1540 YYERROR and the label yyerrorlab therefore never appears in user 1541 code. */ 1542 if (0) 1543 goto yyerrorlab; 1544 1545yyvsp -= yylen; 1546 yyssp -= yylen; 1547 yystate = *yyssp; 1548 goto yyerrlab1; 1549 1550 1551/*-------------------------------------------------------------. 1552| yyerrlab1 -- common code for both syntax error and YYERROR. | 1553`-------------------------------------------------------------*/ 1554yyerrlab1: 1555 yyerrstatus = 3; /* Each real token shifted decrements this. */ 1556 1557 for (;;) 1558 { 1559 yyn = yypact[yystate]; 1560 if (yyn != YYPACT_NINF) 1561 { 1562 yyn += YYTERROR; 1563 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1564 { 1565 yyn = yytable[yyn]; 1566 if (0 < yyn) 1567 break; 1568 } 1569 } 1570 1571 /* Pop the current state because it cannot handle the error token. */ 1572 if (yyssp == yyss) 1573 YYABORT; 1574 1575 1576 yydestruct ("Error: popping", yystos[yystate], yyvsp); 1577 YYPOPSTACK; 1578 yystate = *yyssp; 1579 YY_STACK_PRINT (yyss, yyssp); 1580 } 1581 1582 if (yyn == YYFINAL) 1583 YYACCEPT; 1584 1585 *++yyvsp = yylval; 1586 1587 1588 /* Shift the error token. */ 1589 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 1590 1591 yystate = yyn; 1592 goto yynewstate; 1593 1594 1595/*-------------------------------------. 1596| yyacceptlab -- YYACCEPT comes here. | 1597`-------------------------------------*/ 1598yyacceptlab: 1599 yyresult = 0; 1600 goto yyreturn; 1601 1602/*-----------------------------------. 1603| yyabortlab -- YYABORT comes here. | 1604`-----------------------------------*/ 1605yyabortlab: 1606 yyresult = 1; 1607 goto yyreturn; 1608 1609#ifndef yyoverflow 1610/*-------------------------------------------------. 1611| yyexhaustedlab -- memory exhaustion comes here. | 1612`-------------------------------------------------*/ 1613yyexhaustedlab: 1614 yyerror (YY_("memory exhausted")); 1615 yyresult = 2; 1616 /* Fall through. */ 1617#endif 1618 1619yyreturn: 1620 if (yychar != YYEOF && yychar != YYEMPTY) 1621 yydestruct ("Cleanup: discarding lookahead", 1622 yytoken, &yylval); 1623 while (yyssp != yyss) 1624 { 1625 yydestruct ("Cleanup: popping", 1626 yystos[*yyssp], yyvsp); 1627 YYPOPSTACK; 1628 } 1629#ifndef yyoverflow 1630 if (yyss != yyssa) 1631 YYSTACK_FREE (yyss); 1632#endif 1633 return yyresult; 1634} 1635 1636 1637#line 195 "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 1669 1670