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