51 #define YYBISON_VERSION "3.4.1" 54 #define YYSKELETON_NAME "yacc.c" 75 #include "factory/factoryconf.h" 77 #if defined(WINNT) && ! defined(__GNUC__) 80 # define alloca _alloca 92 # define ISTREAM std::istream 93 # define CERR std::cerr 94 #elif defined(HAVE_IOSTREAM_H) 95 # include <iostream.h> 96 # define ISTREAM istream 110 # define YYSTYPE ParseUtil 112 # define YY_parse_USE_GOTO 1 113 # define YY_parse_STYPE ParseUtil 128 #line 129 "readcf.cc" 131 # if defined __cplusplus 132 # if 201103L <= __cplusplus 133 # define YY_NULLPTR nullptr 135 # define YY_NULLPTR 0 138 # define YY_NULLPTR ((void*)0) 143 #ifdef YYERROR_VERBOSE 144 # undef YYERROR_VERBOSE 145 # define YYERROR_VERBOSE 1 147 # define YYERROR_VERBOSE 0 173 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 175 # define YYSTYPE_IS_TRIVIAL 1 176 # define YYSTYPE_IS_DECLARED 1 217 # ifdef __SIZE_TYPE__ 218 # define YYSIZE_T __SIZE_TYPE__ 219 # elif defined size_t 220 # define YYSIZE_T size_t 221 # elif ! defined YYSIZE_T 223 # define YYSIZE_T size_t 225 # define YYSIZE_T unsigned 229 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 232 # if defined YYENABLE_NLS && YYENABLE_NLS 234 # include <libintl.h> 235 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 239 # define YY_(Msgid) Msgid 244 # if (defined __GNUC__ \ 245 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 246 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 247 # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 249 # define YY_ATTRIBUTE(Spec) 253 #ifndef YY_ATTRIBUTE_PURE 254 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 257 #ifndef YY_ATTRIBUTE_UNUSED 258 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 262 #if ! defined lint || defined __GNUC__ 263 # define YYUSE(E) ((void) (E)) 268 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 270 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 271 _Pragma ("GCC diagnostic push") \ 272 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 273 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 274 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 275 _Pragma ("GCC diagnostic pop") 277 # define YY_INITIAL_VALUE(Value) Value 279 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 280 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 281 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 283 #ifndef YY_INITIAL_VALUE 284 # define YY_INITIAL_VALUE(Value) 288 #define YY_ASSERT(E) ((void) (0 && (E))) 290 #if ! defined yyoverflow || YYERROR_VERBOSE 294 # ifdef YYSTACK_USE_ALLOCA 295 # if YYSTACK_USE_ALLOCA 297 # define YYSTACK_ALLOC __builtin_alloca 298 # elif defined __BUILTIN_VA_ARG_INCR 301 # define YYSTACK_ALLOC __alloca 302 # elif defined _MSC_VER 304 # define alloca _alloca 306 # define YYSTACK_ALLOC alloca 307 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 310 # ifndef EXIT_SUCCESS 311 # define EXIT_SUCCESS 0 318 # ifdef YYSTACK_ALLOC 320 # define YYSTACK_FREE(Ptr) do { ; } while (0) 321 # ifndef YYSTACK_ALLOC_MAXIMUM 326 # define YYSTACK_ALLOC_MAXIMUM 4032 329 # define YYSTACK_ALLOC YYMALLOC 330 # define YYSTACK_FREE YYFREE 331 # ifndef YYSTACK_ALLOC_MAXIMUM 332 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 334 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 335 && ! ((defined YYMALLOC || defined malloc) \ 336 && (defined YYFREE || defined free))) 338 # ifndef EXIT_SUCCESS 339 # define EXIT_SUCCESS 0 343 # define YYMALLOC malloc 344 # if ! defined malloc && ! defined EXIT_SUCCESS 350 # if ! defined free && ! defined EXIT_SUCCESS 358 #if (! defined yyoverflow \ 359 && (! defined __cplusplus \ 360 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 370 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 374 # define YYSTACK_BYTES(N) \ 375 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 376 + YYSTACK_GAP_MAXIMUM) 378 # define YYCOPY_NEEDED 1 385 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 388 YYSIZE_T yynewbytes; \ 389 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 390 Stack = &yyptr->Stack_alloc; \ 391 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 392 yyptr += yynewbytes / sizeof (*yyptr); \ 398 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 402 # if defined __GNUC__ && 1 < __GNUC__ 403 # define YYCOPY(Dst, Src, Count) \ 404 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 406 # define YYCOPY(Dst, Src, Count) \ 410 for (yyi = 0; yyi < (Count); yyi++) \ 411 (Dst)[yyi] = (Src)[yyi]; \ 433 #define YYMAXUTOK 259 437 #define YYTRANSLATE(YYX) \ 438 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 444 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 11, 12, 6, 5, 2, 4, 2, 7, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 10,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 9, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 1, 2, 3, 8
476 0, 73, 73, 74, 77, 78, 81, 82, 83, 84,
481 #if YYDEBUG || YYERROR_VERBOSE || 0 484 static const char *
const yytname[] =
486 "$end",
"error",
"$undefined",
"NUM",
"'-'",
"'+'",
"'*'",
"'/'",
"NEG",
487 "'^'",
"';'",
"'('",
"')'",
"$accept",
"input",
"line",
"exp",
YY_NULLPTR 496 0, 256, 257, 258, 45, 43, 42, 47, 259, 94,
501 #define YYPACT_NINF -8 503 #define yypact_value_is_default(Yystate) \ 504 (!!((Yystate) == (-8))) 506 #define YYTABLE_NINF -1 508 #define yytable_value_is_error(Yytable_value) \ 515 -8, 13, -8, -8, 3, 3, -8, 3, -8, 30,
516 -7, -7, 21, 3, 3, 3, 3, 1, -8, -8,
525 2, 0, 1, 6, 0, 0, 4, 0, 3, 0,
526 11, 12, 0, 0, 0, 0, 0, 0, 5, 14,
547 10, 11, 17, 12, 24, 0, 3, 4, 5, 20,
548 21, 22, 23, 2, 7, 0, 3, 4, 5, 0,
549 0, 0, 0, 6, 7, 13, 14, 15, 16, 0,
550 17, 0, 0, 19, 13, 14, 15, 16, 0, 17,
556 4, 5, 9, 7, 3, -1, 3, 4, 5, 13,
557 14, 15, 16, 0, 11, -1, 3, 4, 5, -1,
558 -1, -1, -1, 10, 11, 4, 5, 6, 7, -1,
559 9, -1, -1, 12, 4, 5, 6, 7, -1, 9,
567 0, 14, 0, 3, 4, 5, 10, 11, 15, 16,
568 16, 16, 16, 4, 5, 6, 7, 9, 10, 12,
575 0, 13, 14, 14, 15, 15, 16, 16, 16, 16,
582 0, 2, 0, 2, 1, 2, 1, 3, 3, 3,
587 #define yyerrok (yyerrstatus = 0) 588 #define yyclearin (yychar = YYEMPTY) 592 #define YYACCEPT goto yyacceptlab 593 #define YYABORT goto yyabortlab 594 #define YYERROR goto yyerrorlab 597 #define YYRECOVERING() (!!yyerrstatus) 599 #define YYBACKUP(Token, Value) \ 601 if (yychar == YYEMPTY) \ 605 YYPOPSTACK (yylen); \ 611 yyerror (YY_("syntax error: cannot back up")); \ 618 #define YYERRCODE 256 627 # define YYFPRINTF fprintf 630 # define YYDPRINTF(Args) \ 637 #ifndef YY_LOCATION_PRINT 638 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 642 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 646 YYFPRINTF (stderr, "%s ", Title); \ 647 yy_symbol_print (stderr, \ 649 YYFPRINTF (stderr, "\n"); \ 661 FILE *yyoutput = yyo;
667 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
696 for (; yybottom <= yytop; yybottom++)
698 int yybot = *yybottom;
704 # define YY_STACK_PRINT(Bottom, Top) \ 707 yy_stack_print ((Bottom), (Top)); \ 718 unsigned long yylno =
yyrline[yyrule];
719 int yynrhs =
yyr2[yyrule];
721 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
724 for (yyi = 0; yyi < yynrhs; yyi++)
728 yystos[yyssp[yyi + 1 - yynrhs]],
729 &yyvsp[(yyi + 1) - (yynrhs)]
735 # define YY_REDUCE_PRINT(Rule) \ 738 yy_reduce_print (yyssp, yyvsp, Rule); \ 745 # define YYDPRINTF(Args) 746 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 747 # define YY_STACK_PRINT(Bottom, Top) 748 # define YY_REDUCE_PRINT(Rule) 754 # define YYINITDEPTH 200 765 # define YYMAXDEPTH 10000 772 # if defined __GLIBC__ && defined _STRING_H 773 # define yystrlen strlen 777 yystrlen (
const char *yystr)
780 for (yylen = 0; yystr[yylen]; yylen++)
788 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 789 # define yystpcpy stpcpy 794 yystpcpy (
char *yydest,
const char *yysrc)
797 const char *yys = yysrc;
799 while ((*yyd++ = *yys++) !=
'\0')
816 yytnamerr (
char *yyres,
const char *yystr)
821 char const *yyp = yystr;
828 goto do_not_strip_quotes;
832 goto do_not_strip_quotes;
848 do_not_strip_quotes: ;
852 return yystrlen (yystr);
854 return (
YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
867 yysyntax_error (
YYSIZE_T *yymsg_alloc,
char **yymsg,
872 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
876 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
907 yyarg[yycount++] =
yytname[yytoken];
913 int yyxbegin = yyn < 0 ? -yyn : 0;
915 int yychecklim =
YYLAST - yyn + 1;
919 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
923 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
929 yyarg[yycount++] =
yytname[yyx];
943 # define YYCASE_(N, S) \ 948 YYCASE_(0,
YY_(
"syntax error"));
949 YYCASE_(1,
YY_(
"syntax error, unexpected %s"));
950 YYCASE_(2,
YY_(
"syntax error, unexpected %s, expecting %s"));
951 YYCASE_(3,
YY_(
"syntax error, unexpected %s, expecting %s or %s"));
952 YYCASE_(4,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
953 YYCASE_(5,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
958 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
965 if (*yymsg_alloc < yysize)
967 *yymsg_alloc = 2 * yysize;
968 if (! (yysize <= *yymsg_alloc
980 while ((*yyp = *yyformat) !=
'\0')
981 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
983 yyp += yytnamerr (yyp, yyarg[yyi++]);
1066 char *yymsg = yymsgbuf;
1067 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1070 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1076 yyssp = yyss = yyssa;
1077 yyvsp = yyvs = yyvsa;
1080 YYDPRINTF ((stderr,
"Starting parse\n"));
1102 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1106 if (yyss + yystacksize - 1 <= yyssp)
1107 #if !defined yyoverflow && !defined YYSTACK_RELOCATE 1108 goto yyexhaustedlab;
1114 # if defined yyoverflow 1126 yyoverflow (
YY_(
"memory exhausted"),
1127 &yyss1, yysize *
sizeof (*yyssp),
1128 &yyvs1, yysize *
sizeof (*yyvsp),
1136 goto yyexhaustedlab;
1143 union yyalloc *yyptr =
1144 (
union yyalloc *)
YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1146 goto yyexhaustedlab;
1147 YYSTACK_RELOCATE (yyss_alloc, yyss);
1148 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1149 # undef YYSTACK_RELOCATE 1155 yyssp = yyss + yysize - 1;
1156 yyvsp = yyvs + yysize - 1;
1158 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1159 (
unsigned long) yystacksize));
1161 if (yyss + yystacksize - 1 <= yyssp)
1189 YYDPRINTF ((stderr,
"Reading a token: "));
1196 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1261 yyval = yyvsp[1-yylen];
1268 #line 78 "readcf.yy" 1270 #line 1271 "readcf.cc" 1274 #line 81 "readcf.yy" 1275 { yyval = yyvsp[0]; }
1276 #line 1277 "readcf.cc" 1280 #line 82 "readcf.yy" 1281 { yyval = yyvsp[-2].getval() + yyvsp[0].getval(); }
1282 #line 1283 "readcf.cc" 1286 #line 83 "readcf.yy" 1287 { yyval = yyvsp[-2].getval() - yyvsp[0].getval(); }
1288 #line 1289 "readcf.cc" 1292 #line 84 "readcf.yy" 1293 { yyval = yyvsp[-2].getval() * yyvsp[0].getval(); }
1294 #line 1295 "readcf.cc" 1298 #line 85 "readcf.yy" 1299 { yyval = yyvsp[-2].getval() / yyvsp[0].getval(); }
1300 #line 1301 "readcf.cc" 1304 #line 86 "readcf.yy" 1305 { yyval = -yyvsp[0].getval(); }
1306 #line 1307 "readcf.cc" 1310 #line 87 "readcf.yy" 1311 { yyval = yyvsp[0].getval(); }
1312 #line 1313 "readcf.cc" 1316 #line 88 "readcf.yy" 1317 { yyval =
power( yyvsp[-2].getval(), yyvsp[0].getintval() ); }
1318 #line 1319 "readcf.cc" 1322 #line 89 "readcf.yy" 1323 { yyval = yyvsp[-1].getval(); }
1324 #line 1325 "readcf.cc" 1328 #line 1329 "readcf.cc" 1356 const int yyi =
yypgoto[yylhs] + *yyssp;
1357 yystate = (0 <= yyi && yyi <=
YYLAST &&
yycheck[yyi] == *yyssp
1377 #if ! YYERROR_VERBOSE 1380 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1383 char const *yymsgp =
YY_(
"syntax error");
1384 int yysyntax_error_status;
1385 yysyntax_error_status = YYSYNTAX_ERROR;
1386 if (yysyntax_error_status == 0)
1388 else if (yysyntax_error_status == 1)
1390 if (yymsg != yymsgbuf)
1396 yymsg_alloc =
sizeof yymsgbuf;
1397 yysyntax_error_status = 2;
1401 yysyntax_error_status = YYSYNTAX_ERROR;
1406 if (yysyntax_error_status == 2)
1407 goto yyexhaustedlab;
1409 # undef YYSYNTAX_ERROR 1415 if (yyerrstatus == 3)
1517 #if !defined yyoverflow || YYERROR_VERBOSE 1544 while (yyssp != yyss)
1555 if (yymsg != yymsgbuf)
1560 #line 92 "readcf.yy" 1580 while ((c =
defaultin->get()) ==
' ' || c ==
'\t' || c ==
'\n' ) ;
1581 if ( isdigit( c ) ) {
1586 else if ( isalpha( c ) ) {
1609 this->yylval =
Variable( (
char)c );
1617 this->yylval =
Variable( (
char)c );
1632 YY_parse_CLASS my_parser;
1634 if ( my_parser.yyparse() == 0 ) {
1659 static char * buffer = 0;
1660 static int bufsize = 0;
1662 if ( buffer == 0 ) {
1664 buffer =
new char[bufsize];
1666 int i = 0, c, goon = 1;
1668 while ( isdigit( c =
s.get() ) &&
i < bufsize - 2 ) {
1672 if ( isdigit( c ) ) {
1674 char * newbuffer = (
char*)memcpy(
new char[bufsize], buffer, bufsize - 1000 );
#define YY_STACK_PRINT(Bottom, Top)
CFFList append(const CFFList &Inputlist, const CFFactor &TheFactor)
static char * readString(ISTREAM &)
static const yytype_uint8 yytranslate[]
const CanonicalForm int s
static const yytype_uint8 yytable[]
unsigned short int yytype_uint16
#define YYSTACK_ALLOC_MAXIMUM
static void yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep)
unsigned char yytype_uint8
static const yytype_uint16 yyrline[]
CanonicalForm readCF(ISTREAM &str)
factory's class for variables
static CanonicalForm * retvalue
static const yytype_uint8 yystos[]
static ISTREAM * defaultin
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
static const yytype_uint8 yyr1[]
static void yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep)
static void yy_reduce_print(YYSTYPE *yyvsp, int yyrule)
unsigned short yytype_uint16
#define YY_REDUCE_PRINT(Rule)
unsigned char yytype_uint8
Operations in GF, where GF is a finite field of size less than 2^16 represented by a root of Conway p...
static void yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop)
static const yytype_int8 yydefgoto[]
static const yytype_int8 yycheck[]
void * malloc(size_t size)
static const yytype_uint8 yydefact[]
static int index(p_Length length, p_Ord ord)
#define yypact_value_is_default(Yystate)
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
static const yytype_uint8 yyr2[]
#define yytable_value_is_error(Yytable_value)
static const char *const yytname[]
static const yytype_int8 yypact[]
static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep)
static const yytype_int8 yypgoto[]