readcf.cc
Go to the documentation of this file.
1 /* A Bison parser, made by GNU Bison 3.0.4. */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5  Copyright (C) 1984, 1989-1990, 2000-2015 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.4"
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  YYCASE_(0, YY_("syntax error"));
946  YYCASE_(1, YY_("syntax error, unexpected %s"));
947  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
948  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
949  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
950  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
951 # undef YYCASE_
952  }
953 
954  {
955  YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
956  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
957  return 2;
958  yysize = yysize1;
959  }
960 
961  if (*yymsg_alloc < yysize)
962  {
963  *yymsg_alloc = 2 * yysize;
964  if (! (yysize <= *yymsg_alloc
965  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
966  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
967  return 1;
968  }
969 
970  /* Avoid sprintf, as that infringes on the user's name space.
971  Don't have undefined behavior even if the translation
972  produced a string with the wrong number of "%s"s. */
973  {
974  char *yyp = *yymsg;
975  int yyi = 0;
976  while ((*yyp = *yyformat) != '\0')
977  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
978  {
979  yyp += yytnamerr (yyp, yyarg[yyi++]);
980  yyformat += 2;
981  }
982  else
983  {
984  yyp++;
985  yyformat++;
986  }
987  }
988  return 0;
989 }
990 #endif /* YYERROR_VERBOSE */
991 
992 /*-----------------------------------------------.
993 | Release the memory associated to this symbol. |
994 `-----------------------------------------------*/
995 
996 static void
997 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
998 {
999  YYUSE (yyvaluep);
1000  if (!yymsg)
1001  yymsg = "Deleting";
1002  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1003 
1005  YYUSE (yytype);
1007 }
1008 
1009 
1010 
1011 
1012 /* The lookahead symbol. */
1014 
1015 /* The semantic value of the lookahead symbol. */
1017 /* Number of syntax errors so far. */
1019 
1020 
1021 /*----------.
1022 | yyparse. |
1023 `----------*/
1024 
1025 int
1026 yyparse (void)
1027 {
1028  int yystate;
1029  /* Number of tokens to shift before error messages enabled. */
1030  int yyerrstatus;
1031 
1032  /* The stacks and their tools:
1033  'yyss': related to states.
1034  'yyvs': related to semantic values.
1035 
1036  Refer to the stacks through separate pointers, to allow yyoverflow
1037  to reallocate them elsewhere. */
1038 
1039  /* The state stack. */
1040  yytype_int16 yyssa[YYINITDEPTH];
1041  yytype_int16 *yyss;
1042  yytype_int16 *yyssp;
1043 
1044  /* The semantic value stack. */
1045  YYSTYPE yyvsa[YYINITDEPTH];
1046  YYSTYPE *yyvs;
1047  YYSTYPE *yyvsp;
1048 
1049  YYSIZE_T yystacksize;
1050 
1051  int yyn;
1052  int yyresult;
1053  /* Lookahead token as an internal (translated) token number. */
1054  int yytoken = 0;
1055  /* The variables used to return semantic value and location from the
1056  action routines. */
1057  YYSTYPE yyval;
1058 
1059 #if YYERROR_VERBOSE
1060  /* Buffer for error messages, and its allocated size. */
1061  char yymsgbuf[128];
1062  char *yymsg = yymsgbuf;
1063  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1064 #endif
1065 
1066 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1067 
1068  /* The number of symbols on the RHS of the reduced rule.
1069  Keep to zero when no symbol should be popped. */
1070  int yylen = 0;
1071 
1072  yyssp = yyss = yyssa;
1073  yyvsp = yyvs = yyvsa;
1074  yystacksize = YYINITDEPTH;
1075 
1076  YYDPRINTF ((stderr, "Starting parse\n"));
1077 
1078  yystate = 0;
1079  yyerrstatus = 0;
1080  yynerrs = 0;
1081  yychar = YYEMPTY; /* Cause a token to be read. */
1082  goto yysetstate;
1083 
1084 /*------------------------------------------------------------.
1085 | yynewstate -- Push a new state, which is found in yystate. |
1086 `------------------------------------------------------------*/
1087  yynewstate:
1088  /* In all cases, when you get here, the value and location stacks
1089  have just been pushed. So pushing a state here evens the stacks. */
1090  yyssp++;
1091 
1092  yysetstate:
1093  *yyssp = yystate;
1094 
1095  if (yyss + yystacksize - 1 <= yyssp)
1096  {
1097  /* Get the current used size of the three stacks, in elements. */
1098  YYSIZE_T yysize = yyssp - yyss + 1;
1099 
1100 #ifdef yyoverflow
1101  {
1102  /* Give user a chance to reallocate the stack. Use copies of
1103  these so that the &'s don't force the real ones into
1104  memory. */
1105  YYSTYPE *yyvs1 = yyvs;
1106  yytype_int16 *yyss1 = yyss;
1107 
1108  /* Each stack pointer address is followed by the size of the
1109  data in use in that stack, in bytes. This used to be a
1110  conditional around just the two extra args, but that might
1111  be undefined if yyoverflow is a macro. */
1112  yyoverflow (YY_("memory exhausted"),
1113  &yyss1, yysize * sizeof (*yyssp),
1114  &yyvs1, yysize * sizeof (*yyvsp),
1115  &yystacksize);
1116 
1117  yyss = yyss1;
1118  yyvs = yyvs1;
1119  }
1120 #else /* no yyoverflow */
1121 # ifndef YYSTACK_RELOCATE
1122  goto yyexhaustedlab;
1123 # else
1124  /* Extend the stack our own way. */
1125  if (YYMAXDEPTH <= yystacksize)
1126  goto yyexhaustedlab;
1127  yystacksize *= 2;
1128  if (YYMAXDEPTH < yystacksize)
1129  yystacksize = YYMAXDEPTH;
1130 
1131  {
1132  yytype_int16 *yyss1 = yyss;
1133  union yyalloc *yyptr =
1134  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1135  if (! yyptr)
1136  goto yyexhaustedlab;
1137  YYSTACK_RELOCATE (yyss_alloc, yyss);
1138  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1139 # undef YYSTACK_RELOCATE
1140  if (yyss1 != yyssa)
1141  YYSTACK_FREE (yyss1);
1142  }
1143 # endif
1144 #endif /* no yyoverflow */
1145 
1146  yyssp = yyss + yysize - 1;
1147  yyvsp = yyvs + yysize - 1;
1148 
1149  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1150  (unsigned long int) yystacksize));
1151 
1152  if (yyss + yystacksize - 1 <= yyssp)
1153  YYABORT;
1154  }
1155 
1156  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1157 
1158  if (yystate == YYFINAL)
1159  YYACCEPT;
1160 
1161  goto yybackup;
1162 
1163 /*-----------.
1164 | yybackup. |
1165 `-----------*/
1166 yybackup:
1167 
1168  /* Do appropriate processing given the current state. Read a
1169  lookahead token if we need one and don't already have one. */
1170 
1171  /* First try to decide what to do without reference to lookahead token. */
1172  yyn = yypact[yystate];
1173  if (yypact_value_is_default (yyn))
1174  goto yydefault;
1175 
1176  /* Not known => get a lookahead token if don't already have one. */
1177 
1178  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1179  if (yychar == YYEMPTY)
1180  {
1181  YYDPRINTF ((stderr, "Reading a token: "));
1182  yychar = yylex ();
1183  }
1184 
1185  if (yychar <= YYEOF)
1186  {
1187  yychar = yytoken = YYEOF;
1188  YYDPRINTF ((stderr, "Now at end of input.\n"));
1189  }
1190  else
1191  {
1192  yytoken = YYTRANSLATE (yychar);
1193  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1194  }
1195 
1196  /* If the proper action on seeing token YYTOKEN is to reduce or to
1197  detect an error, take that action. */
1198  yyn += yytoken;
1199  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1200  goto yydefault;
1201  yyn = yytable[yyn];
1202  if (yyn <= 0)
1203  {
1204  if (yytable_value_is_error (yyn))
1205  goto yyerrlab;
1206  yyn = -yyn;
1207  goto yyreduce;
1208  }
1209 
1210  /* Count tokens shifted since error; after three, turn off error
1211  status. */
1212  if (yyerrstatus)
1213  yyerrstatus--;
1214 
1215  /* Shift the lookahead token. */
1216  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1217 
1218  /* Discard the shifted token. */
1219  yychar = YYEMPTY;
1220 
1221  yystate = yyn;
1223  *++yyvsp = yylval;
1225 
1226  goto yynewstate;
1227 
1228 
1229 /*-----------------------------------------------------------.
1230 | yydefault -- do the default action for the current state. |
1231 `-----------------------------------------------------------*/
1232 yydefault:
1233  yyn = yydefact[yystate];
1234  if (yyn == 0)
1235  goto yyerrlab;
1236  goto yyreduce;
1237 
1238 
1239 /*-----------------------------.
1240 | yyreduce -- Do a reduction. |
1241 `-----------------------------*/
1242 yyreduce:
1243  /* yyn is the number of a rule to reduce with. */
1244  yylen = yyr2[yyn];
1245 
1246  /* If YYLEN is nonzero, implement the default value of the action:
1247  '$$ = $1'.
1248 
1249  Otherwise, the following line sets YYVAL to garbage.
1250  This behavior is undocumented and Bison
1251  users should not rely upon it. Assigning to YYVAL
1252  unconditionally makes the parser a bit smaller, and it avoids a
1253  GCC warning that YYVAL may be used uninitialized. */
1254  yyval = yyvsp[1-yylen];
1255 
1256 
1257  YY_REDUCE_PRINT (yyn);
1258  switch (yyn)
1259  {
1260  case 5:
1261 #line 78 "readcf.yy" /* yacc.c:1646 */
1262  { *retvalue = (yyvsp[-1]).getval(); return 0; }
1263 #line 1264 "readcf.cc" /* yacc.c:1646 */
1264  break;
1265 
1266  case 6:
1267 #line 81 "readcf.yy" /* yacc.c:1646 */
1268  { (yyval) = (yyvsp[0]); }
1269 #line 1270 "readcf.cc" /* yacc.c:1646 */
1270  break;
1271 
1272  case 7:
1273 #line 82 "readcf.yy" /* yacc.c:1646 */
1274  { (yyval) = (yyvsp[-2]).getval() + (yyvsp[0]).getval(); }
1275 #line 1276 "readcf.cc" /* yacc.c:1646 */
1276  break;
1277 
1278  case 8:
1279 #line 83 "readcf.yy" /* yacc.c:1646 */
1280  { (yyval) = (yyvsp[-2]).getval() - (yyvsp[0]).getval(); }
1281 #line 1282 "readcf.cc" /* yacc.c:1646 */
1282  break;
1283 
1284  case 9:
1285 #line 84 "readcf.yy" /* yacc.c:1646 */
1286  { (yyval) = (yyvsp[-2]).getval() * (yyvsp[0]).getval(); }
1287 #line 1288 "readcf.cc" /* yacc.c:1646 */
1288  break;
1289 
1290  case 10:
1291 #line 85 "readcf.yy" /* yacc.c:1646 */
1292  { (yyval) = (yyvsp[-2]).getval() / (yyvsp[0]).getval(); }
1293 #line 1294 "readcf.cc" /* yacc.c:1646 */
1294  break;
1295 
1296  case 11:
1297 #line 86 "readcf.yy" /* yacc.c:1646 */
1298  { (yyval) = -(yyvsp[0]).getval(); }
1299 #line 1300 "readcf.cc" /* yacc.c:1646 */
1300  break;
1301 
1302  case 12:
1303 #line 87 "readcf.yy" /* yacc.c:1646 */
1304  { (yyval) = (yyvsp[0]).getval(); }
1305 #line 1306 "readcf.cc" /* yacc.c:1646 */
1306  break;
1307 
1308  case 13:
1309 #line 88 "readcf.yy" /* yacc.c:1646 */
1310  { (yyval) = power( (yyvsp[-2]).getval(), (yyvsp[0]).getintval() ); }
1311 #line 1312 "readcf.cc" /* yacc.c:1646 */
1312  break;
1313 
1314  case 14:
1315 #line 89 "readcf.yy" /* yacc.c:1646 */
1316  { (yyval) = (yyvsp[-1]).getval(); }
1317 #line 1318 "readcf.cc" /* yacc.c:1646 */
1318  break;
1319 
1320 
1321 #line 1322 "readcf.cc" /* yacc.c:1646 */
1322  default: break;
1323  }
1324  /* User semantic actions sometimes alter yychar, and that requires
1325  that yytoken be updated with the new translation. We take the
1326  approach of translating immediately before every use of yytoken.
1327  One alternative is translating here after every semantic action,
1328  but that translation would be missed if the semantic action invokes
1329  YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1330  if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1331  incorrect destructor might then be invoked immediately. In the
1332  case of YYERROR or YYBACKUP, subsequent parser actions might lead
1333  to an incorrect destructor call or verbose syntax error message
1334  before the lookahead is translated. */
1335  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1336 
1337  YYPOPSTACK (yylen);
1338  yylen = 0;
1339  YY_STACK_PRINT (yyss, yyssp);
1340 
1341  *++yyvsp = yyval;
1342 
1343  /* Now 'shift' the result of the reduction. Determine what state
1344  that goes to, based on the state we popped back to and the rule
1345  number reduced by. */
1346 
1347  yyn = yyr1[yyn];
1348 
1349  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1350  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1351  yystate = yytable[yystate];
1352  else
1353  yystate = yydefgoto[yyn - YYNTOKENS];
1354 
1355  goto yynewstate;
1356 
1357 
1358 /*--------------------------------------.
1359 | yyerrlab -- here on detecting error. |
1360 `--------------------------------------*/
1361 yyerrlab:
1362  /* Make sure we have latest lookahead translation. See comments at
1363  user semantic actions for why this is necessary. */
1364  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1365 
1366  /* If not already recovering from an error, report this error. */
1367  if (!yyerrstatus)
1368  {
1369  ++yynerrs;
1370 #if ! YYERROR_VERBOSE
1371  yyerror (YY_("syntax error"));
1372 #else
1373 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1374  yyssp, yytoken)
1375  {
1376  char const *yymsgp = YY_("syntax error");
1377  int yysyntax_error_status;
1378  yysyntax_error_status = YYSYNTAX_ERROR;
1379  if (yysyntax_error_status == 0)
1380  yymsgp = yymsg;
1381  else if (yysyntax_error_status == 1)
1382  {
1383  if (yymsg != yymsgbuf)
1384  YYSTACK_FREE (yymsg);
1385  yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1386  if (!yymsg)
1387  {
1388  yymsg = yymsgbuf;
1389  yymsg_alloc = sizeof yymsgbuf;
1390  yysyntax_error_status = 2;
1391  }
1392  else
1393  {
1394  yysyntax_error_status = YYSYNTAX_ERROR;
1395  yymsgp = yymsg;
1396  }
1397  }
1398  yyerror (yymsgp);
1399  if (yysyntax_error_status == 2)
1400  goto yyexhaustedlab;
1401  }
1402 # undef YYSYNTAX_ERROR
1403 #endif
1404  }
1405 
1406 
1407 
1408  if (yyerrstatus == 3)
1409  {
1410  /* If just tried and failed to reuse lookahead token after an
1411  error, discard it. */
1412 
1413  if (yychar <= YYEOF)
1414  {
1415  /* Return failure if at end of input. */
1416  if (yychar == YYEOF)
1417  YYABORT;
1418  }
1419  else
1420  {
1421  yydestruct ("Error: discarding",
1422  yytoken, &yylval);
1423  yychar = YYEMPTY;
1424  }
1425  }
1426 
1427  /* Else will try to reuse lookahead token after shifting the error
1428  token. */
1429  goto yyerrlab1;
1430 
1431 
1432 /*---------------------------------------------------.
1433 | yyerrorlab -- error raised explicitly by YYERROR. |
1434 `---------------------------------------------------*/
1435 yyerrorlab:
1436 
1437  /* Pacify compilers like GCC when the user code never invokes
1438  YYERROR and the label yyerrorlab therefore never appears in user
1439  code. */
1440  if (/*CONSTCOND*/ 0)
1441  goto yyerrorlab;
1442 
1443  /* Do not reclaim the symbols of the rule whose action triggered
1444  this YYERROR. */
1445  YYPOPSTACK (yylen);
1446  yylen = 0;
1447  YY_STACK_PRINT (yyss, yyssp);
1448  yystate = *yyssp;
1449  goto yyerrlab1;
1450 
1451 
1452 /*-------------------------------------------------------------.
1453 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1454 `-------------------------------------------------------------*/
1455 yyerrlab1:
1456  yyerrstatus = 3; /* Each real token shifted decrements this. */
1457 
1458  for (;;)
1459  {
1460  yyn = yypact[yystate];
1461  if (!yypact_value_is_default (yyn))
1462  {
1463  yyn += YYTERROR;
1464  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1465  {
1466  yyn = yytable[yyn];
1467  if (0 < yyn)
1468  break;
1469  }
1470  }
1471 
1472  /* Pop the current state because it cannot handle the error token. */
1473  if (yyssp == yyss)
1474  YYABORT;
1475 
1476 
1477  yydestruct ("Error: popping",
1478  yystos[yystate], yyvsp);
1479  YYPOPSTACK (1);
1480  yystate = *yyssp;
1481  YY_STACK_PRINT (yyss, yyssp);
1482  }
1483 
1485  *++yyvsp = yylval;
1487 
1488 
1489  /* Shift the error token. */
1490  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1491 
1492  yystate = yyn;
1493  goto yynewstate;
1494 
1495 
1496 /*-------------------------------------.
1497 | yyacceptlab -- YYACCEPT comes here. |
1498 `-------------------------------------*/
1499 yyacceptlab:
1500  yyresult = 0;
1501  goto yyreturn;
1502 
1503 /*-----------------------------------.
1504 | yyabortlab -- YYABORT comes here. |
1505 `-----------------------------------*/
1506 yyabortlab:
1507  yyresult = 1;
1508  goto yyreturn;
1509 
1510 #if !defined yyoverflow || YYERROR_VERBOSE
1511 /*-------------------------------------------------.
1512 | yyexhaustedlab -- memory exhaustion comes here. |
1513 `-------------------------------------------------*/
1514 yyexhaustedlab:
1515  yyerror (YY_("memory exhausted"));
1516  yyresult = 2;
1517  /* Fall through. */
1518 #endif
1519 
1520 yyreturn:
1521  if (yychar != YYEMPTY)
1522  {
1523  /* Make sure we have latest lookahead translation. See comments at
1524  user semantic actions for why this is necessary. */
1525  yytoken = YYTRANSLATE (yychar);
1526  yydestruct ("Cleanup: discarding lookahead",
1527  yytoken, &yylval);
1528  }
1529  /* Do not reclaim the symbols of the rule whose action triggered
1530  this YYABORT or YYACCEPT. */
1531  YYPOPSTACK (yylen);
1532  YY_STACK_PRINT (yyss, yyssp);
1533  while (yyssp != yyss)
1534  {
1535  yydestruct ("Cleanup: popping",
1536  yystos[*yyssp], yyvsp);
1537  YYPOPSTACK (1);
1538  }
1539 #ifndef yyoverflow
1540  if (yyss != yyssa)
1541  YYSTACK_FREE (yyss);
1542 #endif
1543 #if YYERROR_VERBOSE
1544  if (yymsg != yymsgbuf)
1545  YYSTACK_FREE (yymsg);
1546 #endif
1547  return yyresult;
1548 }
1549 #line 92 "readcf.yy" /* yacc.c:1906 */
1550 
1551 
1552 #ifdef BISONPP
1553 void YY_parse_CLASS::yyerror( char * s )
1554 #else
1555 void yyerror( char * s )
1556 #endif
1557 {
1558  CERR << s << "\n";
1559 }
1560 
1561 #ifdef BISONPP
1563 #else
1564 int yylex()
1565 #endif
1566 {
1567  int c;
1568 
1569  while ((c = defaultin->get()) == ' ' || c == '\t' || c == '\n' ) ;
1570  if ( isdigit( c ) ) {
1571  defaultin->putback( c );
1573  return NUM;
1574  }
1575  else if ( isalpha( c ) ) {
1576  // look for generators of GF(q)
1577  if ( getCharacteristic() > 0 && getGFDegree() > 1 && c == gf_name ) {
1578 #ifdef BISONPP
1579  this->yylval = getGFGenerator();
1580 #else
1581  yylval = getGFGenerator();
1582 #endif
1583  }
1584  else if ( c == getDefaultVarName() ) {
1585  int cc;
1586  cc = defaultin->get();
1587  if ( cc == '_' ) {
1589 #ifdef BISONPP
1590  this->yylval = Variable( index.getintval() );
1591 #else
1592  yylval = Variable( index.getintval() );
1593 #endif
1594  }
1595  else {
1596  defaultin->putback( cc );
1597 #ifdef BISONPP
1598  this->yylval = Variable( (char)c );
1599 #else
1600  yylval = Variable( (char)c );
1601 #endif
1602  }
1603  }
1604  else {
1605 #ifdef BISONPP
1606  this->yylval = Variable( (char)c );
1607 #else
1608  yylval = Variable( (char)c );
1609 #endif
1610  }
1611  return NUM;
1612  }
1613  return c;
1614 }
1615 
1617 {
1618  CanonicalForm theRetvalue;
1619  retvalue = new CanonicalForm();
1620 #ifdef BISONPP
1621  YY_parse_CLASS my_parser;
1622  defaultin = &str;
1623  if ( my_parser.yyparse() == 0 ) {
1624  theRetvalue = *retvalue;
1625  delete retvalue;
1626  return theRetvalue;
1627  }
1628  else {
1629  delete retvalue;
1630  return 0;
1631  }
1632 #else
1633  defaultin = &str;
1634  if ( yyparse() == 0 ) {
1635  theRetvalue = *retvalue;
1636  delete retvalue;
1637  return theRetvalue;
1638  }
1639  else {
1640  delete retvalue;
1641  return 0;
1642  }
1643 #endif
1644 }
1645 
1647 {
1648  static char * buffer = 0;
1649  static int bufsize = 0;
1650 
1651  if ( buffer == 0 ) {
1652  bufsize = 10000;
1653  buffer = new char[bufsize];
1654  }
1655  int i = 0, c, goon = 1;
1656  while ( goon ) {
1657  while ( isdigit( c = s.get() ) && i < bufsize - 2 ) {
1658  buffer[i] = c;
1659  i++;
1660  }
1661  if ( isdigit( c ) ) {
1662  bufsize += 1000;
1663  char * newbuffer = (char*)memcpy( new char[bufsize], buffer, bufsize - 1000 );
1664  delete [] buffer;
1665  buffer = newbuffer;
1666  buffer[i] = c;
1667  i++;
1668  }
1669  else {
1670  goon = 0;
1671  buffer[i] = '\0';
1672  s.putback( c );
1673  }
1674  }
1675  return buffer;
1676 }
1677 
#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:1646
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:390
#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:1645
static void yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep)
Definition: grammar.cc:1706
unsigned char yytype_uint8
Definition: readcf.cc:189
void yyerror(char *s)
Definition: readcf.cc:1555
#define ISTREAM
Definition: readcf.cc:88
static const yytype_uint16 yyrline[]
Definition: grammar.cc:741
CanonicalForm readCF(ISTREAM &str)
Definition: readcf.cc:1616
factory&#39;s class for variables
Definition: factory.h:115
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:382
factory&#39;s main class
Definition: canonicalform.h:75
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:1674
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:1763
#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:375
#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:1732
int yychar
Definition: readcf.cc:1013
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:396
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:123
CanonicalForm getGFGenerator()
Definition: cf_char.cc:62
factory switches.
int yylex()
Definition: readcf.cc:1564
int yynerrs
Definition: readcf.cc:1018
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:1016
#define YYACCEPT
Definition: readcf.cc:593
int yydebug
Definition: grammar.cc:1795
#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:1026
#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:767
#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:997
Header for factory&#39;s main class CanonicalForm.
static const yytype_int8 yypgoto[]
Definition: readcf.cc:532