Debian Codegraph @

src/Base/Quantity.tab.c

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