47 #define YYBISON_VERSION "3.0.5" 50 #define YYSKELETON_NAME "yacc.c" 71 #include "factory/factoryconf.h" 73 #if defined(WINNT) && ! defined(__GNUC__) 76 # define alloca _alloca 88 # define ISTREAM std::istream 89 # define CERR std::cerr 90 #elif defined(HAVE_IOSTREAM_H) 91 # include <iostream.h> 92 # define ISTREAM istream 106 # define YYSTYPE ParseUtil 108 # define YY_parse_USE_GOTO 1 109 # define YY_parse_STYPE ParseUtil 124 #line 125 "readcf.cc" 127 # if defined __cplusplus && 201103L <= __cplusplus 128 # define YY_NULLPTR nullptr 130 # define YY_NULLPTR 0 135 #ifdef YYERROR_VERBOSE 136 # undef YYERROR_VERBOSE 137 # define YYERROR_VERBOSE 1 139 # define YYERROR_VERBOSE 0 165 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 167 # define YYSTYPE_IS_TRIVIAL 1 168 # define YYSTYPE_IS_DECLARED 1 180 #line 181 "readcf.cc" 211 # ifdef __SIZE_TYPE__ 212 # define YYSIZE_T __SIZE_TYPE__ 213 # elif defined size_t 214 # define YYSIZE_T size_t 215 # elif ! defined YYSIZE_T 217 # define YYSIZE_T size_t 219 # define YYSIZE_T unsigned int 223 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 226 # if defined YYENABLE_NLS && YYENABLE_NLS 228 # include <libintl.h> 229 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 233 # define YY_(Msgid) Msgid 238 # if (defined __GNUC__ \ 239 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 240 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 241 # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 243 # define YY_ATTRIBUTE(Spec) 247 #ifndef YY_ATTRIBUTE_PURE 248 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 251 #ifndef YY_ATTRIBUTE_UNUSED 252 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 255 #if !defined _Noreturn \ 256 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) 257 # if defined _MSC_VER && 1200 <= _MSC_VER 258 # define _Noreturn __declspec (noreturn) 260 # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) 265 #if ! defined lint || defined __GNUC__ 266 # define YYUSE(E) ((void) (E)) 271 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 273 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 274 _Pragma ("GCC diagnostic push") \ 275 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 276 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 277 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 278 _Pragma ("GCC diagnostic pop") 280 # define YY_INITIAL_VALUE(Value) Value 282 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 283 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 284 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 286 #ifndef YY_INITIAL_VALUE 287 # define YY_INITIAL_VALUE(Value) 291 #if ! defined yyoverflow || YYERROR_VERBOSE 295 # ifdef YYSTACK_USE_ALLOCA 296 # if YYSTACK_USE_ALLOCA 298 # define YYSTACK_ALLOC __builtin_alloca 299 # elif defined __BUILTIN_VA_ARG_INCR 302 # define YYSTACK_ALLOC __alloca 303 # elif defined _MSC_VER 305 # define alloca _alloca 307 # define YYSTACK_ALLOC alloca 308 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 311 # ifndef EXIT_SUCCESS 312 # define EXIT_SUCCESS 0 319 # ifdef YYSTACK_ALLOC 321 # define YYSTACK_FREE(Ptr) do { ; } while (0) 322 # ifndef YYSTACK_ALLOC_MAXIMUM 327 # define YYSTACK_ALLOC_MAXIMUM 4032 330 # define YYSTACK_ALLOC YYMALLOC 331 # define YYSTACK_FREE YYFREE 332 # ifndef YYSTACK_ALLOC_MAXIMUM 333 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 335 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 336 && ! ((defined YYMALLOC || defined malloc) \ 337 && (defined YYFREE || defined free))) 339 # ifndef EXIT_SUCCESS 340 # define EXIT_SUCCESS 0 344 # define YYMALLOC malloc 345 # if ! defined malloc && ! defined EXIT_SUCCESS 351 # if ! defined free && ! defined EXIT_SUCCESS 359 #if (! defined yyoverflow \ 360 && (! defined __cplusplus \ 361 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 371 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 375 # define YYSTACK_BYTES(N) \ 376 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 377 + YYSTACK_GAP_MAXIMUM) 379 # define YYCOPY_NEEDED 1 386 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 389 YYSIZE_T yynewbytes; \ 390 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 391 Stack = &yyptr->Stack_alloc; \ 392 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 393 yyptr += yynewbytes / sizeof (*yyptr); \ 399 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 403 # if defined __GNUC__ && 1 < __GNUC__ 404 # define YYCOPY(Dst, Src, Count) \ 405 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 407 # define YYCOPY(Dst, Src, Count) \ 411 for (yyi = 0; yyi < (Count); yyi++) \ 412 (Dst)[yyi] = (Src)[yyi]; \ 436 #define YYMAXUTOK 259 438 #define YYTRANSLATE(YYX) \ 439 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 445 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 11, 12, 6, 5, 2, 4, 2, 7, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 10,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 9, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 1, 2, 3, 8
477 0, 73, 73, 74, 77, 78, 81, 82, 83, 84,
482 #if YYDEBUG || YYERROR_VERBOSE || 0 485 static const char *
const yytname[] =
487 "$end",
"error",
"$undefined",
"NUM",
"'-'",
"'+'",
"'*'",
"'/'",
"NEG",
488 "'^'",
"';'",
"'('",
"')'",
"$accept",
"input",
"line",
"exp",
YY_NULLPTR 497 0, 256, 257, 258, 45, 43, 42, 47, 259, 94,
502 #define YYPACT_NINF -8 504 #define yypact_value_is_default(Yystate) \ 505 (!!((Yystate) == (-8))) 507 #define YYTABLE_NINF -1 509 #define yytable_value_is_error(Yytable_value) \ 516 -8, 13, -8, -8, 3, 3, -8, 3, -8, 30,
517 -7, -7, 21, 3, 3, 3, 3, 1, -8, -8,
526 2, 0, 1, 6, 0, 0, 4, 0, 3, 0,
527 11, 12, 0, 0, 0, 0, 0, 0, 5, 14,
548 10, 11, 17, 12, 24, 0, 3, 4, 5, 20,
549 21, 22, 23, 2, 7, 0, 3, 4, 5, 0,
550 0, 0, 0, 6, 7, 13, 14, 15, 16, 0,
551 17, 0, 0, 19, 13, 14, 15, 16, 0, 17,
557 4, 5, 9, 7, 3, -1, 3, 4, 5, 13,
558 14, 15, 16, 0, 11, -1, 3, 4, 5, -1,
559 -1, -1, -1, 10, 11, 4, 5, 6, 7, -1,
560 9, -1, -1, 12, 4, 5, 6, 7, -1, 9,
568 0, 14, 0, 3, 4, 5, 10, 11, 15, 16,
569 16, 16, 16, 4, 5, 6, 7, 9, 10, 12,
576 0, 13, 14, 14, 15, 15, 16, 16, 16, 16,
583 0, 2, 0, 2, 1, 2, 1, 3, 3, 3,
588 #define yyerrok (yyerrstatus = 0) 589 #define yyclearin (yychar = YYEMPTY) 593 #define YYACCEPT goto yyacceptlab 594 #define YYABORT goto yyabortlab 595 #define YYERROR goto yyerrorlab 598 #define YYRECOVERING() (!!yyerrstatus) 600 #define YYBACKUP(Token, Value) \ 602 if (yychar == YYEMPTY) \ 606 YYPOPSTACK (yylen); \ 612 yyerror (YY_("syntax error: cannot back up")); \ 619 #define YYERRCODE 256 628 # define YYFPRINTF fprintf 631 # define YYDPRINTF(Args) \ 638 #ifndef YY_LOCATION_PRINT 639 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 643 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 647 YYFPRINTF (stderr, "%s ", Title); \ 648 yy_symbol_print (stderr, \ 650 YYFPRINTF (stderr, "\n"); \ 662 FILE *yyo = yyoutput;
668 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
697 for (; yybottom <= yytop; yybottom++)
699 int yybot = *yybottom;
705 # define YY_STACK_PRINT(Bottom, Top) \ 708 yy_stack_print ((Bottom), (Top)); \ 719 unsigned long int yylno =
yyrline[yyrule];
720 int yynrhs =
yyr2[yyrule];
722 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
725 for (yyi = 0; yyi < yynrhs; yyi++)
729 yystos[yyssp[yyi + 1 - yynrhs]],
730 &(yyvsp[(yyi + 1) - (yynrhs)])
736 # define YY_REDUCE_PRINT(Rule) \ 739 yy_reduce_print (yyssp, yyvsp, Rule); \ 746 # define YYDPRINTF(Args) 747 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 748 # define YY_STACK_PRINT(Bottom, Top) 749 # define YY_REDUCE_PRINT(Rule) 755 # define YYINITDEPTH 200 766 # define YYMAXDEPTH 10000 773 # if defined __GLIBC__ && defined _STRING_H 774 # define yystrlen strlen 778 yystrlen (
const char *yystr)
781 for (yylen = 0; yystr[yylen]; yylen++)
789 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 790 # define yystpcpy stpcpy 795 yystpcpy (
char *yydest,
const char *yysrc)
798 const char *yys = yysrc;
800 while ((*yyd++ = *yys++) !=
'\0')
817 yytnamerr (
char *yyres,
const char *yystr)
822 char const *yyp = yystr;
829 goto do_not_strip_quotes;
833 goto do_not_strip_quotes;
846 do_not_strip_quotes: ;
850 return yystrlen (yystr);
852 return yystpcpy (yyres, yystr) - yyres;
865 yysyntax_error (
YYSIZE_T *yymsg_alloc,
char **yymsg,
870 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
874 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
905 yyarg[yycount++] =
yytname[yytoken];
911 int yyxbegin = yyn < 0 ? -yyn : 0;
913 int yychecklim =
YYLAST - yyn + 1;
917 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
921 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
927 yyarg[yycount++] =
yytname[yyx];
930 if (! (yysize <= yysize1
941 # define YYCASE_(N, S) \ 946 YYCASE_(0,
YY_(
"syntax error"));
947 YYCASE_(1,
YY_(
"syntax error, unexpected %s"));
948 YYCASE_(2,
YY_(
"syntax error, unexpected %s, expecting %s"));
949 YYCASE_(3,
YY_(
"syntax error, unexpected %s, expecting %s or %s"));
950 YYCASE_(4,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
951 YYCASE_(5,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
956 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
962 if (*yymsg_alloc < yysize)
964 *yymsg_alloc = 2 * yysize;
965 if (! (yysize <= *yymsg_alloc
977 while ((*yyp = *yyformat) !=
'\0')
978 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
980 yyp += yytnamerr (yyp, yyarg[yyi++]);
1063 char *yymsg = yymsgbuf;
1064 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1067 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1073 yyssp = yyss = yyssa;
1074 yyvsp = yyvs = yyvsa;
1077 YYDPRINTF ((stderr,
"Starting parse\n"));
1096 if (yyss + yystacksize - 1 <= yyssp)
1099 YYSIZE_T yysize = yyssp - yyss + 1;
1113 yyoverflow (
YY_(
"memory exhausted"),
1114 &yyss1, yysize *
sizeof (*yyssp),
1115 &yyvs1, yysize *
sizeof (*yyvsp),
1122 # ifndef YYSTACK_RELOCATE 1123 goto yyexhaustedlab;
1127 goto yyexhaustedlab;
1134 union yyalloc *yyptr =
1135 (
union yyalloc *)
YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1137 goto yyexhaustedlab;
1138 YYSTACK_RELOCATE (yyss_alloc, yyss);
1139 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1140 # undef YYSTACK_RELOCATE 1147 yyssp = yyss + yysize - 1;
1148 yyvsp = yyvs + yysize - 1;
1150 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1151 (
unsigned long int) yystacksize));
1153 if (yyss + yystacksize - 1 <= yyssp)
1157 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1182 YYDPRINTF ((stderr,
"Reading a token: "));
1189 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1255 yyval = yyvsp[1-yylen];
1262 #line 78 "readcf.yy" 1263 { *
retvalue = (yyvsp[-1]).getval();
return 0; }
1264 #line 1265 "readcf.cc" 1268 #line 81 "readcf.yy" 1269 { (yyval) = (yyvsp[0]); }
1270 #line 1271 "readcf.cc" 1274 #line 82 "readcf.yy" 1275 { (yyval) = (yyvsp[-2]).
getval() + (yyvsp[0]).getval(); }
1276 #line 1277 "readcf.cc" 1280 #line 83 "readcf.yy" 1281 { (yyval) = (yyvsp[-2]).getval() - (yyvsp[0]).getval(); }
1282 #line 1283 "readcf.cc" 1286 #line 84 "readcf.yy" 1287 { (yyval) = (yyvsp[-2]).getval() * (yyvsp[0]).getval(); }
1288 #line 1289 "readcf.cc" 1292 #line 85 "readcf.yy" 1293 { (yyval) = (yyvsp[-2]).getval() / (yyvsp[0]).getval(); }
1294 #line 1295 "readcf.cc" 1298 #line 86 "readcf.yy" 1299 { (yyval) = -(yyvsp[0]).getval(); }
1300 #line 1301 "readcf.cc" 1304 #line 87 "readcf.yy" 1305 { (yyval) = (yyvsp[0]).getval(); }
1306 #line 1307 "readcf.cc" 1310 #line 88 "readcf.yy" 1311 { (yyval) =
power( (yyvsp[-2]).getval(), (yyvsp[0]).getintval() ); }
1312 #line 1313 "readcf.cc" 1316 #line 89 "readcf.yy" 1317 { (yyval) = (yyvsp[-1]).
getval(); }
1318 #line 1319 "readcf.cc" 1322 #line 1323 "readcf.cc" 1351 if (0 <= yystate && yystate <=
YYLAST &&
yycheck[yystate] == *yyssp)
1371 #if ! YYERROR_VERBOSE 1374 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1377 char const *yymsgp =
YY_(
"syntax error");
1378 int yysyntax_error_status;
1379 yysyntax_error_status = YYSYNTAX_ERROR;
1380 if (yysyntax_error_status == 0)
1382 else if (yysyntax_error_status == 1)
1384 if (yymsg != yymsgbuf)
1390 yymsg_alloc =
sizeof yymsgbuf;
1391 yysyntax_error_status = 2;
1395 yysyntax_error_status = YYSYNTAX_ERROR;
1400 if (yysyntax_error_status == 2)
1401 goto yyexhaustedlab;
1403 # undef YYSYNTAX_ERROR 1409 if (yyerrstatus == 3)
1511 #if !defined yyoverflow || YYERROR_VERBOSE 1534 while (yyssp != yyss)
1545 if (yymsg != yymsgbuf)
1550 #line 92 "readcf.yy" 1570 while ((c =
defaultin->get()) ==
' ' || c ==
'\t' || c ==
'\n' ) ;
1571 if ( isdigit( c ) ) {
1576 else if ( isalpha( c ) ) {
1599 this->yylval =
Variable( (
char)c );
1607 this->yylval =
Variable( (
char)c );
1622 YY_parse_CLASS my_parser;
1624 if ( my_parser.yyparse() == 0 ) {
1649 static char * buffer = 0;
1650 static int bufsize = 0;
1652 if ( buffer == 0 ) {
1654 buffer =
new char[bufsize];
1656 int i = 0, c, goon = 1;
1658 while ( isdigit( c =
s.get() ) &&
i < bufsize - 2 ) {
1662 if ( isdigit( c ) ) {
1664 char * newbuffer = (
char*)memcpy(
new char[bufsize], buffer, bufsize - 1000 );
#define YY_STACK_PRINT(Bottom, Top)
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)
#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[]
unsigned short int yytype_uint16
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[]