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