|
Packit |
5c3484 |
/* A Bison parser, made by GNU Bison 2.7.12-4996. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Bison implementation for Yacc-like parsers in C
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This program is free software: you can redistribute it and/or modify
|
|
Packit |
5c3484 |
it under the terms of the GNU General Public License as published by
|
|
Packit |
5c3484 |
the Free Software Foundation, either version 3 of the License, or
|
|
Packit |
5c3484 |
(at your option) any later version.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This program is distributed in the hope that it will be useful,
|
|
Packit |
5c3484 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
5c3484 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
5c3484 |
GNU General Public License for more details.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
You should have received a copy of the GNU General Public License
|
|
Packit |
5c3484 |
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* As a special exception, you may create a larger work that contains
|
|
Packit |
5c3484 |
part or all of the Bison parser skeleton and distribute that work
|
|
Packit |
5c3484 |
under terms of your choice, so long as that work isn't itself a
|
|
Packit |
5c3484 |
parser generator using the skeleton or a modified version thereof
|
|
Packit |
5c3484 |
as a parser skeleton. Alternatively, if you modify or redistribute
|
|
Packit |
5c3484 |
the parser skeleton itself, you may (at your option) remove this
|
|
Packit |
5c3484 |
special exception, which will cause the skeleton and the resulting
|
|
Packit |
5c3484 |
Bison output files to be licensed under the GNU General Public
|
|
Packit |
5c3484 |
License without this special exception.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This special exception was added by the Free Software Foundation in
|
|
Packit |
5c3484 |
version 2.2 of Bison. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
|
Packit |
5c3484 |
simplifying the original so-called "semantic" parser. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* All symbols defined below should begin with yy or YY, to avoid
|
|
Packit |
5c3484 |
infringing on user name space. This should be done even for local
|
|
Packit |
5c3484 |
variables, as they might otherwise be expanded by user macros.
|
|
Packit |
5c3484 |
There are some unavoidable exceptions within include files to
|
|
Packit |
5c3484 |
define necessary library symbols; they are noted "INFRINGES ON
|
|
Packit |
5c3484 |
USER NAME SPACE" below. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Identify Bison output. */
|
|
Packit |
5c3484 |
#define YYBISON 1
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Bison version. */
|
|
Packit |
5c3484 |
#define YYBISON_VERSION "2.7.12-4996"
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Skeleton name. */
|
|
Packit |
5c3484 |
#define YYSKELETON_NAME "yacc.c"
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Pure parsers. */
|
|
Packit |
5c3484 |
#define YYPURE 0
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Push parsers. */
|
|
Packit |
5c3484 |
#define YYPUSH 0
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Pull parsers. */
|
|
Packit |
5c3484 |
#define YYPULL 1
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Copy the first part of user declarations. */
|
|
Packit |
5c3484 |
/* Line 371 of yacc.c */
|
|
Packit |
5c3484 |
#line 1 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* A simple integer desk calculator using yacc and gmp.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Copyright 2000-2002 Free Software Foundation, Inc.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This file is part of the GNU MP Library.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This program is free software; you can redistribute it and/or modify it under
|
|
Packit |
5c3484 |
the terms of the GNU General Public License as published by the Free Software
|
|
Packit |
5c3484 |
Foundation; either version 3 of the License, or (at your option) any later
|
|
Packit |
5c3484 |
version.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
Packit |
5c3484 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
Packit |
5c3484 |
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
You should have received a copy of the GNU General Public License along with
|
|
Packit |
5c3484 |
this program. If not, see https://www.gnu.org/licenses/. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* This is a simple program, meant only to show one way to use GMP for this
|
|
Packit |
5c3484 |
sort of thing. There's few features, and error checking is minimal.
|
|
Packit |
5c3484 |
Standard input is read, calc_help() below shows the inputs accepted.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Expressions are evaluated as they're read. If user defined functions
|
|
Packit |
5c3484 |
were wanted it'd be necessary to build a parse tree like pexpr.c does, or
|
|
Packit |
5c3484 |
a list of operations for a stack based evaluator. That would also make
|
|
Packit |
5c3484 |
it possible to detect and optimize evaluations "mod m" like pexpr.c does.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
A stack is used for intermediate values in the expression evaluation,
|
|
Packit |
5c3484 |
separate from the yacc parser stack. This is simple, makes error
|
|
Packit |
5c3484 |
recovery easy, minimizes the junk around mpz calls in the rules, and
|
|
Packit |
5c3484 |
saves initializing or clearing "mpz_t"s during a calculation. A
|
|
Packit |
5c3484 |
disadvantage though is that variables must be copied to the stack to be
|
|
Packit |
5c3484 |
worked on. A more sophisticated calculator or language system might be
|
|
Packit |
5c3484 |
able to avoid that when executing a compiled or semi-compiled form.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Avoiding repeated initializing and clearing of "mpz_t"s is important. In
|
|
Packit |
5c3484 |
this program the time spent parsing is obviously much greater than any
|
|
Packit |
5c3484 |
possible saving from this, but a proper calculator or language should
|
|
Packit |
5c3484 |
take some trouble over it. Don't be surprised if an init/clear takes 3
|
|
Packit |
5c3484 |
or more times as long as a 10 limb addition, depending on the system (see
|
|
Packit |
5c3484 |
the mpz_init_realloc_clear example in tune/README). */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#include <stdio.h>
|
|
Packit |
5c3484 |
#include <stdlib.h>
|
|
Packit |
5c3484 |
#include <string.h>
|
|
Packit |
5c3484 |
#include "gmp.h"
|
|
Packit |
5c3484 |
#define NO_CALC_H /* because it conflicts with normal calc.c stuff */
|
|
Packit |
5c3484 |
#include "calc-common.h"
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define numberof(x) (sizeof (x) / sizeof ((x)[0]))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
void
|
|
Packit |
5c3484 |
calc_help (void)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
printf ("Examples:\n");
|
|
Packit |
5c3484 |
printf (" 2+3*4 expressions are evaluated\n");
|
|
Packit |
5c3484 |
printf (" x=5^6 variables a to z can be set and used\n");
|
|
Packit |
5c3484 |
printf ("Operators:\n");
|
|
Packit |
5c3484 |
printf (" + - * arithmetic\n");
|
|
Packit |
5c3484 |
printf (" / %% division and remainder (rounding towards negative infinity)\n");
|
|
Packit |
5c3484 |
printf (" ^ exponentiation\n");
|
|
Packit |
5c3484 |
printf (" ! factorial\n");
|
|
Packit |
5c3484 |
printf (" << >> left and right shifts\n");
|
|
Packit |
5c3484 |
printf (" <= >= > \\ comparisons, giving 1 if true, 0 if false\n");
|
|
Packit |
5c3484 |
printf (" == != < /\n");
|
|
Packit |
5c3484 |
printf (" && || logical and/or, giving 1 if true, 0 if false\n");
|
|
Packit |
5c3484 |
printf ("Functions:\n");
|
|
Packit |
5c3484 |
printf (" abs(n) absolute value\n");
|
|
Packit |
5c3484 |
printf (" bin(n,m) binomial coefficient\n");
|
|
Packit |
5c3484 |
printf (" fib(n) fibonacci number\n");
|
|
Packit |
5c3484 |
printf (" gcd(a,b,..) greatest common divisor\n");
|
|
Packit |
5c3484 |
printf (" kron(a,b) kronecker symbol\n");
|
|
Packit |
5c3484 |
printf (" lcm(a,b,..) least common multiple\n");
|
|
Packit |
5c3484 |
printf (" lucnum(n) lucas number\n");
|
|
Packit |
5c3484 |
printf (" nextprime(n) next prime after n\n");
|
|
Packit |
5c3484 |
printf (" powm(b,e,m) modulo powering, b^e%%m\n");
|
|
Packit |
5c3484 |
printf (" root(n,r) r-th root\n");
|
|
Packit |
5c3484 |
printf (" sqrt(n) square root\n");
|
|
Packit |
5c3484 |
printf ("Other:\n");
|
|
Packit |
5c3484 |
printf (" hex \\ set hex or decimal for input and output\n");
|
|
Packit |
5c3484 |
printf (" decimal / (\"0x\" can be used for hex too)\n");
|
|
Packit |
5c3484 |
printf (" quit exit program (EOF works too)\n");
|
|
Packit |
5c3484 |
printf (" ; statements are separated with a ; or newline\n");
|
|
Packit |
5c3484 |
printf (" \\ continue expressions with \\ before newline\n");
|
|
Packit |
5c3484 |
printf (" # xxx comments are # though to newline\n");
|
|
Packit |
5c3484 |
printf ("Hex numbers must be entered in upper case, to distinguish them from the\n");
|
|
Packit |
5c3484 |
printf ("variables a to f (like in bc).\n");
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
int ibase = 0;
|
|
Packit |
5c3484 |
int obase = 10;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The stack is a fixed size, which means there's a limit on the nesting
|
|
Packit |
5c3484 |
allowed in expressions. A more sophisticated program could let it grow
|
|
Packit |
5c3484 |
dynamically. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
mpz_t stack[100];
|
|
Packit |
5c3484 |
mpz_ptr sp = stack[0];
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define CHECK_OVERFLOW() \
|
|
Packit |
5c3484 |
if (sp >= stack[numberof(stack)]) /* FIXME */ \
|
|
Packit |
5c3484 |
{ \
|
|
Packit |
5c3484 |
fprintf (stderr, \
|
|
Packit |
5c3484 |
"Value stack overflow, too much nesting in expression\n"); \
|
|
Packit |
5c3484 |
YYERROR; \
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define CHECK_EMPTY() \
|
|
Packit |
5c3484 |
if (sp != stack[0]) \
|
|
Packit |
5c3484 |
{ \
|
|
Packit |
5c3484 |
fprintf (stderr, "Oops, expected the value stack to be empty\n"); \
|
|
Packit |
5c3484 |
sp = stack[0]; \
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
mpz_t variable[26];
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define CHECK_VARIABLE(var) \
|
|
Packit |
5c3484 |
if ((var) < 0 || (var) >= numberof (variable)) \
|
|
Packit |
5c3484 |
{ \
|
|
Packit |
5c3484 |
fprintf (stderr, "Oops, bad variable somehow: %d\n", var); \
|
|
Packit |
5c3484 |
YYERROR; \
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define CHECK_UI(name,z) \
|
|
Packit |
5c3484 |
if (! mpz_fits_ulong_p (z)) \
|
|
Packit |
5c3484 |
{ \
|
|
Packit |
5c3484 |
fprintf (stderr, "%s too big\n", name); \
|
|
Packit |
5c3484 |
YYERROR; \
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Line 371 of yacc.c */
|
|
Packit |
5c3484 |
#line 209 "calc.c"
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# ifndef YY_NULL
|
|
Packit |
5c3484 |
# if defined __cplusplus && 201103L <= __cplusplus
|
|
Packit |
5c3484 |
# define YY_NULL nullptr
|
|
Packit |
5c3484 |
# else
|
|
Packit |
5c3484 |
# define YY_NULL 0
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Enabling verbose error messages. */
|
|
Packit |
5c3484 |
#ifdef YYERROR_VERBOSE
|
|
Packit |
5c3484 |
# undef YYERROR_VERBOSE
|
|
Packit |
5c3484 |
# define YYERROR_VERBOSE 1
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
# define YYERROR_VERBOSE 0
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* In a future release of Bison, this section will be replaced
|
|
Packit |
5c3484 |
by #include "y.tab.h". */
|
|
Packit |
5c3484 |
#ifndef YY_YY_CALC_H_INCLUDED
|
|
Packit |
5c3484 |
# define YY_YY_CALC_H_INCLUDED
|
|
Packit |
5c3484 |
/* Enabling traces. */
|
|
Packit |
5c3484 |
#ifndef YYDEBUG
|
|
Packit |
5c3484 |
# define YYDEBUG 0
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
#if YYDEBUG
|
|
Packit |
5c3484 |
extern int yydebug;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Tokens. */
|
|
Packit |
5c3484 |
#ifndef YYTOKENTYPE
|
|
Packit |
5c3484 |
# define YYTOKENTYPE
|
|
Packit |
5c3484 |
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
|
Packit |
5c3484 |
know about them. */
|
|
Packit |
5c3484 |
enum yytokentype {
|
|
Packit |
5c3484 |
EOS = 258,
|
|
Packit |
5c3484 |
BAD = 259,
|
|
Packit |
5c3484 |
HELP = 260,
|
|
Packit |
5c3484 |
HEX = 261,
|
|
Packit |
5c3484 |
DECIMAL = 262,
|
|
Packit |
5c3484 |
QUIT = 263,
|
|
Packit |
5c3484 |
ABS = 264,
|
|
Packit |
5c3484 |
BIN = 265,
|
|
Packit |
5c3484 |
FIB = 266,
|
|
Packit |
5c3484 |
GCD = 267,
|
|
Packit |
5c3484 |
KRON = 268,
|
|
Packit |
5c3484 |
LCM = 269,
|
|
Packit |
5c3484 |
LUCNUM = 270,
|
|
Packit |
5c3484 |
NEXTPRIME = 271,
|
|
Packit |
5c3484 |
POWM = 272,
|
|
Packit |
5c3484 |
ROOT = 273,
|
|
Packit |
5c3484 |
SQRT = 274,
|
|
Packit |
5c3484 |
NUMBER = 275,
|
|
Packit |
5c3484 |
VARIABLE = 276,
|
|
Packit |
5c3484 |
LOR = 277,
|
|
Packit |
5c3484 |
LAND = 278,
|
|
Packit |
5c3484 |
GE = 279,
|
|
Packit |
5c3484 |
LE = 280,
|
|
Packit |
5c3484 |
NE = 281,
|
|
Packit |
5c3484 |
EQ = 282,
|
|
Packit |
5c3484 |
RSHIFT = 283,
|
|
Packit |
5c3484 |
LSHIFT = 284,
|
|
Packit |
5c3484 |
UMINUS = 285
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
/* Tokens. */
|
|
Packit |
5c3484 |
#define EOS 258
|
|
Packit |
5c3484 |
#define BAD 259
|
|
Packit |
5c3484 |
#define HELP 260
|
|
Packit |
5c3484 |
#define HEX 261
|
|
Packit |
5c3484 |
#define DECIMAL 262
|
|
Packit |
5c3484 |
#define QUIT 263
|
|
Packit |
5c3484 |
#define ABS 264
|
|
Packit |
5c3484 |
#define BIN 265
|
|
Packit |
5c3484 |
#define FIB 266
|
|
Packit |
5c3484 |
#define GCD 267
|
|
Packit |
5c3484 |
#define KRON 268
|
|
Packit |
5c3484 |
#define LCM 269
|
|
Packit |
5c3484 |
#define LUCNUM 270
|
|
Packit |
5c3484 |
#define NEXTPRIME 271
|
|
Packit |
5c3484 |
#define POWM 272
|
|
Packit |
5c3484 |
#define ROOT 273
|
|
Packit |
5c3484 |
#define SQRT 274
|
|
Packit |
5c3484 |
#define NUMBER 275
|
|
Packit |
5c3484 |
#define VARIABLE 276
|
|
Packit |
5c3484 |
#define LOR 277
|
|
Packit |
5c3484 |
#define LAND 278
|
|
Packit |
5c3484 |
#define GE 279
|
|
Packit |
5c3484 |
#define LE 280
|
|
Packit |
5c3484 |
#define NE 281
|
|
Packit |
5c3484 |
#define EQ 282
|
|
Packit |
5c3484 |
#define RSHIFT 283
|
|
Packit |
5c3484 |
#define LSHIFT 284
|
|
Packit |
5c3484 |
#define UMINUS 285
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
|
Packit |
5c3484 |
typedef union YYSTYPE
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
/* Line 387 of yacc.c */
|
|
Packit |
5c3484 |
#line 142 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
char *str;
|
|
Packit |
5c3484 |
int var;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Line 387 of yacc.c */
|
|
Packit |
5c3484 |
#line 318 "calc.c"
|
|
Packit |
5c3484 |
} YYSTYPE;
|
|
Packit |
5c3484 |
# define YYSTYPE_IS_TRIVIAL 1
|
|
Packit |
5c3484 |
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
|
Packit |
5c3484 |
# define YYSTYPE_IS_DECLARED 1
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
extern YYSTYPE yylval;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifdef YYPARSE_PARAM
|
|
Packit |
5c3484 |
#if defined __STDC__ || defined __cplusplus
|
|
Packit |
5c3484 |
int yyparse (void *YYPARSE_PARAM);
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
int yyparse ();
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
#else /* ! YYPARSE_PARAM */
|
|
Packit |
5c3484 |
#if defined __STDC__ || defined __cplusplus
|
|
Packit |
5c3484 |
int yyparse (void);
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
int yyparse ();
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
#endif /* ! YYPARSE_PARAM */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#endif /* !YY_YY_CALC_H_INCLUDED */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Copy the second part of user declarations. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Line 390 of yacc.c */
|
|
Packit |
5c3484 |
#line 346 "calc.c"
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifdef short
|
|
Packit |
5c3484 |
# undef short
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifdef YYTYPE_UINT8
|
|
Packit |
5c3484 |
typedef YYTYPE_UINT8 yytype_uint8;
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
typedef unsigned char yytype_uint8;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifdef YYTYPE_INT8
|
|
Packit |
5c3484 |
typedef YYTYPE_INT8 yytype_int8;
|
|
Packit |
5c3484 |
#elif (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
typedef signed char yytype_int8;
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
typedef short int yytype_int8;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifdef YYTYPE_UINT16
|
|
Packit |
5c3484 |
typedef YYTYPE_UINT16 yytype_uint16;
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
typedef unsigned short int yytype_uint16;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifdef YYTYPE_INT16
|
|
Packit |
5c3484 |
typedef YYTYPE_INT16 yytype_int16;
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
typedef short int yytype_int16;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifndef YYSIZE_T
|
|
Packit |
5c3484 |
# ifdef __SIZE_TYPE__
|
|
Packit |
5c3484 |
# define YYSIZE_T __SIZE_TYPE__
|
|
Packit |
5c3484 |
# elif defined size_t
|
|
Packit |
5c3484 |
# define YYSIZE_T size_t
|
|
Packit |
5c3484 |
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
|
Packit |
5c3484 |
# define YYSIZE_T size_t
|
|
Packit |
5c3484 |
# else
|
|
Packit |
5c3484 |
# define YYSIZE_T unsigned int
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifndef YY_
|
|
Packit |
5c3484 |
# if defined YYENABLE_NLS && YYENABLE_NLS
|
|
Packit |
5c3484 |
# if ENABLE_NLS
|
|
Packit |
5c3484 |
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
|
Packit |
5c3484 |
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# ifndef YY_
|
|
Packit |
5c3484 |
# define YY_(Msgid) Msgid
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifndef __attribute__
|
|
Packit |
5c3484 |
/* This feature is available in gcc versions 2.5 and later. */
|
|
Packit |
5c3484 |
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
|
Packit |
5c3484 |
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
|
Packit |
5c3484 |
# define __attribute__(Spec) /* empty */
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Suppress unused-variable warnings by "using" E. */
|
|
Packit |
5c3484 |
#if ! defined lint || defined __GNUC__
|
|
Packit |
5c3484 |
# define YYUSE(E) ((void) (E))
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
# define YYUSE(E) /* empty */
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Identity function, used to suppress warnings about constant conditions. */
|
|
Packit |
5c3484 |
#ifndef lint
|
|
Packit |
5c3484 |
# define YYID(N) (N)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
static int
|
|
Packit |
5c3484 |
YYID (int yyi)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
static int
|
|
Packit |
5c3484 |
YYID (yyi)
|
|
Packit |
5c3484 |
int yyi;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
return yyi;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if ! defined yyoverflow || YYERROR_VERBOSE
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The parser invokes alloca or malloc; define the necessary symbols. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# ifdef YYSTACK_USE_ALLOCA
|
|
Packit |
5c3484 |
# if YYSTACK_USE_ALLOCA
|
|
Packit |
5c3484 |
# ifdef __GNUC__
|
|
Packit |
5c3484 |
# define YYSTACK_ALLOC __builtin_alloca
|
|
Packit |
5c3484 |
# elif defined __BUILTIN_VA_ARG_INCR
|
|
Packit |
5c3484 |
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
|
|
Packit |
5c3484 |
# elif defined _AIX
|
|
Packit |
5c3484 |
# define YYSTACK_ALLOC __alloca
|
|
Packit |
5c3484 |
# elif defined _MSC_VER
|
|
Packit |
5c3484 |
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
|
|
Packit |
5c3484 |
# define alloca _alloca
|
|
Packit |
5c3484 |
# else
|
|
Packit |
5c3484 |
# define YYSTACK_ALLOC alloca
|
|
Packit |
5c3484 |
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
|
Packit |
5c3484 |
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
|
|
Packit |
5c3484 |
# ifndef EXIT_SUCCESS
|
|
Packit |
5c3484 |
# define EXIT_SUCCESS 0
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# ifdef YYSTACK_ALLOC
|
|
Packit |
5c3484 |
/* Pacify GCC's `empty if-body' warning. */
|
|
Packit |
5c3484 |
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
|
|
Packit |
5c3484 |
# ifndef YYSTACK_ALLOC_MAXIMUM
|
|
Packit |
5c3484 |
/* The OS might guarantee only one guard page at the bottom of the stack,
|
|
Packit |
5c3484 |
and a page size can be as small as 4096 bytes. So we cannot safely
|
|
Packit |
5c3484 |
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
|
|
Packit |
5c3484 |
to allow for a few compiler-allocated temporary stack slots. */
|
|
Packit |
5c3484 |
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# else
|
|
Packit |
5c3484 |
# define YYSTACK_ALLOC YYMALLOC
|
|
Packit |
5c3484 |
# define YYSTACK_FREE YYFREE
|
|
Packit |
5c3484 |
# ifndef YYSTACK_ALLOC_MAXIMUM
|
|
Packit |
5c3484 |
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
|
|
Packit |
5c3484 |
&& ! ((defined YYMALLOC || defined malloc) \
|
|
Packit |
5c3484 |
&& (defined YYFREE || defined free)))
|
|
Packit |
5c3484 |
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
|
Packit |
5c3484 |
# ifndef EXIT_SUCCESS
|
|
Packit |
5c3484 |
# define EXIT_SUCCESS 0
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# ifndef YYMALLOC
|
|
Packit |
5c3484 |
# define YYMALLOC malloc
|
|
Packit |
5c3484 |
# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# ifndef YYFREE
|
|
Packit |
5c3484 |
# define YYFREE free
|
|
Packit |
5c3484 |
# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if (! defined yyoverflow \
|
|
Packit |
5c3484 |
&& (! defined __cplusplus \
|
|
Packit |
5c3484 |
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* A type that is properly aligned for any stack member. */
|
|
Packit |
5c3484 |
union yyalloc
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yytype_int16 yyss_alloc;
|
|
Packit |
5c3484 |
YYSTYPE yyvs_alloc;
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The size of the maximum gap between one aligned stack and the next. */
|
|
Packit |
5c3484 |
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The size of an array large to enough to hold all stacks, each with
|
|
Packit |
5c3484 |
N elements. */
|
|
Packit |
5c3484 |
# define YYSTACK_BYTES(N) \
|
|
Packit |
5c3484 |
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
|
|
Packit |
5c3484 |
+ YYSTACK_GAP_MAXIMUM)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# define YYCOPY_NEEDED 1
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Relocate STACK from its old location to the new one. The
|
|
Packit |
5c3484 |
local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
|
Packit |
5c3484 |
elements in the stack, and YYPTR gives the new location of the
|
|
Packit |
5c3484 |
stack. Advance YYPTR to a properly aligned location for the next
|
|
Packit |
5c3484 |
stack. */
|
|
Packit |
5c3484 |
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
|
|
Packit |
5c3484 |
do \
|
|
Packit |
5c3484 |
{ \
|
|
Packit |
5c3484 |
YYSIZE_T yynewbytes; \
|
|
Packit |
5c3484 |
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
|
|
Packit |
5c3484 |
Stack = &yyptr->Stack_alloc; \
|
|
Packit |
5c3484 |
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
|
Packit |
5c3484 |
yyptr += yynewbytes / sizeof (*yyptr); \
|
|
Packit |
5c3484 |
} \
|
|
Packit |
5c3484 |
while (YYID (0))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
|
|
Packit |
5c3484 |
/* Copy COUNT objects from SRC to DST. The source and destination do
|
|
Packit |
5c3484 |
not overlap. */
|
|
Packit |
5c3484 |
# ifndef YYCOPY
|
|
Packit |
5c3484 |
# if defined __GNUC__ && 1 < __GNUC__
|
|
Packit |
5c3484 |
# define YYCOPY(Dst, Src, Count) \
|
|
Packit |
5c3484 |
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
|
|
Packit |
5c3484 |
# else
|
|
Packit |
5c3484 |
# define YYCOPY(Dst, Src, Count) \
|
|
Packit |
5c3484 |
do \
|
|
Packit |
5c3484 |
{ \
|
|
Packit |
5c3484 |
YYSIZE_T yyi; \
|
|
Packit |
5c3484 |
for (yyi = 0; yyi < (Count); yyi++) \
|
|
Packit |
5c3484 |
(Dst)[yyi] = (Src)[yyi]; \
|
|
Packit |
5c3484 |
} \
|
|
Packit |
5c3484 |
while (YYID (0))
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
#endif /* !YYCOPY_NEEDED */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYFINAL -- State number of the termination state. */
|
|
Packit |
5c3484 |
#define YYFINAL 41
|
|
Packit |
5c3484 |
/* YYLAST -- Last index in YYTABLE. */
|
|
Packit |
5c3484 |
#define YYLAST 552
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYNTOKENS -- Number of terminals. */
|
|
Packit |
5c3484 |
#define YYNTOKENS 44
|
|
Packit |
5c3484 |
/* YYNNTS -- Number of nonterminals. */
|
|
Packit |
5c3484 |
#define YYNNTS 7
|
|
Packit |
5c3484 |
/* YYNRULES -- Number of rules. */
|
|
Packit |
5c3484 |
#define YYNRULES 49
|
|
Packit |
5c3484 |
/* YYNRULES -- Number of states. */
|
|
Packit |
5c3484 |
#define YYNSTATES 118
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
|
Packit |
5c3484 |
#define YYUNDEFTOK 2
|
|
Packit |
5c3484 |
#define YYMAXUTOK 285
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define YYTRANSLATE(YYX) \
|
|
Packit |
5c3484 |
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
|
Packit |
5c3484 |
static const yytype_uint8 yytranslate[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 39, 2, 2, 2, 36, 2, 2,
|
|
Packit |
5c3484 |
41, 42, 34, 32, 43, 33, 2, 35, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
24, 40, 25, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 38, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
Packit |
5c3484 |
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
|
|
Packit |
5c3484 |
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
Packit |
5c3484 |
15, 16, 17, 18, 19, 20, 21, 22, 23, 26,
|
|
Packit |
5c3484 |
27, 28, 29, 30, 31, 37
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if YYDEBUG
|
|
Packit |
5c3484 |
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
|
Packit |
5c3484 |
YYRHS. */
|
|
Packit |
5c3484 |
static const yytype_uint8 yyprhs[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
0, 0, 3, 5, 8, 11, 15, 18, 19, 21,
|
|
Packit |
5c3484 |
25, 27, 29, 31, 33, 37, 41, 45, 49, 53,
|
|
Packit |
5c3484 |
57, 61, 65, 69, 72, 75, 79, 83, 87, 91,
|
|
Packit |
5c3484 |
95, 99, 103, 107, 112, 119, 124, 129, 136, 141,
|
|
Packit |
5c3484 |
146, 151, 160, 167, 172, 174, 176, 178, 182, 184
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
|
Packit |
5c3484 |
static const yytype_int8 yyrhs[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
45, 0, -1, 47, -1, 46, 47, -1, 47, 3,
|
|
Packit |
5c3484 |
-1, 46, 47, 3, -1, 1, 3, -1, -1, 48,
|
|
Packit |
5c3484 |
-1, 21, 40, 48, -1, 5, -1, 6, -1, 7,
|
|
Packit |
5c3484 |
-1, 8, -1, 41, 48, 42, -1, 48, 32, 48,
|
|
Packit |
5c3484 |
-1, 48, 33, 48, -1, 48, 34, 48, -1, 48,
|
|
Packit |
5c3484 |
35, 48, -1, 48, 36, 48, -1, 48, 38, 48,
|
|
Packit |
5c3484 |
-1, 48, 31, 48, -1, 48, 30, 48, -1, 48,
|
|
Packit |
5c3484 |
39, -1, 33, 48, -1, 48, 24, 48, -1, 48,
|
|
Packit |
5c3484 |
27, 48, -1, 48, 29, 48, -1, 48, 28, 48,
|
|
Packit |
5c3484 |
-1, 48, 26, 48, -1, 48, 25, 48, -1, 48,
|
|
Packit |
5c3484 |
23, 48, -1, 48, 22, 48, -1, 9, 41, 48,
|
|
Packit |
5c3484 |
42, -1, 10, 41, 48, 43, 48, 42, -1, 11,
|
|
Packit |
5c3484 |
41, 48, 42, -1, 12, 41, 49, 42, -1, 13,
|
|
Packit |
5c3484 |
41, 48, 43, 48, 42, -1, 14, 41, 50, 42,
|
|
Packit |
5c3484 |
-1, 15, 41, 48, 42, -1, 16, 41, 48, 42,
|
|
Packit |
5c3484 |
-1, 17, 41, 48, 43, 48, 43, 48, 42, -1,
|
|
Packit |
5c3484 |
18, 41, 48, 43, 48, 42, -1, 19, 41, 48,
|
|
Packit |
5c3484 |
42, -1, 21, -1, 20, -1, 48, -1, 49, 43,
|
|
Packit |
5c3484 |
48, -1, 48, -1, 50, 43, 48, -1
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
|
Packit |
5c3484 |
static const yytype_uint16 yyrline[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
0, 167, 167, 168, 171, 172, 173, 175, 177, 182,
|
|
Packit |
5c3484 |
188, 189, 190, 191, 197, 198, 199, 200, 201, 202,
|
|
Packit |
5c3484 |
203, 205, 207, 209, 211, 213, 214, 215, 216, 217,
|
|
Packit |
5c3484 |
218, 220, 221, 223, 224, 226, 228, 229, 231, 232,
|
|
Packit |
5c3484 |
234, 235, 236, 238, 240, 246, 257, 258, 261, 262
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if YYDEBUG || YYERROR_VERBOSE || 0
|
|
Packit |
5c3484 |
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
|
Packit |
5c3484 |
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
|
Packit |
5c3484 |
static const char *const yytname[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
"$end", "error", "$undefined", "EOS", "BAD", "HELP", "HEX", "DECIMAL",
|
|
Packit |
5c3484 |
"QUIT", "ABS", "BIN", "FIB", "GCD", "KRON", "LCM", "LUCNUM", "NEXTPRIME",
|
|
Packit |
5c3484 |
"POWM", "ROOT", "SQRT", "NUMBER", "VARIABLE", "LOR", "LAND", "'<'",
|
|
Packit |
5c3484 |
"'>'", "GE", "LE", "NE", "EQ", "RSHIFT", "LSHIFT", "'+'", "'-'", "'*'",
|
|
Packit |
5c3484 |
"'/'", "'%'", "UMINUS", "'^'", "'!'", "'='", "'('", "')'", "','",
|
|
Packit |
5c3484 |
"$accept", "top", "statements", "statement", "e", "gcdlist", "lcmlist", YY_NULL
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# ifdef YYPRINT
|
|
Packit |
5c3484 |
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
|
|
Packit |
5c3484 |
token YYLEX-NUM. */
|
|
Packit |
5c3484 |
static const yytype_uint16 yytoknum[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
|
|
Packit |
5c3484 |
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
|
|
Packit |
5c3484 |
275, 276, 277, 278, 60, 62, 279, 280, 281, 282,
|
|
Packit |
5c3484 |
283, 284, 43, 45, 42, 47, 37, 285, 94, 33,
|
|
Packit |
5c3484 |
61, 40, 41, 44
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
|
Packit |
5c3484 |
static const yytype_uint8 yyr1[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
0, 44, 45, 45, 46, 46, 46, 47, 47, 47,
|
|
Packit |
5c3484 |
47, 47, 47, 47, 48, 48, 48, 48, 48, 48,
|
|
Packit |
5c3484 |
48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
|
Packit |
5c3484 |
48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
|
Packit |
5c3484 |
48, 48, 48, 48, 48, 48, 49, 49, 50, 50
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
|
Packit |
5c3484 |
static const yytype_uint8 yyr2[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
0, 2, 1, 2, 2, 3, 2, 0, 1, 3,
|
|
Packit |
5c3484 |
1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
|
|
Packit |
5c3484 |
3, 3, 3, 2, 2, 3, 3, 3, 3, 3,
|
|
Packit |
5c3484 |
3, 3, 3, 4, 6, 4, 4, 6, 4, 4,
|
|
Packit |
5c3484 |
4, 8, 6, 4, 1, 1, 1, 3, 1, 3
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
|
|
Packit |
5c3484 |
Performed when YYTABLE doesn't specify something else to do. Zero
|
|
Packit |
5c3484 |
means the default is an error. */
|
|
Packit |
5c3484 |
static const yytype_uint8 yydefact[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
0, 0, 10, 11, 12, 13, 0, 0, 0, 0,
|
|
Packit |
5c3484 |
0, 0, 0, 0, 0, 0, 0, 45, 44, 0,
|
|
Packit |
5c3484 |
0, 0, 7, 2, 8, 6, 0, 0, 0, 0,
|
|
Packit |
5c3484 |
0, 0, 0, 0, 0, 0, 0, 0, 44, 24,
|
|
Packit |
5c3484 |
0, 1, 3, 4, 0, 0, 0, 0, 0, 0,
|
|
Packit |
5c3484 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
Packit |
5c3484 |
23, 0, 0, 0, 46, 0, 0, 48, 0, 0,
|
|
Packit |
5c3484 |
0, 0, 0, 0, 9, 14, 5, 32, 31, 25,
|
|
Packit |
5c3484 |
30, 29, 26, 28, 27, 22, 21, 15, 16, 17,
|
|
Packit |
5c3484 |
18, 19, 20, 33, 0, 35, 36, 0, 0, 38,
|
|
Packit |
5c3484 |
0, 39, 40, 0, 0, 43, 0, 47, 0, 49,
|
|
Packit |
5c3484 |
0, 0, 34, 37, 0, 42, 0, 41
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYDEFGOTO[NTERM-NUM]. */
|
|
Packit |
5c3484 |
static const yytype_int8 yydefgoto[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
-1, 21, 22, 23, 24, 65, 68
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
|
Packit |
5c3484 |
STATE-NUM. */
|
|
Packit |
5c3484 |
#define YYPACT_NINF -39
|
|
Packit |
5c3484 |
static const yytype_int16 yypact[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
41, 3, -39, -39, -39, -39, 2, 4, 27, 32,
|
|
Packit |
5c3484 |
35, 36, 39, 42, 45, 46, 47, -39, -18, 124,
|
|
Packit |
5c3484 |
124, 89, 91, 87, 464, -39, 124, 124, 124, 124,
|
|
Packit |
5c3484 |
124, 124, 124, 124, 124, 124, 124, 124, -39, -36,
|
|
Packit |
5c3484 |
254, -39, 88, -39, 124, 124, 124, 124, 124, 124,
|
|
Packit |
5c3484 |
124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
|
|
Packit |
5c3484 |
-39, 275, 144, 296, 464, -38, 166, 464, 29, 317,
|
|
Packit |
5c3484 |
338, 188, 210, 359, 464, -39, -39, 481, 497, 513,
|
|
Packit |
5c3484 |
513, 513, 513, 513, 513, 31, 31, -15, -15, -36,
|
|
Packit |
5c3484 |
-36, -36, -36, -39, 124, -39, -39, 124, 124, -39,
|
|
Packit |
5c3484 |
124, -39, -39, 124, 124, -39, 380, 464, 401, 464,
|
|
Packit |
5c3484 |
232, 422, -39, -39, 124, -39, 443, -39
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYPGOTO[NTERM-NUM]. */
|
|
Packit |
5c3484 |
static const yytype_int8 yypgoto[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
-39, -39, -39, 70, -19, -39, -39
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
|
Packit |
5c3484 |
positive, shift that token. If negative, reduce the rule which
|
|
Packit |
5c3484 |
number is the opposite. If YYTABLE_NINF, syntax error. */
|
|
Packit |
5c3484 |
#define YYTABLE_NINF -8
|
|
Packit |
5c3484 |
static const yytype_int8 yytable[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
39, 40, 59, 60, 96, 97, 25, 61, 62, 63,
|
|
Packit |
5c3484 |
64, 66, 67, 69, 70, 71, 72, 73, 74, 56,
|
|
Packit |
5c3484 |
57, 58, 37, 59, 60, 77, 78, 79, 80, 81,
|
|
Packit |
5c3484 |
82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
|
|
Packit |
5c3484 |
92, -7, 1, 26, -7, 27, 2, 3, 4, 5,
|
|
Packit |
5c3484 |
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
|
Packit |
5c3484 |
16, 17, 18, 54, 55, 56, 57, 58, 28, 59,
|
|
Packit |
5c3484 |
60, 99, 100, 29, 19, 106, 30, 31, 107, 108,
|
|
Packit |
5c3484 |
32, 109, 20, 33, 110, 111, 34, 35, 36, 41,
|
|
Packit |
5c3484 |
43, 76, 42, 0, 0, 116, 2, 3, 4, 5,
|
|
Packit |
5c3484 |
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
|
Packit |
5c3484 |
16, 17, 18, 0, 0, 0, 0, 0, 0, 0,
|
|
Packit |
5c3484 |
0, 0, 0, 0, 19, 0, 0, 0, 0, 0,
|
|
Packit |
5c3484 |
0, 0, 20, 6, 7, 8, 9, 10, 11, 12,
|
|
Packit |
5c3484 |
13, 14, 15, 16, 17, 38, 0, 0, 0, 0,
|
|
Packit |
5c3484 |
0, 0, 0, 0, 0, 0, 0, 19, 0, 0,
|
|
Packit |
5c3484 |
0, 0, 0, 0, 0, 20, 44, 45, 46, 47,
|
|
Packit |
5c3484 |
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
|
|
Packit |
5c3484 |
58, 0, 59, 60, 0, 0, 0, 94, 44, 45,
|
|
Packit |
5c3484 |
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
|
|
Packit |
5c3484 |
56, 57, 58, 0, 59, 60, 0, 0, 0, 98,
|
|
Packit |
5c3484 |
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
|
|
Packit |
5c3484 |
54, 55, 56, 57, 58, 0, 59, 60, 0, 0,
|
|
Packit |
5c3484 |
0, 103, 44, 45, 46, 47, 48, 49, 50, 51,
|
|
Packit |
5c3484 |
52, 53, 54, 55, 56, 57, 58, 0, 59, 60,
|
|
Packit |
5c3484 |
0, 0, 0, 104, 44, 45, 46, 47, 48, 49,
|
|
Packit |
5c3484 |
50, 51, 52, 53, 54, 55, 56, 57, 58, 0,
|
|
Packit |
5c3484 |
59, 60, 0, 0, 0, 114, 44, 45, 46, 47,
|
|
Packit |
5c3484 |
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
|
|
Packit |
5c3484 |
58, 0, 59, 60, 0, 0, 75, 44, 45, 46,
|
|
Packit |
5c3484 |
47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
|
|
Packit |
5c3484 |
57, 58, 0, 59, 60, 0, 0, 93, 44, 45,
|
|
Packit |
5c3484 |
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
|
|
Packit |
5c3484 |
56, 57, 58, 0, 59, 60, 0, 0, 95, 44,
|
|
Packit |
5c3484 |
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
|
|
Packit |
5c3484 |
55, 56, 57, 58, 0, 59, 60, 0, 0, 101,
|
|
Packit |
5c3484 |
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
|
|
Packit |
5c3484 |
54, 55, 56, 57, 58, 0, 59, 60, 0, 0,
|
|
Packit |
5c3484 |
102, 44, 45, 46, 47, 48, 49, 50, 51, 52,
|
|
Packit |
5c3484 |
53, 54, 55, 56, 57, 58, 0, 59, 60, 0,
|
|
Packit |
5c3484 |
0, 105, 44, 45, 46, 47, 48, 49, 50, 51,
|
|
Packit |
5c3484 |
52, 53, 54, 55, 56, 57, 58, 0, 59, 60,
|
|
Packit |
5c3484 |
0, 0, 112, 44, 45, 46, 47, 48, 49, 50,
|
|
Packit |
5c3484 |
51, 52, 53, 54, 55, 56, 57, 58, 0, 59,
|
|
Packit |
5c3484 |
60, 0, 0, 113, 44, 45, 46, 47, 48, 49,
|
|
Packit |
5c3484 |
50, 51, 52, 53, 54, 55, 56, 57, 58, 0,
|
|
Packit |
5c3484 |
59, 60, 0, 0, 115, 44, 45, 46, 47, 48,
|
|
Packit |
5c3484 |
49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
|
Packit |
5c3484 |
0, 59, 60, 0, 0, 117, 44, 45, 46, 47,
|
|
Packit |
5c3484 |
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
|
|
Packit |
5c3484 |
58, 0, 59, 60, 45, 46, 47, 48, 49, 50,
|
|
Packit |
5c3484 |
51, 52, 53, 54, 55, 56, 57, 58, 0, 59,
|
|
Packit |
5c3484 |
60, 46, 47, 48, 49, 50, 51, 52, 53, 54,
|
|
Packit |
5c3484 |
55, 56, 57, 58, 0, 59, 60, -8, -8, -8,
|
|
Packit |
5c3484 |
-8, -8, -8, 52, 53, 54, 55, 56, 57, 58,
|
|
Packit |
5c3484 |
0, 59, 60
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define yypact_value_is_default(Yystate) \
|
|
Packit |
5c3484 |
(!!((Yystate) == (-39)))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define yytable_value_is_error(Yytable_value) \
|
|
Packit |
5c3484 |
(!!((Yytable_value) == (-8)))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
static const yytype_int8 yycheck[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
19, 20, 38, 39, 42, 43, 3, 26, 27, 28,
|
|
Packit |
5c3484 |
29, 30, 31, 32, 33, 34, 35, 36, 37, 34,
|
|
Packit |
5c3484 |
35, 36, 40, 38, 39, 44, 45, 46, 47, 48,
|
|
Packit |
5c3484 |
49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
|
Packit |
5c3484 |
59, 0, 1, 41, 3, 41, 5, 6, 7, 8,
|
|
Packit |
5c3484 |
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
|
Packit |
5c3484 |
19, 20, 21, 32, 33, 34, 35, 36, 41, 38,
|
|
Packit |
5c3484 |
39, 42, 43, 41, 33, 94, 41, 41, 97, 98,
|
|
Packit |
5c3484 |
41, 100, 41, 41, 103, 104, 41, 41, 41, 0,
|
|
Packit |
5c3484 |
3, 3, 22, -1, -1, 114, 5, 6, 7, 8,
|
|
Packit |
5c3484 |
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
|
Packit |
5c3484 |
19, 20, 21, -1, -1, -1, -1, -1, -1, -1,
|
|
Packit |
5c3484 |
-1, -1, -1, -1, 33, -1, -1, -1, -1, -1,
|
|
Packit |
5c3484 |
-1, -1, 41, 9, 10, 11, 12, 13, 14, 15,
|
|
Packit |
5c3484 |
16, 17, 18, 19, 20, 21, -1, -1, -1, -1,
|
|
Packit |
5c3484 |
-1, -1, -1, -1, -1, -1, -1, 33, -1, -1,
|
|
Packit |
5c3484 |
-1, -1, -1, -1, -1, 41, 22, 23, 24, 25,
|
|
Packit |
5c3484 |
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
|
Packit |
5c3484 |
36, -1, 38, 39, -1, -1, -1, 43, 22, 23,
|
|
Packit |
5c3484 |
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
|
|
Packit |
5c3484 |
34, 35, 36, -1, 38, 39, -1, -1, -1, 43,
|
|
Packit |
5c3484 |
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
|
Packit |
5c3484 |
32, 33, 34, 35, 36, -1, 38, 39, -1, -1,
|
|
Packit |
5c3484 |
-1, 43, 22, 23, 24, 25, 26, 27, 28, 29,
|
|
Packit |
5c3484 |
30, 31, 32, 33, 34, 35, 36, -1, 38, 39,
|
|
Packit |
5c3484 |
-1, -1, -1, 43, 22, 23, 24, 25, 26, 27,
|
|
Packit |
5c3484 |
28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
|
|
Packit |
5c3484 |
38, 39, -1, -1, -1, 43, 22, 23, 24, 25,
|
|
Packit |
5c3484 |
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
|
Packit |
5c3484 |
36, -1, 38, 39, -1, -1, 42, 22, 23, 24,
|
|
Packit |
5c3484 |
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
|
Packit |
5c3484 |
35, 36, -1, 38, 39, -1, -1, 42, 22, 23,
|
|
Packit |
5c3484 |
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
|
|
Packit |
5c3484 |
34, 35, 36, -1, 38, 39, -1, -1, 42, 22,
|
|
Packit |
5c3484 |
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
|
Packit |
5c3484 |
33, 34, 35, 36, -1, 38, 39, -1, -1, 42,
|
|
Packit |
5c3484 |
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
|
Packit |
5c3484 |
32, 33, 34, 35, 36, -1, 38, 39, -1, -1,
|
|
Packit |
5c3484 |
42, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
|
Packit |
5c3484 |
31, 32, 33, 34, 35, 36, -1, 38, 39, -1,
|
|
Packit |
5c3484 |
-1, 42, 22, 23, 24, 25, 26, 27, 28, 29,
|
|
Packit |
5c3484 |
30, 31, 32, 33, 34, 35, 36, -1, 38, 39,
|
|
Packit |
5c3484 |
-1, -1, 42, 22, 23, 24, 25, 26, 27, 28,
|
|
Packit |
5c3484 |
29, 30, 31, 32, 33, 34, 35, 36, -1, 38,
|
|
Packit |
5c3484 |
39, -1, -1, 42, 22, 23, 24, 25, 26, 27,
|
|
Packit |
5c3484 |
28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
|
|
Packit |
5c3484 |
38, 39, -1, -1, 42, 22, 23, 24, 25, 26,
|
|
Packit |
5c3484 |
27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
|
|
Packit |
5c3484 |
-1, 38, 39, -1, -1, 42, 22, 23, 24, 25,
|
|
Packit |
5c3484 |
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
|
Packit |
5c3484 |
36, -1, 38, 39, 23, 24, 25, 26, 27, 28,
|
|
Packit |
5c3484 |
29, 30, 31, 32, 33, 34, 35, 36, -1, 38,
|
|
Packit |
5c3484 |
39, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
|
Packit |
5c3484 |
33, 34, 35, 36, -1, 38, 39, 24, 25, 26,
|
|
Packit |
5c3484 |
27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
|
|
Packit |
5c3484 |
-1, 38, 39
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
|
Packit |
5c3484 |
symbol of state STATE-NUM. */
|
|
Packit |
5c3484 |
static const yytype_uint8 yystos[] =
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
0, 1, 5, 6, 7, 8, 9, 10, 11, 12,
|
|
Packit |
5c3484 |
13, 14, 15, 16, 17, 18, 19, 20, 21, 33,
|
|
Packit |
5c3484 |
41, 45, 46, 47, 48, 3, 41, 41, 41, 41,
|
|
Packit |
5c3484 |
41, 41, 41, 41, 41, 41, 41, 40, 21, 48,
|
|
Packit |
5c3484 |
48, 0, 47, 3, 22, 23, 24, 25, 26, 27,
|
|
Packit |
5c3484 |
28, 29, 30, 31, 32, 33, 34, 35, 36, 38,
|
|
Packit |
5c3484 |
39, 48, 48, 48, 48, 49, 48, 48, 50, 48,
|
|
Packit |
5c3484 |
48, 48, 48, 48, 48, 42, 3, 48, 48, 48,
|
|
Packit |
5c3484 |
48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
|
|
Packit |
5c3484 |
48, 48, 48, 42, 43, 42, 42, 43, 43, 42,
|
|
Packit |
5c3484 |
43, 42, 42, 43, 43, 42, 48, 48, 48, 48,
|
|
Packit |
5c3484 |
48, 48, 42, 42, 43, 42, 48, 42
|
|
Packit |
5c3484 |
};
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define yyerrok (yyerrstatus = 0)
|
|
Packit |
5c3484 |
#define yyclearin (yychar = YYEMPTY)
|
|
Packit |
5c3484 |
#define YYEMPTY (-2)
|
|
Packit |
5c3484 |
#define YYEOF 0
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define YYACCEPT goto yyacceptlab
|
|
Packit |
5c3484 |
#define YYABORT goto yyabortlab
|
|
Packit |
5c3484 |
#define YYERROR goto yyerrorlab
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Like YYERROR except do call yyerror. This remains here temporarily
|
|
Packit |
5c3484 |
to ease the transition to the new meaning of YYERROR, for GCC.
|
|
Packit |
5c3484 |
Once GCC version 2 has supplanted version 1, this can go. However,
|
|
Packit |
5c3484 |
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
|
|
Packit |
5c3484 |
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
|
|
Packit |
5c3484 |
discussed. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define YYFAIL goto yyerrlab
|
|
Packit |
5c3484 |
#if defined YYFAIL
|
|
Packit |
5c3484 |
/* This is here to suppress warnings from the GCC cpp's
|
|
Packit |
5c3484 |
-Wunused-macros. Normally we don't worry about that warning, but
|
|
Packit |
5c3484 |
some users do, and we want to make it easy for users to remove
|
|
Packit |
5c3484 |
YYFAIL uses, which will produce warnings from Bison 2.5. */
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define YYRECOVERING() (!!yyerrstatus)
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define YYBACKUP(Token, Value) \
|
|
Packit |
5c3484 |
do \
|
|
Packit |
5c3484 |
if (yychar == YYEMPTY) \
|
|
Packit |
5c3484 |
{ \
|
|
Packit |
5c3484 |
yychar = (Token); \
|
|
Packit |
5c3484 |
yylval = (Value); \
|
|
Packit |
5c3484 |
YYPOPSTACK (yylen); \
|
|
Packit |
5c3484 |
yystate = *yyssp; \
|
|
Packit |
5c3484 |
goto yybackup; \
|
|
Packit |
5c3484 |
} \
|
|
Packit |
5c3484 |
else \
|
|
Packit |
5c3484 |
{ \
|
|
Packit |
5c3484 |
yyerror (YY_("syntax error: cannot back up")); \
|
|
Packit |
5c3484 |
YYERROR; \
|
|
Packit |
5c3484 |
} \
|
|
Packit |
5c3484 |
while (YYID (0))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Error token number */
|
|
Packit |
5c3484 |
#define YYTERROR 1
|
|
Packit |
5c3484 |
#define YYERRCODE 256
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* This macro is provided for backward compatibility. */
|
|
Packit |
5c3484 |
#ifndef YY_LOCATION_PRINT
|
|
Packit |
5c3484 |
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYLEX -- calling `yylex' with the right arguments. */
|
|
Packit |
5c3484 |
#ifdef YYLEX_PARAM
|
|
Packit |
5c3484 |
# define YYLEX yylex (YYLEX_PARAM)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
# define YYLEX yylex ()
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Enable debugging if requested. */
|
|
Packit |
5c3484 |
#if YYDEBUG
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# ifndef YYFPRINTF
|
|
Packit |
5c3484 |
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
|
Packit |
5c3484 |
# define YYFPRINTF fprintf
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# define YYDPRINTF(Args) \
|
|
Packit |
5c3484 |
do { \
|
|
Packit |
5c3484 |
if (yydebug) \
|
|
Packit |
5c3484 |
YYFPRINTF Args; \
|
|
Packit |
5c3484 |
} while (YYID (0))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
|
Packit |
5c3484 |
do { \
|
|
Packit |
5c3484 |
if (yydebug) \
|
|
Packit |
5c3484 |
{ \
|
|
Packit |
5c3484 |
YYFPRINTF (stderr, "%s ", Title); \
|
|
Packit |
5c3484 |
yy_symbol_print (stderr, \
|
|
Packit |
5c3484 |
Type, Value); \
|
|
Packit |
5c3484 |
YYFPRINTF (stderr, "\n"); \
|
|
Packit |
5c3484 |
} \
|
|
Packit |
5c3484 |
} while (YYID (0))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*--------------------------------.
|
|
Packit |
5c3484 |
| Print this symbol on YYOUTPUT. |
|
|
Packit |
5c3484 |
`--------------------------------*/
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*ARGSUSED*/
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
|
|
Packit |
5c3484 |
FILE *yyoutput;
|
|
Packit |
5c3484 |
int yytype;
|
|
Packit |
5c3484 |
YYSTYPE const * const yyvaluep;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
FILE *yyo = yyoutput;
|
|
Packit |
5c3484 |
YYUSE (yyo);
|
|
Packit |
5c3484 |
if (!yyvaluep)
|
|
Packit |
5c3484 |
return;
|
|
Packit |
5c3484 |
# ifdef YYPRINT
|
|
Packit |
5c3484 |
if (yytype < YYNTOKENS)
|
|
Packit |
5c3484 |
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
|
Packit |
5c3484 |
# else
|
|
Packit |
5c3484 |
YYUSE (yyoutput);
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
YYUSE (yytype);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*--------------------------------.
|
|
Packit |
5c3484 |
| Print this symbol on YYOUTPUT. |
|
|
Packit |
5c3484 |
`--------------------------------*/
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yy_symbol_print (yyoutput, yytype, yyvaluep)
|
|
Packit |
5c3484 |
FILE *yyoutput;
|
|
Packit |
5c3484 |
int yytype;
|
|
Packit |
5c3484 |
YYSTYPE const * const yyvaluep;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
if (yytype < YYNTOKENS)
|
|
Packit |
5c3484 |
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
|
|
Packit |
5c3484 |
YYFPRINTF (yyoutput, ")");
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*------------------------------------------------------------------.
|
|
Packit |
5c3484 |
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
|
Packit |
5c3484 |
| TOP (included). |
|
|
Packit |
5c3484 |
`------------------------------------------------------------------*/
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yy_stack_print (yybottom, yytop)
|
|
Packit |
5c3484 |
yytype_int16 *yybottom;
|
|
Packit |
5c3484 |
yytype_int16 *yytop;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
YYFPRINTF (stderr, "Stack now");
|
|
Packit |
5c3484 |
for (; yybottom <= yytop; yybottom++)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
int yybot = *yybottom;
|
|
Packit |
5c3484 |
YYFPRINTF (stderr, " %d", yybot);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
YYFPRINTF (stderr, "\n");
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# define YY_STACK_PRINT(Bottom, Top) \
|
|
Packit |
5c3484 |
do { \
|
|
Packit |
5c3484 |
if (yydebug) \
|
|
Packit |
5c3484 |
yy_stack_print ((Bottom), (Top)); \
|
|
Packit |
5c3484 |
} while (YYID (0))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*------------------------------------------------.
|
|
Packit |
5c3484 |
| Report that the YYRULE is going to be reduced. |
|
|
Packit |
5c3484 |
`------------------------------------------------*/
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yy_reduce_print (yyvsp, yyrule)
|
|
Packit |
5c3484 |
YYSTYPE *yyvsp;
|
|
Packit |
5c3484 |
int yyrule;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
int yynrhs = yyr2[yyrule];
|
|
Packit |
5c3484 |
int yyi;
|
|
Packit |
5c3484 |
unsigned long int yylno = yyrline[yyrule];
|
|
Packit |
5c3484 |
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
|
Packit |
5c3484 |
yyrule - 1, yylno);
|
|
Packit |
5c3484 |
/* The symbols being reduced. */
|
|
Packit |
5c3484 |
for (yyi = 0; yyi < yynrhs; yyi++)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
|
Packit |
5c3484 |
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
|
Packit |
5c3484 |
&(yyvsp[(yyi + 1) - (yynrhs)])
|
|
Packit |
5c3484 |
);
|
|
Packit |
5c3484 |
YYFPRINTF (stderr, "\n");
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# define YY_REDUCE_PRINT(Rule) \
|
|
Packit |
5c3484 |
do { \
|
|
Packit |
5c3484 |
if (yydebug) \
|
|
Packit |
5c3484 |
yy_reduce_print (yyvsp, Rule); \
|
|
Packit |
5c3484 |
} while (YYID (0))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Nonzero means print parse trace. It is left uninitialized so that
|
|
Packit |
5c3484 |
multiple parsers can coexist. */
|
|
Packit |
5c3484 |
int yydebug;
|
|
Packit |
5c3484 |
#else /* !YYDEBUG */
|
|
Packit |
5c3484 |
# define YYDPRINTF(Args)
|
|
Packit |
5c3484 |
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
|
Packit |
5c3484 |
# define YY_STACK_PRINT(Bottom, Top)
|
|
Packit |
5c3484 |
# define YY_REDUCE_PRINT(Rule)
|
|
Packit |
5c3484 |
#endif /* !YYDEBUG */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
|
Packit |
5c3484 |
#ifndef YYINITDEPTH
|
|
Packit |
5c3484 |
# define YYINITDEPTH 200
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
|
|
Packit |
5c3484 |
if the built-in stack extension method is used).
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Do not make this value too large; the results are undefined if
|
|
Packit |
5c3484 |
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
|
|
Packit |
5c3484 |
evaluated with infinite-precision integer arithmetic. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifndef YYMAXDEPTH
|
|
Packit |
5c3484 |
# define YYMAXDEPTH 10000
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if YYERROR_VERBOSE
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# ifndef yystrlen
|
|
Packit |
5c3484 |
# if defined __GLIBC__ && defined _STRING_H
|
|
Packit |
5c3484 |
# define yystrlen strlen
|
|
Packit |
5c3484 |
# else
|
|
Packit |
5c3484 |
/* Return the length of YYSTR. */
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
static YYSIZE_T
|
|
Packit |
5c3484 |
yystrlen (const char *yystr)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
static YYSIZE_T
|
|
Packit |
5c3484 |
yystrlen (yystr)
|
|
Packit |
5c3484 |
const char *yystr;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
YYSIZE_T yylen;
|
|
Packit |
5c3484 |
for (yylen = 0; yystr[yylen]; yylen++)
|
|
Packit |
5c3484 |
continue;
|
|
Packit |
5c3484 |
return yylen;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# ifndef yystpcpy
|
|
Packit |
5c3484 |
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
|
|
Packit |
5c3484 |
# define yystpcpy stpcpy
|
|
Packit |
5c3484 |
# else
|
|
Packit |
5c3484 |
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
|
|
Packit |
5c3484 |
YYDEST. */
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
static char *
|
|
Packit |
5c3484 |
yystpcpy (char *yydest, const char *yysrc)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
static char *
|
|
Packit |
5c3484 |
yystpcpy (yydest, yysrc)
|
|
Packit |
5c3484 |
char *yydest;
|
|
Packit |
5c3484 |
const char *yysrc;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
char *yyd = yydest;
|
|
Packit |
5c3484 |
const char *yys = yysrc;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
while ((*yyd++ = *yys++) != '\0')
|
|
Packit |
5c3484 |
continue;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
return yyd - 1;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
# ifndef yytnamerr
|
|
Packit |
5c3484 |
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
|
|
Packit |
5c3484 |
quotes and backslashes, so that it's suitable for yyerror. The
|
|
Packit |
5c3484 |
heuristic is that double-quoting is unnecessary unless the string
|
|
Packit |
5c3484 |
contains an apostrophe, a comma, or backslash (other than
|
|
Packit |
5c3484 |
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
|
Packit |
5c3484 |
null, do not copy; instead, return the length of what the result
|
|
Packit |
5c3484 |
would have been. */
|
|
Packit |
5c3484 |
static YYSIZE_T
|
|
Packit |
5c3484 |
yytnamerr (char *yyres, const char *yystr)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
if (*yystr == '"')
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
YYSIZE_T yyn = 0;
|
|
Packit |
5c3484 |
char const *yyp = yystr;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
for (;;)
|
|
Packit |
5c3484 |
switch (*++yyp)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
case '\'':
|
|
Packit |
5c3484 |
case ',':
|
|
Packit |
5c3484 |
goto do_not_strip_quotes;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case '\\':
|
|
Packit |
5c3484 |
if (*++yyp != '\\')
|
|
Packit |
5c3484 |
goto do_not_strip_quotes;
|
|
Packit |
5c3484 |
/* Fall through. */
|
|
Packit |
5c3484 |
default:
|
|
Packit |
5c3484 |
if (yyres)
|
|
Packit |
5c3484 |
yyres[yyn] = *yyp;
|
|
Packit |
5c3484 |
yyn++;
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case '"':
|
|
Packit |
5c3484 |
if (yyres)
|
|
Packit |
5c3484 |
yyres[yyn] = '\0';
|
|
Packit |
5c3484 |
return yyn;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
do_not_strip_quotes: ;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
if (! yyres)
|
|
Packit |
5c3484 |
return yystrlen (yystr);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
return yystpcpy (yyres, yystr) - yyres;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
|
|
Packit |
5c3484 |
about the unexpected token YYTOKEN for the state stack whose top is
|
|
Packit |
5c3484 |
YYSSP.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
|
|
Packit |
5c3484 |
not large enough to hold the message. In that case, also set
|
|
Packit |
5c3484 |
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
|
|
Packit |
5c3484 |
required number of bytes is too large to store. */
|
|
Packit |
5c3484 |
static int
|
|
Packit |
5c3484 |
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|
Packit |
5c3484 |
yytype_int16 *yyssp, int yytoken)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
|
Packit |
5c3484 |
YYSIZE_T yysize = yysize0;
|
|
Packit |
5c3484 |
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
|
Packit |
5c3484 |
/* Internationalized format string. */
|
|
Packit |
5c3484 |
const char *yyformat = YY_NULL;
|
|
Packit |
5c3484 |
/* Arguments of yyformat. */
|
|
Packit |
5c3484 |
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
|
Packit |
5c3484 |
/* Number of reported tokens (one for the "unexpected", one per
|
|
Packit |
5c3484 |
"expected"). */
|
|
Packit |
5c3484 |
int yycount = 0;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* There are many possibilities here to consider:
|
|
Packit |
5c3484 |
- Assume YYFAIL is not used. It's too flawed to consider. See
|
|
Packit |
5c3484 |
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
|
Packit |
5c3484 |
for details. YYERROR is fine as it does not invoke this
|
|
Packit |
5c3484 |
function.
|
|
Packit |
5c3484 |
- If this state is a consistent state with a default action, then
|
|
Packit |
5c3484 |
the only way this function was invoked is if the default action
|
|
Packit |
5c3484 |
is an error action. In that case, don't check for expected
|
|
Packit |
5c3484 |
tokens because there are none.
|
|
Packit |
5c3484 |
- The only way there can be no lookahead present (in yychar) is if
|
|
Packit |
5c3484 |
this state is a consistent state with a default action. Thus,
|
|
Packit |
5c3484 |
detecting the absence of a lookahead is sufficient to determine
|
|
Packit |
5c3484 |
that there is no unexpected or expected token to report. In that
|
|
Packit |
5c3484 |
case, just report a simple "syntax error".
|
|
Packit |
5c3484 |
- Don't assume there isn't a lookahead just because this state is a
|
|
Packit |
5c3484 |
consistent state with a default action. There might have been a
|
|
Packit |
5c3484 |
previous inconsistent state, consistent state with a non-default
|
|
Packit |
5c3484 |
action, or user semantic action that manipulated yychar.
|
|
Packit |
5c3484 |
- Of course, the expected token list depends on states to have
|
|
Packit |
5c3484 |
correct lookahead information, and it depends on the parser not
|
|
Packit |
5c3484 |
to perform extra reductions after fetching a lookahead from the
|
|
Packit |
5c3484 |
scanner and before detecting a syntax error. Thus, state merging
|
|
Packit |
5c3484 |
(from LALR or IELR) and default reductions corrupt the expected
|
|
Packit |
5c3484 |
token list. However, the list is correct for canonical LR with
|
|
Packit |
5c3484 |
one exception: it will still contain any token that will not be
|
|
Packit |
5c3484 |
accepted due to an error action in a later state.
|
|
Packit |
5c3484 |
*/
|
|
Packit |
5c3484 |
if (yytoken != YYEMPTY)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
int yyn = yypact[*yyssp];
|
|
Packit |
5c3484 |
yyarg[yycount++] = yytname[yytoken];
|
|
Packit |
5c3484 |
if (!yypact_value_is_default (yyn))
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
/* Start YYX at -YYN if negative to avoid negative indexes in
|
|
Packit |
5c3484 |
YYCHECK. In other words, skip the first -YYN actions for
|
|
Packit |
5c3484 |
this state because they are default actions. */
|
|
Packit |
5c3484 |
int yyxbegin = yyn < 0 ? -yyn : 0;
|
|
Packit |
5c3484 |
/* Stay within bounds of both yycheck and yytname. */
|
|
Packit |
5c3484 |
int yychecklim = YYLAST - yyn + 1;
|
|
Packit |
5c3484 |
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
|
Packit |
5c3484 |
int yyx;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
|
Packit |
5c3484 |
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
|
Packit |
5c3484 |
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yycount = 1;
|
|
Packit |
5c3484 |
yysize = yysize0;
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
yyarg[yycount++] = yytname[yyx];
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
|
Packit |
5c3484 |
if (! (yysize <= yysize1
|
|
Packit |
5c3484 |
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
|
Packit |
5c3484 |
return 2;
|
|
Packit |
5c3484 |
yysize = yysize1;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
switch (yycount)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
# define YYCASE_(N, S) \
|
|
Packit |
5c3484 |
case N: \
|
|
Packit |
5c3484 |
yyformat = S; \
|
|
Packit |
5c3484 |
break
|
|
Packit |
5c3484 |
YYCASE_(0, YY_("syntax error"));
|
|
Packit |
5c3484 |
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
|
Packit |
5c3484 |
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
|
Packit |
5c3484 |
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
|
Packit |
5c3484 |
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
|
Packit |
5c3484 |
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
|
Packit |
5c3484 |
# undef YYCASE_
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
|
Packit |
5c3484 |
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
|
Packit |
5c3484 |
return 2;
|
|
Packit |
5c3484 |
yysize = yysize1;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
if (*yymsg_alloc < yysize)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
*yymsg_alloc = 2 * yysize;
|
|
Packit |
5c3484 |
if (! (yysize <= *yymsg_alloc
|
|
Packit |
5c3484 |
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
|
|
Packit |
5c3484 |
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
|
|
Packit |
5c3484 |
return 1;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Avoid sprintf, as that infringes on the user's name space.
|
|
Packit |
5c3484 |
Don't have undefined behavior even if the translation
|
|
Packit |
5c3484 |
produced a string with the wrong number of "%s"s. */
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
char *yyp = *yymsg;
|
|
Packit |
5c3484 |
int yyi = 0;
|
|
Packit |
5c3484 |
while ((*yyp = *yyformat) != '\0')
|
|
Packit |
5c3484 |
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yyp += yytnamerr (yyp, yyarg[yyi++]);
|
|
Packit |
5c3484 |
yyformat += 2;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yyp++;
|
|
Packit |
5c3484 |
yyformat++;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
return 0;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
#endif /* YYERROR_VERBOSE */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*-----------------------------------------------.
|
|
Packit |
5c3484 |
| Release the memory associated to this symbol. |
|
|
Packit |
5c3484 |
`-----------------------------------------------*/
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*ARGSUSED*/
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
static void
|
|
Packit |
5c3484 |
yydestruct (yymsg, yytype, yyvaluep)
|
|
Packit |
5c3484 |
const char *yymsg;
|
|
Packit |
5c3484 |
int yytype;
|
|
Packit |
5c3484 |
YYSTYPE *yyvaluep;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
YYUSE (yyvaluep);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
if (!yymsg)
|
|
Packit |
5c3484 |
yymsg = "Deleting";
|
|
Packit |
5c3484 |
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
YYUSE (yytype);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The lookahead symbol. */
|
|
Packit |
5c3484 |
int yychar;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
|
Packit |
5c3484 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
|
Packit |
5c3484 |
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
#ifndef YY_INITIAL_VALUE
|
|
Packit |
5c3484 |
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The semantic value of the lookahead symbol. */
|
|
Packit |
5c3484 |
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Number of syntax errors so far. */
|
|
Packit |
5c3484 |
int yynerrs;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*----------.
|
|
Packit |
5c3484 |
| yyparse. |
|
|
Packit |
5c3484 |
`----------*/
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifdef YYPARSE_PARAM
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
int
|
|
Packit |
5c3484 |
yyparse (void *YYPARSE_PARAM)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
int
|
|
Packit |
5c3484 |
yyparse (YYPARSE_PARAM)
|
|
Packit |
5c3484 |
void *YYPARSE_PARAM;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
#else /* ! YYPARSE_PARAM */
|
|
Packit |
5c3484 |
#if (defined __STDC__ || defined __C99__FUNC__ \
|
|
Packit |
5c3484 |
|| defined __cplusplus || defined _MSC_VER)
|
|
Packit |
5c3484 |
int
|
|
Packit |
5c3484 |
yyparse (void)
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
int
|
|
Packit |
5c3484 |
yyparse ()
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
int yystate;
|
|
Packit |
5c3484 |
/* Number of tokens to shift before error messages enabled. */
|
|
Packit |
5c3484 |
int yyerrstatus;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The stacks and their tools:
|
|
Packit |
5c3484 |
`yyss': related to states.
|
|
Packit |
5c3484 |
`yyvs': related to semantic values.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Refer to the stacks through separate pointers, to allow yyoverflow
|
|
Packit |
5c3484 |
to reallocate them elsewhere. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The state stack. */
|
|
Packit |
5c3484 |
yytype_int16 yyssa[YYINITDEPTH];
|
|
Packit |
5c3484 |
yytype_int16 *yyss;
|
|
Packit |
5c3484 |
yytype_int16 *yyssp;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The semantic value stack. */
|
|
Packit |
5c3484 |
YYSTYPE yyvsa[YYINITDEPTH];
|
|
Packit |
5c3484 |
YYSTYPE *yyvs;
|
|
Packit |
5c3484 |
YYSTYPE *yyvsp;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
YYSIZE_T yystacksize;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
int yyn;
|
|
Packit |
5c3484 |
int yyresult;
|
|
Packit |
5c3484 |
/* Lookahead token as an internal (translated) token number. */
|
|
Packit |
5c3484 |
int yytoken = 0;
|
|
Packit |
5c3484 |
/* The variables used to return semantic value and location from the
|
|
Packit |
5c3484 |
action routines. */
|
|
Packit |
5c3484 |
YYSTYPE yyval;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if YYERROR_VERBOSE
|
|
Packit |
5c3484 |
/* Buffer for error messages, and its allocated size. */
|
|
Packit |
5c3484 |
char yymsgbuf[128];
|
|
Packit |
5c3484 |
char *yymsg = yymsgbuf;
|
|
Packit |
5c3484 |
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* The number of symbols on the RHS of the reduced rule.
|
|
Packit |
5c3484 |
Keep to zero when no symbol should be popped. */
|
|
Packit |
5c3484 |
int yylen = 0;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yyssp = yyss = yyssa;
|
|
Packit |
5c3484 |
yyvsp = yyvs = yyvsa;
|
|
Packit |
5c3484 |
yystacksize = YYINITDEPTH;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
YYDPRINTF ((stderr, "Starting parse\n"));
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yystate = 0;
|
|
Packit |
5c3484 |
yyerrstatus = 0;
|
|
Packit |
5c3484 |
yynerrs = 0;
|
|
Packit |
5c3484 |
yychar = YYEMPTY; /* Cause a token to be read. */
|
|
Packit |
5c3484 |
goto yysetstate;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*------------------------------------------------------------.
|
|
Packit |
5c3484 |
| yynewstate -- Push a new state, which is found in yystate. |
|
|
Packit |
5c3484 |
`------------------------------------------------------------*/
|
|
Packit |
5c3484 |
yynewstate:
|
|
Packit |
5c3484 |
/* In all cases, when you get here, the value and location stacks
|
|
Packit |
5c3484 |
have just been pushed. So pushing a state here evens the stacks. */
|
|
Packit |
5c3484 |
yyssp++;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yysetstate:
|
|
Packit |
5c3484 |
*yyssp = yystate;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
if (yyss + yystacksize - 1 <= yyssp)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
/* Get the current used size of the three stacks, in elements. */
|
|
Packit |
5c3484 |
YYSIZE_T yysize = yyssp - yyss + 1;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#ifdef yyoverflow
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
/* Give user a chance to reallocate the stack. Use copies of
|
|
Packit |
5c3484 |
these so that the &'s don't force the real ones into
|
|
Packit |
5c3484 |
memory. */
|
|
Packit |
5c3484 |
YYSTYPE *yyvs1 = yyvs;
|
|
Packit |
5c3484 |
yytype_int16 *yyss1 = yyss;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Each stack pointer address is followed by the size of the
|
|
Packit |
5c3484 |
data in use in that stack, in bytes. This used to be a
|
|
Packit |
5c3484 |
conditional around just the two extra args, but that might
|
|
Packit |
5c3484 |
be undefined if yyoverflow is a macro. */
|
|
Packit |
5c3484 |
yyoverflow (YY_("memory exhausted"),
|
|
Packit |
5c3484 |
&yyss1, yysize * sizeof (*yyssp),
|
|
Packit |
5c3484 |
&yyvs1, yysize * sizeof (*yyvsp),
|
|
Packit |
5c3484 |
&yystacksize);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yyss = yyss1;
|
|
Packit |
5c3484 |
yyvs = yyvs1;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
#else /* no yyoverflow */
|
|
Packit |
5c3484 |
# ifndef YYSTACK_RELOCATE
|
|
Packit |
5c3484 |
goto yyexhaustedlab;
|
|
Packit |
5c3484 |
# else
|
|
Packit |
5c3484 |
/* Extend the stack our own way. */
|
|
Packit |
5c3484 |
if (YYMAXDEPTH <= yystacksize)
|
|
Packit |
5c3484 |
goto yyexhaustedlab;
|
|
Packit |
5c3484 |
yystacksize *= 2;
|
|
Packit |
5c3484 |
if (YYMAXDEPTH < yystacksize)
|
|
Packit |
5c3484 |
yystacksize = YYMAXDEPTH;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yytype_int16 *yyss1 = yyss;
|
|
Packit |
5c3484 |
union yyalloc *yyptr =
|
|
Packit |
5c3484 |
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
|
Packit |
5c3484 |
if (! yyptr)
|
|
Packit |
5c3484 |
goto yyexhaustedlab;
|
|
Packit |
5c3484 |
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
|
Packit |
5c3484 |
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
|
|
Packit |
5c3484 |
# undef YYSTACK_RELOCATE
|
|
Packit |
5c3484 |
if (yyss1 != yyssa)
|
|
Packit |
5c3484 |
YYSTACK_FREE (yyss1);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
# endif
|
|
Packit |
5c3484 |
#endif /* no yyoverflow */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yyssp = yyss + yysize - 1;
|
|
Packit |
5c3484 |
yyvsp = yyvs + yysize - 1;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
|
Packit |
5c3484 |
(unsigned long int) yystacksize));
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
if (yyss + yystacksize - 1 <= yyssp)
|
|
Packit |
5c3484 |
YYABORT;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
if (yystate == YYFINAL)
|
|
Packit |
5c3484 |
YYACCEPT;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
goto yybackup;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*-----------.
|
|
Packit |
5c3484 |
| yybackup. |
|
|
Packit |
5c3484 |
`-----------*/
|
|
Packit |
5c3484 |
yybackup:
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Do appropriate processing given the current state. Read a
|
|
Packit |
5c3484 |
lookahead token if we need one and don't already have one. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* First try to decide what to do without reference to lookahead token. */
|
|
Packit |
5c3484 |
yyn = yypact[yystate];
|
|
Packit |
5c3484 |
if (yypact_value_is_default (yyn))
|
|
Packit |
5c3484 |
goto yydefault;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Not known => get a lookahead token if don't already have one. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
|
|
Packit |
5c3484 |
if (yychar == YYEMPTY)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
YYDPRINTF ((stderr, "Reading a token: "));
|
|
Packit |
5c3484 |
yychar = YYLEX;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
if (yychar <= YYEOF)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yychar = yytoken = YYEOF;
|
|
Packit |
5c3484 |
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yytoken = YYTRANSLATE (yychar);
|
|
Packit |
5c3484 |
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
|
Packit |
5c3484 |
detect an error, take that action. */
|
|
Packit |
5c3484 |
yyn += yytoken;
|
|
Packit |
5c3484 |
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
|
|
Packit |
5c3484 |
goto yydefault;
|
|
Packit |
5c3484 |
yyn = yytable[yyn];
|
|
Packit |
5c3484 |
if (yyn <= 0)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
if (yytable_value_is_error (yyn))
|
|
Packit |
5c3484 |
goto yyerrlab;
|
|
Packit |
5c3484 |
yyn = -yyn;
|
|
Packit |
5c3484 |
goto yyreduce;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Count tokens shifted since error; after three, turn off error
|
|
Packit |
5c3484 |
status. */
|
|
Packit |
5c3484 |
if (yyerrstatus)
|
|
Packit |
5c3484 |
yyerrstatus--;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Shift the lookahead token. */
|
|
Packit |
5c3484 |
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Discard the shifted token. */
|
|
Packit |
5c3484 |
yychar = YYEMPTY;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yystate = yyn;
|
|
Packit |
5c3484 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
|
Packit |
5c3484 |
*++yyvsp = yylval;
|
|
Packit |
5c3484 |
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
goto yynewstate;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*-----------------------------------------------------------.
|
|
Packit |
5c3484 |
| yydefault -- do the default action for the current state. |
|
|
Packit |
5c3484 |
`-----------------------------------------------------------*/
|
|
Packit |
5c3484 |
yydefault:
|
|
Packit |
5c3484 |
yyn = yydefact[yystate];
|
|
Packit |
5c3484 |
if (yyn == 0)
|
|
Packit |
5c3484 |
goto yyerrlab;
|
|
Packit |
5c3484 |
goto yyreduce;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*-----------------------------.
|
|
Packit |
5c3484 |
| yyreduce -- Do a reduction. |
|
|
Packit |
5c3484 |
`-----------------------------*/
|
|
Packit |
5c3484 |
yyreduce:
|
|
Packit |
5c3484 |
/* yyn is the number of a rule to reduce with. */
|
|
Packit |
5c3484 |
yylen = yyr2[yyn];
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* If YYLEN is nonzero, implement the default value of the action:
|
|
Packit |
5c3484 |
`$$ = $1'.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Otherwise, the following line sets YYVAL to garbage.
|
|
Packit |
5c3484 |
This behavior is undocumented and Bison
|
|
Packit |
5c3484 |
users should not rely upon it. Assigning to YYVAL
|
|
Packit |
5c3484 |
unconditionally makes the parser a bit smaller, and it avoids a
|
|
Packit |
5c3484 |
GCC warning that YYVAL may be used uninitialized. */
|
|
Packit |
5c3484 |
yyval = yyvsp[1-yylen];
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
YY_REDUCE_PRINT (yyn);
|
|
Packit |
5c3484 |
switch (yyn)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
case 6:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 173 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp = stack[0]; yyerrok; }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 8:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 177 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
mpz_out_str (stdout, obase, sp); putchar ('\n');
|
|
Packit |
5c3484 |
sp--;
|
|
Packit |
5c3484 |
CHECK_EMPTY ();
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 9:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 182 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
CHECK_VARIABLE ((yyvsp[(1) - (3)].var));
|
|
Packit |
5c3484 |
mpz_swap (variable[(yyvsp[(1) - (3)].var)], sp);
|
|
Packit |
5c3484 |
sp--;
|
|
Packit |
5c3484 |
CHECK_EMPTY ();
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 10:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 188 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ calc_help (); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 11:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 189 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ ibase = 16; obase = -16; }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 12:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 190 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ ibase = 0; obase = 10; }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 13:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 191 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ exit (0); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 15:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 198 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_add (sp, sp, sp+1); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 16:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 199 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_sub (sp, sp, sp+1); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 17:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 200 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_mul (sp, sp, sp+1); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 18:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 201 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_fdiv_q (sp, sp, sp+1); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 19:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 202 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_fdiv_r (sp, sp, sp+1); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 20:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 203 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ CHECK_UI ("Exponent", sp);
|
|
Packit |
5c3484 |
sp--; mpz_pow_ui (sp, sp, mpz_get_ui (sp+1)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 21:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 205 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ CHECK_UI ("Shift count", sp);
|
|
Packit |
5c3484 |
sp--; mpz_mul_2exp (sp, sp, mpz_get_ui (sp+1)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 22:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 207 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ CHECK_UI ("Shift count", sp);
|
|
Packit |
5c3484 |
sp--; mpz_fdiv_q_2exp (sp, sp, mpz_get_ui (sp+1)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 23:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 209 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ CHECK_UI ("Factorial", sp);
|
|
Packit |
5c3484 |
mpz_fac_ui (sp, mpz_get_ui (sp)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 24:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 211 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ mpz_neg (sp, sp); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 25:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 213 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) < 0); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 26:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 214 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <= 0); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 27:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 215 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) == 0); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 28:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 216 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) != 0); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 29:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 217 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >= 0); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 30:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 218 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) > 0); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 31:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 220 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_set_ui (sp, mpz_sgn (sp) && mpz_sgn (sp+1)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 32:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 221 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_set_ui (sp, mpz_sgn (sp) || mpz_sgn (sp+1)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 33:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 223 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ mpz_abs (sp, sp); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 34:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 224 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; CHECK_UI ("Binomial base", sp+1);
|
|
Packit |
5c3484 |
mpz_bin_ui (sp, sp, mpz_get_ui (sp+1)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 35:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 226 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ CHECK_UI ("Fibonacci", sp);
|
|
Packit |
5c3484 |
mpz_fib_ui (sp, mpz_get_ui (sp)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 37:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 229 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_set_si (sp,
|
|
Packit |
5c3484 |
mpz_kronecker (sp, sp+1)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 39:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 232 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ CHECK_UI ("Lucas number", sp);
|
|
Packit |
5c3484 |
mpz_lucnum_ui (sp, mpz_get_ui (sp)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 40:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 234 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ mpz_nextprime (sp, sp); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 41:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 235 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp -= 2; mpz_powm (sp, sp, sp+1, sp+2); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 42:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 236 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; CHECK_UI ("Nth-root", sp+1);
|
|
Packit |
5c3484 |
mpz_root (sp, sp, mpz_get_ui (sp+1)); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 43:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 238 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ mpz_sqrt (sp, sp); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 44:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 240 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
sp++;
|
|
Packit |
5c3484 |
CHECK_OVERFLOW ();
|
|
Packit |
5c3484 |
CHECK_VARIABLE ((yyvsp[(1) - (1)].var));
|
|
Packit |
5c3484 |
mpz_set (sp, variable[(yyvsp[(1) - (1)].var)]);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 45:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 246 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
sp++;
|
|
Packit |
5c3484 |
CHECK_OVERFLOW ();
|
|
Packit |
5c3484 |
if (mpz_set_str (sp, (yyvsp[(1) - (1)].str), ibase) != 0)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
fprintf (stderr, "Invalid number: %s\n", (yyvsp[(1) - (1)].str));
|
|
Packit |
5c3484 |
YYERROR;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 47:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 258 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_gcd (sp, sp, sp+1); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
case 49:
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 262 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
{ sp--; mpz_lcm (sp, sp, sp+1); }
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Line 1787 of yacc.c */
|
|
Packit |
5c3484 |
#line 1968 "calc.c"
|
|
Packit |
5c3484 |
default: break;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
/* User semantic actions sometimes alter yychar, and that requires
|
|
Packit |
5c3484 |
that yytoken be updated with the new translation. We take the
|
|
Packit |
5c3484 |
approach of translating immediately before every use of yytoken.
|
|
Packit |
5c3484 |
One alternative is translating here after every semantic action,
|
|
Packit |
5c3484 |
but that translation would be missed if the semantic action invokes
|
|
Packit |
5c3484 |
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
|
|
Packit |
5c3484 |
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
|
|
Packit |
5c3484 |
incorrect destructor might then be invoked immediately. In the
|
|
Packit |
5c3484 |
case of YYERROR or YYBACKUP, subsequent parser actions might lead
|
|
Packit |
5c3484 |
to an incorrect destructor call or verbose syntax error message
|
|
Packit |
5c3484 |
before the lookahead is translated. */
|
|
Packit |
5c3484 |
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
YYPOPSTACK (yylen);
|
|
Packit |
5c3484 |
yylen = 0;
|
|
Packit |
5c3484 |
YY_STACK_PRINT (yyss, yyssp);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
*++yyvsp = yyval;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Now `shift' the result of the reduction. Determine what state
|
|
Packit |
5c3484 |
that goes to, based on the state we popped back to and the rule
|
|
Packit |
5c3484 |
number reduced by. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yyn = yyr1[yyn];
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
|
|
Packit |
5c3484 |
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
|
|
Packit |
5c3484 |
yystate = yytable[yystate];
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
yystate = yydefgoto[yyn - YYNTOKENS];
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
goto yynewstate;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*------------------------------------.
|
|
Packit |
5c3484 |
| yyerrlab -- here on detecting error |
|
|
Packit |
5c3484 |
`------------------------------------*/
|
|
Packit |
5c3484 |
yyerrlab:
|
|
Packit |
5c3484 |
/* Make sure we have latest lookahead translation. See comments at
|
|
Packit |
5c3484 |
user semantic actions for why this is necessary. */
|
|
Packit |
5c3484 |
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* If not already recovering from an error, report this error. */
|
|
Packit |
5c3484 |
if (!yyerrstatus)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
++yynerrs;
|
|
Packit |
5c3484 |
#if ! YYERROR_VERBOSE
|
|
Packit |
5c3484 |
yyerror (YY_("syntax error"));
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
|
|
Packit |
5c3484 |
yyssp, yytoken)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
char const *yymsgp = YY_("syntax error");
|
|
Packit |
5c3484 |
int yysyntax_error_status;
|
|
Packit |
5c3484 |
yysyntax_error_status = YYSYNTAX_ERROR;
|
|
Packit |
5c3484 |
if (yysyntax_error_status == 0)
|
|
Packit |
5c3484 |
yymsgp = yymsg;
|
|
Packit |
5c3484 |
else if (yysyntax_error_status == 1)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
if (yymsg != yymsgbuf)
|
|
Packit |
5c3484 |
YYSTACK_FREE (yymsg);
|
|
Packit |
5c3484 |
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
|
|
Packit |
5c3484 |
if (!yymsg)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yymsg = yymsgbuf;
|
|
Packit |
5c3484 |
yymsg_alloc = sizeof yymsgbuf;
|
|
Packit |
5c3484 |
yysyntax_error_status = 2;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yysyntax_error_status = YYSYNTAX_ERROR;
|
|
Packit |
5c3484 |
yymsgp = yymsg;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
yyerror (yymsgp);
|
|
Packit |
5c3484 |
if (yysyntax_error_status == 2)
|
|
Packit |
5c3484 |
goto yyexhaustedlab;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
# undef YYSYNTAX_ERROR
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
if (yyerrstatus == 3)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
/* If just tried and failed to reuse lookahead token after an
|
|
Packit |
5c3484 |
error, discard it. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
if (yychar <= YYEOF)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
/* Return failure if at end of input. */
|
|
Packit |
5c3484 |
if (yychar == YYEOF)
|
|
Packit |
5c3484 |
YYABORT;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yydestruct ("Error: discarding",
|
|
Packit |
5c3484 |
yytoken, &yylval);
|
|
Packit |
5c3484 |
yychar = YYEMPTY;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Else will try to reuse lookahead token after shifting the error
|
|
Packit |
5c3484 |
token. */
|
|
Packit |
5c3484 |
goto yyerrlab1;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*---------------------------------------------------.
|
|
Packit |
5c3484 |
| yyerrorlab -- error raised explicitly by YYERROR. |
|
|
Packit |
5c3484 |
`---------------------------------------------------*/
|
|
Packit |
5c3484 |
yyerrorlab:
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Pacify compilers like GCC when the user code never invokes
|
|
Packit |
5c3484 |
YYERROR and the label yyerrorlab therefore never appears in user
|
|
Packit |
5c3484 |
code. */
|
|
Packit |
5c3484 |
if (/*CONSTCOND*/ 0)
|
|
Packit |
5c3484 |
goto yyerrorlab;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Do not reclaim the symbols of the rule which action triggered
|
|
Packit |
5c3484 |
this YYERROR. */
|
|
Packit |
5c3484 |
YYPOPSTACK (yylen);
|
|
Packit |
5c3484 |
yylen = 0;
|
|
Packit |
5c3484 |
YY_STACK_PRINT (yyss, yyssp);
|
|
Packit |
5c3484 |
yystate = *yyssp;
|
|
Packit |
5c3484 |
goto yyerrlab1;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*-------------------------------------------------------------.
|
|
Packit |
5c3484 |
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
|
Packit |
5c3484 |
`-------------------------------------------------------------*/
|
|
Packit |
5c3484 |
yyerrlab1:
|
|
Packit |
5c3484 |
yyerrstatus = 3; /* Each real token shifted decrements this. */
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
for (;;)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yyn = yypact[yystate];
|
|
Packit |
5c3484 |
if (!yypact_value_is_default (yyn))
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yyn += YYTERROR;
|
|
Packit |
5c3484 |
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yyn = yytable[yyn];
|
|
Packit |
5c3484 |
if (0 < yyn)
|
|
Packit |
5c3484 |
break;
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Pop the current state because it cannot handle the error token. */
|
|
Packit |
5c3484 |
if (yyssp == yyss)
|
|
Packit |
5c3484 |
YYABORT;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yydestruct ("Error: popping",
|
|
Packit |
5c3484 |
yystos[yystate], yyvsp);
|
|
Packit |
5c3484 |
YYPOPSTACK (1);
|
|
Packit |
5c3484 |
yystate = *yyssp;
|
|
Packit |
5c3484 |
YY_STACK_PRINT (yyss, yyssp);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
|
Packit |
5c3484 |
*++yyvsp = yylval;
|
|
Packit |
5c3484 |
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Shift the error token. */
|
|
Packit |
5c3484 |
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yystate = yyn;
|
|
Packit |
5c3484 |
goto yynewstate;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*-------------------------------------.
|
|
Packit |
5c3484 |
| yyacceptlab -- YYACCEPT comes here. |
|
|
Packit |
5c3484 |
`-------------------------------------*/
|
|
Packit |
5c3484 |
yyacceptlab:
|
|
Packit |
5c3484 |
yyresult = 0;
|
|
Packit |
5c3484 |
goto yyreturn;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/*-----------------------------------.
|
|
Packit |
5c3484 |
| yyabortlab -- YYABORT comes here. |
|
|
Packit |
5c3484 |
`-----------------------------------*/
|
|
Packit |
5c3484 |
yyabortlab:
|
|
Packit |
5c3484 |
yyresult = 1;
|
|
Packit |
5c3484 |
goto yyreturn;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if !defined yyoverflow || YYERROR_VERBOSE
|
|
Packit |
5c3484 |
/*-------------------------------------------------.
|
|
Packit |
5c3484 |
| yyexhaustedlab -- memory exhaustion comes here. |
|
|
Packit |
5c3484 |
`-------------------------------------------------*/
|
|
Packit |
5c3484 |
yyexhaustedlab:
|
|
Packit |
5c3484 |
yyerror (YY_("memory exhausted"));
|
|
Packit |
5c3484 |
yyresult = 2;
|
|
Packit |
5c3484 |
/* Fall through. */
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yyreturn:
|
|
Packit |
5c3484 |
if (yychar != YYEMPTY)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
/* Make sure we have latest lookahead translation. See comments at
|
|
Packit |
5c3484 |
user semantic actions for why this is necessary. */
|
|
Packit |
5c3484 |
yytoken = YYTRANSLATE (yychar);
|
|
Packit |
5c3484 |
yydestruct ("Cleanup: discarding lookahead",
|
|
Packit |
5c3484 |
yytoken, &yylval);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
/* Do not reclaim the symbols of the rule which action triggered
|
|
Packit |
5c3484 |
this YYABORT or YYACCEPT. */
|
|
Packit |
5c3484 |
YYPOPSTACK (yylen);
|
|
Packit |
5c3484 |
YY_STACK_PRINT (yyss, yyssp);
|
|
Packit |
5c3484 |
while (yyssp != yyss)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
yydestruct ("Cleanup: popping",
|
|
Packit |
5c3484 |
yystos[*yyssp], yyvsp);
|
|
Packit |
5c3484 |
YYPOPSTACK (1);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
#ifndef yyoverflow
|
|
Packit |
5c3484 |
if (yyss != yyssa)
|
|
Packit |
5c3484 |
YYSTACK_FREE (yyss);
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
#if YYERROR_VERBOSE
|
|
Packit |
5c3484 |
if (yymsg != yymsgbuf)
|
|
Packit |
5c3484 |
YYSTACK_FREE (yymsg);
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
/* Make sure YYID is used. */
|
|
Packit |
5c3484 |
return YYID (yyresult);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
/* Line 2050 of yacc.c */
|
|
Packit |
5c3484 |
#line 264 "../../../gmp/demos/calc/calc.y"
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
yyerror (char *s)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
fprintf (stderr, "%s\n", s);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
int calc_option_readline = -1;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
int
|
|
Packit |
5c3484 |
main (int argc, char *argv[])
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
int i;
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
for (i = 1; i < argc; i++)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
if (strcmp (argv[i], "--readline") == 0)
|
|
Packit |
5c3484 |
calc_option_readline = 1;
|
|
Packit |
5c3484 |
else if (strcmp (argv[i], "--noreadline") == 0)
|
|
Packit |
5c3484 |
calc_option_readline = 0;
|
|
Packit |
5c3484 |
else if (strcmp (argv[i], "--help") == 0)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
printf ("Usage: calc [--option]...\n");
|
|
Packit |
5c3484 |
printf (" --readline use readline\n");
|
|
Packit |
5c3484 |
printf (" --noreadline don't use readline\n");
|
|
Packit |
5c3484 |
printf (" --help this message\n");
|
|
Packit |
5c3484 |
printf ("Readline is only available when compiled in,\n");
|
|
Packit |
5c3484 |
printf ("and in that case it's the default on a tty.\n");
|
|
Packit |
5c3484 |
exit (0);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
else
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
fprintf (stderr, "Unrecognised option: %s\n", argv[i]);
|
|
Packit |
5c3484 |
exit (1);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
#if WITH_READLINE
|
|
Packit |
5c3484 |
calc_init_readline ();
|
|
Packit |
5c3484 |
#else
|
|
Packit |
5c3484 |
if (calc_option_readline == 1)
|
|
Packit |
5c3484 |
{
|
|
Packit |
5c3484 |
fprintf (stderr, "Readline support not available\n");
|
|
Packit |
5c3484 |
exit (1);
|
|
Packit |
5c3484 |
}
|
|
Packit |
5c3484 |
#endif
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
for (i = 0; i < numberof (variable); i++)
|
|
Packit |
5c3484 |
mpz_init (variable[i]);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
for (i = 0; i < numberof (stack); i++)
|
|
Packit |
5c3484 |
mpz_init (stack[i]);
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
return yyparse ();
|
|
Packit |
5c3484 |
}
|