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