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