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