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