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