2
/* A Bison parser, made by GNU Bison 3.0.4. */
4
/* Bison implementation for Yacc-like parsers in C
6
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
8
This program is free software: you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation, either version 3 of the License, or
11
(at your option) any later version.
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
/* As a special exception, you may create a larger work that contains
22
part or all of the Bison parser skeleton and distribute that work
23
under terms of your choice, so long as that work isn't itself a
24
parser generator using the skeleton or a modified version thereof
25
as a parser skeleton. Alternatively, if you modify or redistribute
26
the parser skeleton itself, you may (at your option) remove this
27
special exception, which will cause the skeleton and the resulting
28
Bison output files to be licensed under the GNU General Public
29
License without this special exception.
31
This special exception was added by the Free Software Foundation in
32
version 2.2 of Bison. */
34
/* C LALR(1) parser skeleton written by Richard Stallman, by
35
simplifying the original so-called "semantic" parser. */
37
/* All symbols defined below should begin with yy or YY, to avoid
38
infringing on user name space. This should be done even for local
39
variables, as they might otherwise be expanded by user macros.
40
There are some unavoidable exceptions within include files to
41
define necessary library symbols; they are noted "INFRINGES ON
42
USER NAME SPACE" below. */
44
/* Identify Bison output. */
48
#define YYBISON_VERSION "3.0.4"
51
#define YYSKELETON_NAME "yacc.c"
65
/* Copy the first part of user declarations. */
66
#line 6 "QuantityParser.y" /* yacc.c:339 */
68
#define YYSTYPE Quantity
69
#define yyparse Quantity_yyparse
70
#define yyerror Quantity_yyerror
72
# define DOUBLE_MAX 1.7976931348623157E+308 /* max decimal value of a "double"*/
75
# define DOUBLE_MIN 2.2250738585072014E-308 /* min decimal value of a "double"*/
79
#line 79 "QuantityParser.c" /* yacc.c:339 */
82
# if defined __cplusplus && 201103L <= __cplusplus
83
# define YY_NULLPTR nullptr
89
/* Enabling verbose error messages. */
91
# undef YYERROR_VERBOSE
92
# define YYERROR_VERBOSE 1
94
# define YYERROR_VERBOSE 0
136
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
138
# define YYSTYPE_IS_TRIVIAL 1
139
# define YYSTYPE_IS_DECLARED 1
143
extern YYSTYPE yylval;
149
/* Copy the second part of user declarations. */
151
#line 151 "QuantityParser.c" /* yacc.c:358 */
158
typedef YYTYPE_UINT8 yytype_uint8;
160
typedef unsigned char yytype_uint8;
164
typedef YYTYPE_INT8 yytype_int8;
166
typedef signed char yytype_int8;
170
typedef YYTYPE_UINT16 yytype_uint16;
172
typedef unsigned short int yytype_uint16;
176
typedef YYTYPE_INT16 yytype_int16;
178
typedef short int yytype_int16;
183
# define YYSIZE_T __SIZE_TYPE__
185
# define YYSIZE_T size_t
186
# elif ! defined YYSIZE_T
187
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
188
# define YYSIZE_T size_t
190
# define YYSIZE_T unsigned int
194
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
197
# if defined YYENABLE_NLS && YYENABLE_NLS
199
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
200
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
204
# define YY_(Msgid) Msgid
209
# if (defined __GNUC__ \
210
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
211
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
212
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
214
# define YY_ATTRIBUTE(Spec) /* empty */
218
#ifndef YY_ATTRIBUTE_PURE
219
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
222
#ifndef YY_ATTRIBUTE_UNUSED
223
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
226
#if !defined _Noreturn \
227
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
228
# if defined _MSC_VER && 1200 <= _MSC_VER
229
# define _Noreturn __declspec (noreturn)
231
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
235
/* Suppress unused-variable warnings by "using" E. */
236
#if ! defined lint || defined __GNUC__
237
# define YYUSE(E) ((void) (E))
239
# define YYUSE(E) /* empty */
242
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
243
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
244
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
245
_Pragma ("GCC diagnostic push") \
246
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
247
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
248
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
249
_Pragma ("GCC diagnostic pop")
251
# define YY_INITIAL_VALUE(Value) Value
253
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
254
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
255
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
257
#ifndef YY_INITIAL_VALUE
258
# define YY_INITIAL_VALUE(Value) /* Nothing. */
262
#if ! defined yyoverflow || YYERROR_VERBOSE
264
/* The parser invokes alloca or malloc; define the necessary symbols. */
266
# ifdef YYSTACK_USE_ALLOCA
267
# if YYSTACK_USE_ALLOCA
269
# define YYSTACK_ALLOC __builtin_alloca
270
# elif defined __BUILTIN_VA_ARG_INCR
271
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
273
# define YYSTACK_ALLOC __alloca
274
# elif defined _MSC_VER
275
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
276
# define alloca _alloca
278
# define YYSTACK_ALLOC alloca
279
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
280
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
281
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
283
# define EXIT_SUCCESS 0
291
/* Pacify GCC's 'empty if-body' warning. */
292
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
293
# ifndef YYSTACK_ALLOC_MAXIMUM
294
/* The OS might guarantee only one guard page at the bottom of the stack,
295
and a page size can be as small as 4096 bytes. So we cannot safely
296
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
297
to allow for a few compiler-allocated temporary stack slots. */
298
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
301
# define YYSTACK_ALLOC YYMALLOC
302
# define YYSTACK_FREE YYFREE
303
# ifndef YYSTACK_ALLOC_MAXIMUM
304
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
306
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
307
&& ! ((defined YYMALLOC || defined malloc) \
308
&& (defined YYFREE || defined free)))
309
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
311
# define EXIT_SUCCESS 0
315
# define YYMALLOC malloc
316
# if ! defined malloc && ! defined EXIT_SUCCESS
317
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
322
# if ! defined free && ! defined EXIT_SUCCESS
323
void free (void *); /* INFRINGES ON USER NAME SPACE */
327
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
330
#if (! defined yyoverflow \
331
&& (! defined __cplusplus \
332
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
334
/* A type that is properly aligned for any stack member. */
337
yytype_int16 yyss_alloc;
341
/* The size of the maximum gap between one aligned stack and the next. */
342
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
344
/* The size of an array large to enough to hold all stacks, each with
346
# define YYSTACK_BYTES(N) \
347
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
348
+ YYSTACK_GAP_MAXIMUM)
350
# define YYCOPY_NEEDED 1
352
/* Relocate STACK from its old location to the new one. The
353
local variables YYSIZE and YYSTACKSIZE give the old and new number of
354
elements in the stack, and YYPTR gives the new location of the
355
stack. Advance YYPTR to a properly aligned location for the next
357
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
360
YYSIZE_T yynewbytes; \
361
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
362
Stack = &yyptr->Stack_alloc; \
363
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
364
yyptr += yynewbytes / sizeof (*yyptr); \
370
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
371
/* Copy COUNT objects from SRC to DST. The source and destination do
374
# if defined __GNUC__ && 1 < __GNUC__
375
# define YYCOPY(Dst, Src, Count) \
376
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
378
# define YYCOPY(Dst, Src, Count) \
382
for (yyi = 0; yyi < (Count); yyi++) \
383
(Dst)[yyi] = (Src)[yyi]; \
388
#endif /* !YYCOPY_NEEDED */
390
/* YYFINAL -- State number of the termination state. */
392
/* YYLAST -- Last index in YYTABLE. */
395
/* YYNTOKENS -- Number of terminals. */
397
/* YYNNTS -- Number of nonterminals. */
399
/* YYNRULES -- Number of rules. */
401
/* YYNSTATES -- Number of states. */
404
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
405
by yylex, with out-of-bounds checking. */
409
#define YYTRANSLATE(YYX) \
410
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
412
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
413
as returned by yylex, without out-of-bounds checking. */
414
static const yytype_uint8 yytranslate[] =
416
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420
28, 29, 24, 23, 2, 2, 2, 25, 2, 2,
421
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425
2, 2, 2, 2, 27, 2, 2, 2, 2, 2,
426
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
442
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
443
15, 16, 17, 18, 19, 20, 21, 22, 26
447
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
448
static const yytype_uint8 yyrline[] =
450
0, 34, 34, 35, 36, 37, 38, 39, 41, 42,
451
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
452
53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
453
65, 66, 67, 68, 69, 70, 72, 73
457
#if YYDEBUG || YYERROR_VERBOSE || 0
458
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
459
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
460
static const char *const yytname[] =
462
"$end", "error", "$undefined", "UNIT", "ONE", "NUM", "MINUSSIGN",
463
"ACOS", "ASIN", "ATAN", "ATAN2", "COS", "EXP", "ABS", "MOD", "LOG",
464
"LOG10", "POW", "SIN", "SINH", "TAN", "TANH", "SQRT", "'+'", "'*'",
465
"'/'", "NEG", "'^'", "'('", "')'", "$accept", "input", "num", "unit",
466
"quantity", YY_NULLPTR
471
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
472
(internal) symbol number NUM (which must be that of a token). */
473
static const yytype_uint16 yytoknum[] =
475
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
476
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
477
275, 276, 277, 43, 42, 47, 278, 94, 40, 41
481
#define YYPACT_NINF -26
483
#define yypact_value_is_default(Yystate) \
484
(!!((Yystate) == (-26)))
486
#define YYTABLE_NINF -1
488
#define yytable_value_is_error(Yytable_value) \
491
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
493
static const yytype_int16 yypact[] =
495
72, -26, -26, -26, 117, -25, -23, -10, -7, -5,
496
-4, -3, 21, 22, 23, 24, 26, 28, 72, 58,
497
92, -12, 117, -2, -26, 117, 35, 117, 117, 117,
498
117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
499
36, -18, -26, 39, 117, 117, 117, 72, 117, -2,
500
-12, -2, -2, 117, 92, 117, 41, 117, 80, 125,
501
134, 141, 149, 156, 163, 171, 178, 185, 193, 200,
502
207, -26, -26, -8, -8, 35, 35, -12, 35, 41,
503
41, -13, -26, -26, -26, -26, -26, -26, -26, -26,
504
-26, -26, -26, -26, -26, -26
507
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
508
Performed when YYTABLE does not specify something else to do. Zero
509
means the default is an error. */
510
static const yytype_uint8 yydefact[] =
512
2, 30, 9, 8, 0, 0, 0, 0, 0, 0,
513
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
514
3, 4, 5, 0, 9, 0, 14, 0, 0, 0,
515
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
516
0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
517
36, 0, 0, 0, 0, 6, 31, 0, 0, 0,
518
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
519
0, 16, 35, 11, 10, 12, 13, 37, 15, 32,
520
33, 34, 7, 17, 18, 19, 29, 21, 20, 22,
521
23, 24, 25, 26, 27, 28
524
/* YYPGOTO[NTERM-NUM]. */
525
static const yytype_int8 yypgoto[] =
530
/* YYDEFGOTO[NTERM-NUM]. */
531
static const yytype_int8 yydefgoto[] =
536
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
537
positive, shift that token. If negative, reduce the rule whose
538
number is the opposite. If YYTABLE_NINF, syntax error. */
539
static const yytype_uint8 yytable[] =
541
20, 1, 43, 27, 26, 28, 51, 52, 55, 53,
542
45, 72, 51, 52, 48, 53, 46, 57, 29, 48,
543
21, 30, 54, 31, 32, 33, 49, 58, 59, 60,
544
61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
545
50, 82, 44, 56, 73, 74, 75, 76, 78, 34,
546
35, 36, 37, 81, 38, 54, 39, 76, 42, 45,
547
46, 57, 48, 48, 23, 71, 0, 77, 53, 0,
548
0, 79, 80, 0, 50, 1, 2, 3, 4, 5,
549
6, 7, 0, 8, 9, 10, 44, 11, 12, 0,
550
13, 14, 15, 16, 17, 1, 43, 0, 44, 0,
551
18, 0, 0, 45, 46, 57, 0, 48, 0, 83,
552
0, 0, 0, 0, 0, 45, 46, 47, 0, 48,
553
49, 24, 3, 4, 5, 6, 7, 0, 8, 9,
554
10, 44, 11, 12, 0, 13, 14, 15, 16, 17,
555
44, 0, 0, 0, 0, 25, 0, 44, 45, 46,
556
57, 0, 48, 0, 84, 44, 0, 45, 46, 57,
557
0, 48, 44, 85, 45, 46, 57, 0, 48, 44,
558
86, 0, 45, 46, 57, 0, 48, 44, 87, 45,
559
46, 57, 0, 48, 44, 88, 45, 46, 57, 0,
560
48, 44, 89, 0, 45, 46, 57, 0, 48, 44,
561
90, 45, 46, 57, 0, 48, 44, 91, 45, 46,
562
57, 0, 48, 44, 92, 0, 45, 46, 57, 0,
563
48, 0, 93, 45, 46, 57, 0, 48, 0, 94,
564
45, 46, 57, 0, 48, 0, 95
567
static const yytype_int8 yycheck[] =
569
0, 3, 4, 28, 4, 28, 24, 25, 22, 27,
570
23, 29, 24, 25, 27, 27, 24, 25, 28, 27,
571
0, 28, 22, 28, 28, 28, 28, 27, 28, 29,
572
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
573
20, 55, 6, 23, 44, 45, 46, 47, 48, 28,
574
28, 28, 28, 53, 28, 55, 28, 57, 0, 23,
575
24, 25, 27, 27, 25, 29, -1, 47, 27, -1,
576
-1, 51, 52, -1, 54, 3, 4, 5, 6, 7,
577
8, 9, -1, 11, 12, 13, 6, 15, 16, -1,
578
18, 19, 20, 21, 22, 3, 4, -1, 6, -1,
579
28, -1, -1, 23, 24, 25, -1, 27, -1, 29,
580
-1, -1, -1, -1, -1, 23, 24, 25, -1, 27,
581
28, 4, 5, 6, 7, 8, 9, -1, 11, 12,
582
13, 6, 15, 16, -1, 18, 19, 20, 21, 22,
583
6, -1, -1, -1, -1, 28, -1, 6, 23, 24,
584
25, -1, 27, -1, 29, 6, -1, 23, 24, 25,
585
-1, 27, 6, 29, 23, 24, 25, -1, 27, 6,
586
29, -1, 23, 24, 25, -1, 27, 6, 29, 23,
587
24, 25, -1, 27, 6, 29, 23, 24, 25, -1,
588
27, 6, 29, -1, 23, 24, 25, -1, 27, 6,
589
29, 23, 24, 25, -1, 27, 6, 29, 23, 24,
590
25, -1, 27, 6, 29, -1, 23, 24, 25, -1,
591
27, -1, 29, 23, 24, 25, -1, 27, -1, 29,
592
23, 24, 25, -1, 27, -1, 29
595
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
596
symbol of state STATE-NUM. */
597
static const yytype_uint8 yystos[] =
599
0, 3, 4, 5, 6, 7, 8, 9, 11, 12,
600
13, 15, 16, 18, 19, 20, 21, 22, 28, 31,
601
32, 33, 34, 25, 4, 28, 32, 28, 28, 28,
602
28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
603
32, 33, 0, 4, 6, 23, 24, 25, 27, 28,
604
33, 24, 25, 27, 32, 34, 33, 25, 32, 32,
605
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
606
32, 29, 29, 32, 32, 32, 32, 33, 32, 33,
607
33, 32, 34, 29, 29, 29, 29, 29, 29, 29,
608
29, 29, 29, 29, 29, 29
611
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
612
static const yytype_uint8 yyr1[] =
614
0, 30, 31, 31, 31, 31, 31, 31, 32, 32,
615
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
616
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
617
33, 33, 33, 33, 33, 33, 34, 34
620
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
621
static const yytype_uint8 yyr2[] =
623
0, 2, 0, 1, 1, 1, 2, 3, 1, 1,
624
3, 3, 3, 3, 2, 3, 3, 4, 4, 4,
625
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
626
1, 3, 3, 3, 3, 3, 2, 3
630
#define yyerrok (yyerrstatus = 0)
631
#define yyclearin (yychar = YYEMPTY)
635
#define YYACCEPT goto yyacceptlab
636
#define YYABORT goto yyabortlab
637
#define YYERROR goto yyerrorlab
640
#define YYRECOVERING() (!!yyerrstatus)
642
#define YYBACKUP(Token, Value) \
644
if (yychar == YYEMPTY) \
648
YYPOPSTACK (yylen); \
654
yyerror (YY_("syntax error: cannot back up")); \
659
/* Error token number */
665
/* Enable debugging if requested. */
669
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
670
# define YYFPRINTF fprintf
673
# define YYDPRINTF(Args) \
679
/* This macro is provided for backward compatibility. */
680
#ifndef YY_LOCATION_PRINT
681
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
685
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
689
YYFPRINTF (stderr, "%s ", Title); \
690
yy_symbol_print (stderr, \
692
YYFPRINTF (stderr, "\n"); \
697
/*----------------------------------------.
698
| Print this symbol's value on YYOUTPUT. |
699
`----------------------------------------*/
702
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
704
FILE *yyo = yyoutput;
709
if (yytype < YYNTOKENS)
710
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
716
/*--------------------------------.
717
| Print this symbol on YYOUTPUT. |
718
`--------------------------------*/
721
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
723
YYFPRINTF (yyoutput, "%s %s (",
724
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
726
yy_symbol_value_print (yyoutput, yytype, yyvaluep);
727
YYFPRINTF (yyoutput, ")");
730
/*------------------------------------------------------------------.
731
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
733
`------------------------------------------------------------------*/
736
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
738
YYFPRINTF (stderr, "Stack now");
739
for (; yybottom <= yytop; yybottom++)
741
int yybot = *yybottom;
742
YYFPRINTF (stderr, " %d", yybot);
744
YYFPRINTF (stderr, "\n");
747
# define YY_STACK_PRINT(Bottom, Top) \
750
yy_stack_print ((Bottom), (Top)); \
754
/*------------------------------------------------.
755
| Report that the YYRULE is going to be reduced. |
756
`------------------------------------------------*/
759
yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
761
unsigned long int yylno = yyrline[yyrule];
762
int yynrhs = yyr2[yyrule];
764
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
766
/* The symbols being reduced. */
767
for (yyi = 0; yyi < yynrhs; yyi++)
769
YYFPRINTF (stderr, " $%d = ", yyi + 1);
770
yy_symbol_print (stderr,
771
yystos[yyssp[yyi + 1 - yynrhs]],
772
&(yyvsp[(yyi + 1) - (yynrhs)])
774
YYFPRINTF (stderr, "\n");
778
# define YY_REDUCE_PRINT(Rule) \
781
yy_reduce_print (yyssp, yyvsp, Rule); \
784
/* Nonzero means print parse trace. It is left uninitialized so that
785
multiple parsers can coexist. */
788
# define YYDPRINTF(Args)
789
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
790
# define YY_STACK_PRINT(Bottom, Top)
791
# define YY_REDUCE_PRINT(Rule)
795
/* YYINITDEPTH -- initial size of the parser's stacks. */
797
# define YYINITDEPTH 200
800
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
801
if the built-in stack extension method is used).
803
Do not make this value too large; the results are undefined if
804
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
805
evaluated with infinite-precision integer arithmetic. */
808
# define YYMAXDEPTH 10000
815
# if defined __GLIBC__ && defined _STRING_H
816
# define yystrlen strlen
818
/* Return the length of YYSTR. */
820
yystrlen (const char *yystr)
823
for (yylen = 0; yystr[yylen]; yylen++)
831
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
832
# define yystpcpy stpcpy
834
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
837
yystpcpy (char *yydest, const char *yysrc)
840
const char *yys = yysrc;
842
while ((*yyd++ = *yys++) != '\0')
851
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
852
quotes and backslashes, so that it's suitable for yyerror. The
853
heuristic is that double-quoting is unnecessary unless the string
854
contains an apostrophe, a comma, or backslash (other than
855
backslash-backslash). YYSTR is taken from yytname. If YYRES is
856
null, do not copy; instead, return the length of what the result
859
yytnamerr (char *yyres, const char *yystr)
864
char const *yyp = yystr;
871
goto do_not_strip_quotes;
875
goto do_not_strip_quotes;
888
do_not_strip_quotes: ;
892
return yystrlen (yystr);
894
return yystpcpy (yyres, yystr) - yyres;
898
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
899
about the unexpected token YYTOKEN for the state stack whose top is
902
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
903
not large enough to hold the message. In that case, also set
904
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
905
required number of bytes is too large to store. */
907
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
908
yytype_int16 *yyssp, int yytoken)
910
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
911
YYSIZE_T yysize = yysize0;
912
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
913
/* Internationalized format string. */
914
const char *yyformat = YY_NULLPTR;
915
/* Arguments of yyformat. */
916
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
917
/* Number of reported tokens (one for the "unexpected", one per
921
/* There are many possibilities here to consider:
922
- If this state is a consistent state with a default action, then
923
the only way this function was invoked is if the default action
924
is an error action. In that case, don't check for expected
925
tokens because there are none.
926
- The only way there can be no lookahead present (in yychar) is if
927
this state is a consistent state with a default action. Thus,
928
detecting the absence of a lookahead is sufficient to determine
929
that there is no unexpected or expected token to report. In that
930
case, just report a simple "syntax error".
931
- Don't assume there isn't a lookahead just because this state is a
932
consistent state with a default action. There might have been a
933
previous inconsistent state, consistent state with a non-default
934
action, or user semantic action that manipulated yychar.
935
- Of course, the expected token list depends on states to have
936
correct lookahead information, and it depends on the parser not
937
to perform extra reductions after fetching a lookahead from the
938
scanner and before detecting a syntax error. Thus, state merging
939
(from LALR or IELR) and default reductions corrupt the expected
940
token list. However, the list is correct for canonical LR with
941
one exception: it will still contain any token that will not be
942
accepted due to an error action in a later state.
944
if (yytoken != YYEMPTY)
946
int yyn = yypact[*yyssp];
947
yyarg[yycount++] = yytname[yytoken];
948
if (!yypact_value_is_default (yyn))
950
/* Start YYX at -YYN if negative to avoid negative indexes in
951
YYCHECK. In other words, skip the first -YYN actions for
952
this state because they are default actions. */
953
int yyxbegin = yyn < 0 ? -yyn : 0;
954
/* Stay within bounds of both yycheck and yytname. */
955
int yychecklim = YYLAST - yyn + 1;
956
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
959
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
960
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
961
&& !yytable_value_is_error (yytable[yyx + yyn]))
963
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
969
yyarg[yycount++] = yytname[yyx];
971
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
972
if (! (yysize <= yysize1
973
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
983
# define YYCASE_(N, S) \
987
YYCASE_(0, YY_("syntax error"));
988
YYCASE_(1, YY_("syntax error, unexpected %s"));
989
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
990
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
991
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
992
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
997
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
998
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1003
if (*yymsg_alloc < yysize)
1005
*yymsg_alloc = 2 * yysize;
1006
if (! (yysize <= *yymsg_alloc
1007
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1008
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1012
/* Avoid sprintf, as that infringes on the user's name space.
1013
Don't have undefined behavior even if the translation
1014
produced a string with the wrong number of "%s"s. */
1018
while ((*yyp = *yyformat) != '\0')
1019
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1021
yyp += yytnamerr (yyp, yyarg[yyi++]);
1032
#endif /* YYERROR_VERBOSE */
1034
/*-----------------------------------------------.
1035
| Release the memory associated to this symbol. |
1036
`-----------------------------------------------*/
1039
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1044
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1046
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1048
YY_IGNORE_MAYBE_UNINITIALIZED_END
1054
/* The lookahead symbol. */
1057
/* The semantic value of the lookahead symbol. */
1059
/* Number of syntax errors so far. */
1071
/* Number of tokens to shift before error messages enabled. */
1074
/* The stacks and their tools:
1075
'yyss': related to states.
1076
'yyvs': related to semantic values.
1078
Refer to the stacks through separate pointers, to allow yyoverflow
1079
to reallocate them elsewhere. */
1081
/* The state stack. */
1082
yytype_int16 yyssa[YYINITDEPTH];
1084
yytype_int16 *yyssp;
1086
/* The semantic value stack. */
1087
YYSTYPE yyvsa[YYINITDEPTH];
1091
YYSIZE_T yystacksize;
1095
/* Lookahead token as an internal (translated) token number. */
1097
/* The variables used to return semantic value and location from the
1102
/* Buffer for error messages, and its allocated size. */
1104
char *yymsg = yymsgbuf;
1105
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1108
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1110
/* The number of symbols on the RHS of the reduced rule.
1111
Keep to zero when no symbol should be popped. */
1114
yyssp = yyss = yyssa;
1115
yyvsp = yyvs = yyvsa;
1116
yystacksize = YYINITDEPTH;
1118
YYDPRINTF ((stderr, "Starting parse\n"));
1123
yychar = YYEMPTY; /* Cause a token to be read. */
1126
/*------------------------------------------------------------.
1127
| yynewstate -- Push a new state, which is found in yystate. |
1128
`------------------------------------------------------------*/
1130
/* In all cases, when you get here, the value and location stacks
1131
have just been pushed. So pushing a state here evens the stacks. */
1137
if (yyss + yystacksize - 1 <= yyssp)
1139
/* Get the current used size of the three stacks, in elements. */
1140
YYSIZE_T yysize = yyssp - yyss + 1;
1144
/* Give user a chance to reallocate the stack. Use copies of
1145
these so that the &'s don't force the real ones into
1147
YYSTYPE *yyvs1 = yyvs;
1148
yytype_int16 *yyss1 = yyss;
1150
/* Each stack pointer address is followed by the size of the
1151
data in use in that stack, in bytes. This used to be a
1152
conditional around just the two extra args, but that might
1153
be undefined if yyoverflow is a macro. */
1154
yyoverflow (YY_("memory exhausted"),
1155
&yyss1, yysize * sizeof (*yyssp),
1156
&yyvs1, yysize * sizeof (*yyvsp),
1162
#else /* no yyoverflow */
1163
# ifndef YYSTACK_RELOCATE
1164
goto yyexhaustedlab;
1166
/* Extend the stack our own way. */
1167
if (YYMAXDEPTH <= yystacksize)
1168
goto yyexhaustedlab;
1170
if (YYMAXDEPTH < yystacksize)
1171
yystacksize = YYMAXDEPTH;
1174
yytype_int16 *yyss1 = yyss;
1175
union yyalloc *yyptr =
1176
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1178
goto yyexhaustedlab;
1179
YYSTACK_RELOCATE (yyss_alloc, yyss);
1180
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1181
# undef YYSTACK_RELOCATE
1183
YYSTACK_FREE (yyss1);
1186
#endif /* no yyoverflow */
1188
yyssp = yyss + yysize - 1;
1189
yyvsp = yyvs + yysize - 1;
1191
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1192
(unsigned long int) yystacksize));
1194
if (yyss + yystacksize - 1 <= yyssp)
1198
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1200
if (yystate == YYFINAL)
1210
/* Do appropriate processing given the current state. Read a
1211
lookahead token if we need one and don't already have one. */
1213
/* First try to decide what to do without reference to lookahead token. */
1214
yyn = yypact[yystate];
1215
if (yypact_value_is_default (yyn))
1218
/* Not known => get a lookahead token if don't already have one. */
1220
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1221
if (yychar == YYEMPTY)
1223
YYDPRINTF ((stderr, "Reading a token: "));
1227
if (yychar <= YYEOF)
1229
yychar = yytoken = YYEOF;
1230
YYDPRINTF ((stderr, "Now at end of input.\n"));
1234
yytoken = YYTRANSLATE (yychar);
1235
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1238
/* If the proper action on seeing token YYTOKEN is to reduce or to
1239
detect an error, take that action. */
1241
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1246
if (yytable_value_is_error (yyn))
1252
/* Count tokens shifted since error; after three, turn off error
1257
/* Shift the lookahead token. */
1258
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1260
/* Discard the shifted token. */
1264
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1266
YY_IGNORE_MAYBE_UNINITIALIZED_END
1271
/*-----------------------------------------------------------.
1272
| yydefault -- do the default action for the current state. |
1273
`-----------------------------------------------------------*/
1275
yyn = yydefact[yystate];
1281
/*-----------------------------.
1282
| yyreduce -- Do a reduction. |
1283
`-----------------------------*/
1285
/* yyn is the number of a rule to reduce with. */
1288
/* If YYLEN is nonzero, implement the default value of the action:
1291
Otherwise, the following line sets YYVAL to garbage.
1292
This behavior is undocumented and Bison
1293
users should not rely upon it. Assigning to YYVAL
1294
unconditionally makes the parser a bit smaller, and it avoids a
1295
GCC warning that YYVAL may be used uninitialized. */
1296
yyval = yyvsp[1-yylen];
1299
YY_REDUCE_PRINT (yyn);
1303
#line 34 "QuantityParser.y" /* yacc.c:1646 */
1304
{ QuantResult = Quantity(DOUBLE_MIN); /* empty input */ }
1305
#line 1305 "QuantityParser.c" /* yacc.c:1646 */
1309
#line 35 "QuantityParser.y" /* yacc.c:1646 */
1310
{ QuantResult = (yyvsp[0]) ; }
1311
#line 1311 "QuantityParser.c" /* yacc.c:1646 */
1315
#line 36 "QuantityParser.y" /* yacc.c:1646 */
1316
{ QuantResult = (yyvsp[0]) ; }
1317
#line 1317 "QuantityParser.c" /* yacc.c:1646 */
1321
#line 37 "QuantityParser.y" /* yacc.c:1646 */
1322
{ QuantResult = (yyvsp[0]) ; }
1323
#line 1323 "QuantityParser.c" /* yacc.c:1646 */
1327
#line 38 "QuantityParser.y" /* yacc.c:1646 */
1328
{ QuantResult = (yyvsp[-1]) + (yyvsp[0]); }
1329
#line 1329 "QuantityParser.c" /* yacc.c:1646 */
1333
#line 39 "QuantityParser.y" /* yacc.c:1646 */
1334
{ QuantResult = (yyvsp[-2]) + (yyvsp[-1]) + (yyvsp[0]); }
1335
#line 1335 "QuantityParser.c" /* yacc.c:1646 */
1339
#line 41 "QuantityParser.y" /* yacc.c:1646 */
1340
{ (yyval) = (yyvsp[0]); }
1341
#line 1341 "QuantityParser.c" /* yacc.c:1646 */
1345
#line 42 "QuantityParser.y" /* yacc.c:1646 */
1346
{ (yyval) = (yyvsp[0]); }
1347
#line 1347 "QuantityParser.c" /* yacc.c:1646 */
1351
#line 43 "QuantityParser.y" /* yacc.c:1646 */
1352
{ (yyval) = Quantity((yyvsp[-2]).getValue() + (yyvsp[0]).getValue()); }
1353
#line 1353 "QuantityParser.c" /* yacc.c:1646 */
1357
#line 44 "QuantityParser.y" /* yacc.c:1646 */
1358
{ (yyval) = Quantity((yyvsp[-2]).getValue() - (yyvsp[0]).getValue()); }
1359
#line 1359 "QuantityParser.c" /* yacc.c:1646 */
1363
#line 45 "QuantityParser.y" /* yacc.c:1646 */
1364
{ (yyval) = Quantity((yyvsp[-2]).getValue() * (yyvsp[0]).getValue()); }
1365
#line 1365 "QuantityParser.c" /* yacc.c:1646 */
1369
#line 46 "QuantityParser.y" /* yacc.c:1646 */
1370
{ (yyval) = Quantity((yyvsp[-2]).getValue() / (yyvsp[0]).getValue()); }
1371
#line 1371 "QuantityParser.c" /* yacc.c:1646 */
1375
#line 47 "QuantityParser.y" /* yacc.c:1646 */
1376
{ (yyval) = Quantity(-(yyvsp[0]).getValue()); }
1377
#line 1377 "QuantityParser.c" /* yacc.c:1646 */
1381
#line 48 "QuantityParser.y" /* yacc.c:1646 */
1382
{ (yyval) = Quantity(pow ((yyvsp[-2]).getValue(), (yyvsp[0]).getValue()));}
1383
#line 1383 "QuantityParser.c" /* yacc.c:1646 */
1387
#line 49 "QuantityParser.y" /* yacc.c:1646 */
1388
{ (yyval) = (yyvsp[-1]); }
1389
#line 1389 "QuantityParser.c" /* yacc.c:1646 */
1393
#line 50 "QuantityParser.y" /* yacc.c:1646 */
1394
{ (yyval) = Quantity(acos((yyvsp[-1]).getValue())); }
1395
#line 1395 "QuantityParser.c" /* yacc.c:1646 */
1399
#line 51 "QuantityParser.y" /* yacc.c:1646 */
1400
{ (yyval) = Quantity(asin((yyvsp[-1]).getValue())); }
1401
#line 1401 "QuantityParser.c" /* yacc.c:1646 */
1405
#line 52 "QuantityParser.y" /* yacc.c:1646 */
1406
{ (yyval) = Quantity(atan((yyvsp[-1]).getValue())); }
1407
#line 1407 "QuantityParser.c" /* yacc.c:1646 */
1411
#line 53 "QuantityParser.y" /* yacc.c:1646 */
1412
{ (yyval) = Quantity(fabs((yyvsp[-1]).getValue())); }
1413
#line 1413 "QuantityParser.c" /* yacc.c:1646 */
1417
#line 54 "QuantityParser.y" /* yacc.c:1646 */
1418
{ (yyval) = Quantity(exp((yyvsp[-1]).getValue())); }
1419
#line 1419 "QuantityParser.c" /* yacc.c:1646 */
1423
#line 55 "QuantityParser.y" /* yacc.c:1646 */
1424
{ (yyval) = Quantity(log((yyvsp[-1]).getValue())); }
1425
#line 1425 "QuantityParser.c" /* yacc.c:1646 */
1429
#line 56 "QuantityParser.y" /* yacc.c:1646 */
1430
{ (yyval) = Quantity(log10((yyvsp[-1]).getValue())); }
1431
#line 1431 "QuantityParser.c" /* yacc.c:1646 */
1435
#line 57 "QuantityParser.y" /* yacc.c:1646 */
1436
{ (yyval) = Quantity(sin((yyvsp[-1]).getValue())); }
1437
#line 1437 "QuantityParser.c" /* yacc.c:1646 */
1441
#line 58 "QuantityParser.y" /* yacc.c:1646 */
1442
{ (yyval) = Quantity(sinh((yyvsp[-1]).getValue())); }
1443
#line 1443 "QuantityParser.c" /* yacc.c:1646 */
1447
#line 59 "QuantityParser.y" /* yacc.c:1646 */
1448
{ (yyval) = Quantity(tan((yyvsp[-1]).getValue())); }
1449
#line 1449 "QuantityParser.c" /* yacc.c:1646 */
1453
#line 60 "QuantityParser.y" /* yacc.c:1646 */
1454
{ (yyval) = Quantity(tanh((yyvsp[-1]).getValue())); }
1455
#line 1455 "QuantityParser.c" /* yacc.c:1646 */
1459
#line 61 "QuantityParser.y" /* yacc.c:1646 */
1460
{ (yyval) = Quantity(sqrt((yyvsp[-1]).getValue())); }
1461
#line 1461 "QuantityParser.c" /* yacc.c:1646 */
1465
#line 62 "QuantityParser.y" /* yacc.c:1646 */
1466
{ (yyval) = Quantity(cos((yyvsp[-1]).getValue())); }
1467
#line 1467 "QuantityParser.c" /* yacc.c:1646 */
1471
#line 65 "QuantityParser.y" /* yacc.c:1646 */
1472
{ (yyval) = (yyvsp[0]); }
1473
#line 1473 "QuantityParser.c" /* yacc.c:1646 */
1477
#line 66 "QuantityParser.y" /* yacc.c:1646 */
1478
{ (yyval) = Quantity(1.0)/(yyvsp[0]); }
1479
#line 1479 "QuantityParser.c" /* yacc.c:1646 */
1483
#line 67 "QuantityParser.y" /* yacc.c:1646 */
1484
{ (yyval) = (yyvsp[-2]) * (yyvsp[0]); }
1485
#line 1485 "QuantityParser.c" /* yacc.c:1646 */
1489
#line 68 "QuantityParser.y" /* yacc.c:1646 */
1490
{ (yyval) = (yyvsp[-2]) / (yyvsp[0]); }
1491
#line 1491 "QuantityParser.c" /* yacc.c:1646 */
1495
#line 69 "QuantityParser.y" /* yacc.c:1646 */
1496
{ (yyval) = (yyvsp[-2]).pow ((yyvsp[0])); }
1497
#line 1497 "QuantityParser.c" /* yacc.c:1646 */
1501
#line 70 "QuantityParser.y" /* yacc.c:1646 */
1502
{ (yyval) = (yyvsp[-1]); }
1503
#line 1503 "QuantityParser.c" /* yacc.c:1646 */
1507
#line 72 "QuantityParser.y" /* yacc.c:1646 */
1508
{ (yyval) = (yyvsp[-1])*(yyvsp[0]); }
1509
#line 1509 "QuantityParser.c" /* yacc.c:1646 */
1513
#line 73 "QuantityParser.y" /* yacc.c:1646 */
1514
{ (yyval) = Quantity((yyvsp[-2]))/(yyvsp[0]); }
1515
#line 1515 "QuantityParser.c" /* yacc.c:1646 */
1519
#line 1519 "QuantityParser.c" /* yacc.c:1646 */
1522
/* User semantic actions sometimes alter yychar, and that requires
1523
that yytoken be updated with the new translation. We take the
1524
approach of translating immediately before every use of yytoken.
1525
One alternative is translating here after every semantic action,
1526
but that translation would be missed if the semantic action invokes
1527
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1528
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1529
incorrect destructor might then be invoked immediately. In the
1530
case of YYERROR or YYBACKUP, subsequent parser actions might lead
1531
to an incorrect destructor call or verbose syntax error message
1532
before the lookahead is translated. */
1533
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1537
YY_STACK_PRINT (yyss, yyssp);
1541
/* Now 'shift' the result of the reduction. Determine what state
1542
that goes to, based on the state we popped back to and the rule
1543
number reduced by. */
1547
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1548
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1549
yystate = yytable[yystate];
1551
yystate = yydefgoto[yyn - YYNTOKENS];
1556
/*--------------------------------------.
1557
| yyerrlab -- here on detecting error. |
1558
`--------------------------------------*/
1560
/* Make sure we have latest lookahead translation. See comments at
1561
user semantic actions for why this is necessary. */
1562
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1564
/* If not already recovering from an error, report this error. */
1568
#if ! YYERROR_VERBOSE
1569
yyerror (YY_("syntax error"));
1571
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1574
char const *yymsgp = YY_("syntax error");
1575
int yysyntax_error_status;
1576
yysyntax_error_status = YYSYNTAX_ERROR;
1577
if (yysyntax_error_status == 0)
1579
else if (yysyntax_error_status == 1)
1581
if (yymsg != yymsgbuf)
1582
YYSTACK_FREE (yymsg);
1583
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1587
yymsg_alloc = sizeof yymsgbuf;
1588
yysyntax_error_status = 2;
1592
yysyntax_error_status = YYSYNTAX_ERROR;
1597
if (yysyntax_error_status == 2)
1598
goto yyexhaustedlab;
1600
# undef YYSYNTAX_ERROR
1606
if (yyerrstatus == 3)
1608
/* If just tried and failed to reuse lookahead token after an
1609
error, discard it. */
1611
if (yychar <= YYEOF)
1613
/* Return failure if at end of input. */
1614
if (yychar == YYEOF)
1619
yydestruct ("Error: discarding",
1625
/* Else will try to reuse lookahead token after shifting the error
1630
/*---------------------------------------------------.
1631
| yyerrorlab -- error raised explicitly by YYERROR. |
1632
`---------------------------------------------------*/
1635
/* Pacify compilers like GCC when the user code never invokes
1636
YYERROR and the label yyerrorlab therefore never appears in user
1638
if (/*CONSTCOND*/ 0)
1641
/* Do not reclaim the symbols of the rule whose action triggered
1645
YY_STACK_PRINT (yyss, yyssp);
1650
/*-------------------------------------------------------------.
1651
| yyerrlab1 -- common code for both syntax error and YYERROR. |
1652
`-------------------------------------------------------------*/
1654
yyerrstatus = 3; /* Each real token shifted decrements this. */
1658
yyn = yypact[yystate];
1659
if (!yypact_value_is_default (yyn))
1662
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1670
/* Pop the current state because it cannot handle the error token. */
1675
yydestruct ("Error: popping",
1676
yystos[yystate], yyvsp);
1679
YY_STACK_PRINT (yyss, yyssp);
1682
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1684
YY_IGNORE_MAYBE_UNINITIALIZED_END
1687
/* Shift the error token. */
1688
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1694
/*-------------------------------------.
1695
| yyacceptlab -- YYACCEPT comes here. |
1696
`-------------------------------------*/
1701
/*-----------------------------------.
1702
| yyabortlab -- YYABORT comes here. |
1703
`-----------------------------------*/
1708
#if !defined yyoverflow || YYERROR_VERBOSE
1709
/*-------------------------------------------------.
1710
| yyexhaustedlab -- memory exhaustion comes here. |
1711
`-------------------------------------------------*/
1713
yyerror (YY_("memory exhausted"));
1719
if (yychar != YYEMPTY)
1721
/* Make sure we have latest lookahead translation. See comments at
1722
user semantic actions for why this is necessary. */
1723
yytoken = YYTRANSLATE (yychar);
1724
yydestruct ("Cleanup: discarding lookahead",
1727
/* Do not reclaim the symbols of the rule whose action triggered
1728
this YYABORT or YYACCEPT. */
1730
YY_STACK_PRINT (yyss, yyssp);
1731
while (yyssp != yyss)
1733
yydestruct ("Cleanup: popping",
1734
yystos[*yyssp], yyvsp);
1739
YYSTACK_FREE (yyss);
1742
if (yymsg != yymsgbuf)
1743
YYSTACK_FREE (yymsg);
1747
#line 77 "QuantityParser.y" /* yacc.c:1906 */