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