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