51 #define YYBISON_VERSION "3.5"
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"
132 # define YY_CAST(Type, Val) static_cast<Type> (Val)
133 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
135 # define YY_CAST(Type, Val) ((Type) (Val))
136 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
140 # if defined __cplusplus
141 # if 201103L <= __cplusplus
142 # define YY_NULLPTR nullptr
144 # define YY_NULLPTR 0
147 # define YY_NULLPTR ((void*)0)
152 #ifdef YYERROR_VERBOSE
153 # undef YYERROR_VERBOSE
154 # define YYERROR_VERBOSE 1
156 # define YYERROR_VERBOSE 0
182 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
184 # define YYSTYPE_IS_TRIVIAL 1
185 # define YYSTYPE_IS_DECLARED 1
205 #ifndef __PTRDIFF_MAX__
207 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
218 #ifdef __INT_LEAST8_MAX__
220 #elif defined YY_STDINT_H
226 #ifdef __INT_LEAST16_MAX__
228 #elif defined YY_STDINT_H
234 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
236 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
237 && UINT_LEAST8_MAX <= INT_MAX)
239 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
245 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
247 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
248 && UINT_LEAST16_MAX <= INT_MAX)
250 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
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
264 # define YYPTRDIFF_T ptrdiff_t
265 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
267 # define YYPTRDIFF_T long
268 # define YYPTRDIFF_MAXIMUM LONG_MAX
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__
279 # define YYSIZE_T size_t
281 # define YYSIZE_T unsigned
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)))
291 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
300 # if defined YYENABLE_NLS && YYENABLE_NLS
302 # include <libintl.h>
303 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
307 # define YY_(Msgid) Msgid
311 #ifndef YY_ATTRIBUTE_PURE
312 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
313 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
315 # define YY_ATTRIBUTE_PURE
319 #ifndef YY_ATTRIBUTE_UNUSED
320 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
321 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
323 # define YY_ATTRIBUTE_UNUSED
328 #if ! defined lint || defined __GNUC__
329 # define YYUSE(E) ((void) (E))
334 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
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")
343 # define YY_INITIAL_VALUE(Value) Value
345 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
346 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
347 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
349 #ifndef YY_INITIAL_VALUE
350 # define YY_INITIAL_VALUE(Value)
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")
360 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
361 # define YY_IGNORE_USELESS_CAST_BEGIN
362 # define YY_IGNORE_USELESS_CAST_END
366 #define YY_ASSERT(E) ((void) (0 && (E)))
368 #if ! defined yyoverflow || YYERROR_VERBOSE
372 # ifdef YYSTACK_USE_ALLOCA
373 # if YYSTACK_USE_ALLOCA
375 # define YYSTACK_ALLOC __builtin_alloca
376 # elif defined __BUILTIN_VA_ARG_INCR
379 # define YYSTACK_ALLOC __alloca
380 # elif defined _MSC_VER
382 # define alloca _alloca
384 # define YYSTACK_ALLOC alloca
385 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
388 # ifndef EXIT_SUCCESS
389 # define EXIT_SUCCESS 0
396 # ifdef YYSTACK_ALLOC
398 # define YYSTACK_FREE(Ptr) do { ; } while (0)
399 # ifndef YYSTACK_ALLOC_MAXIMUM
404 # define YYSTACK_ALLOC_MAXIMUM 4032
407 # define YYSTACK_ALLOC YYMALLOC
408 # define YYSTACK_FREE YYFREE
409 # ifndef YYSTACK_ALLOC_MAXIMUM
410 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
412 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
413 && ! ((defined YYMALLOC || defined malloc) \
414 && (defined YYFREE || defined free)))
416 # ifndef EXIT_SUCCESS
417 # define EXIT_SUCCESS 0
421 # define YYMALLOC malloc
422 # if ! defined malloc && ! defined EXIT_SUCCESS
428 # if ! defined free && ! defined EXIT_SUCCESS
436 #if (! defined yyoverflow \
437 && (! defined __cplusplus \
438 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
448 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
452 # define YYSTACK_BYTES(N) \
453 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
454 + YYSTACK_GAP_MAXIMUM)
456 # define YYCOPY_NEEDED 1
463 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
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); \
476 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
480 # if defined __GNUC__ && 1 < __GNUC__
481 # define YYCOPY(Dst, Src, Count) \
482 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
484 # define YYCOPY(Dst, Src, Count) \
488 for (yyi = 0; yyi < (Count); yyi++) \
489 (Dst)[yyi] = (Src)[yyi]; \
511 #define YYMAXUTOK 259
516 #define YYTRANSLATE(YYX) \
517 (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
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
555 0, 73, 73, 74, 77, 78, 81, 82, 83, 84,
560 #if YYDEBUG || YYERROR_VERBOSE || 0
563 static const char *
const yytname[] =
565 "$end",
"error",
"$undefined",
"NUM",
"'-'",
"'+'",
"'*'",
"'/'",
"NEG",
566 "'^'",
"';'",
"'('",
"')'",
"$accept",
"input",
"line",
"exp",
YY_NULLPTR
575 0, 256, 257, 258, 45, 43, 42, 47, 259, 94,
580 #define YYPACT_NINF (-8)
582 #define yypact_value_is_default(Yyn) \
583 ((Yyn) == YYPACT_NINF)
585 #define YYTABLE_NINF (-1)
587 #define yytable_value_is_error(Yyn) \
594 -8, 13, -8, -8, 3, 3, -8, 3, -8, 30,
595 -7, -7, 21, 3, 3, 3, 3, 1, -8, -8,
604 2, 0, 1, 6, 0, 0, 4, 0, 3, 0,
605 11, 12, 0, 0, 0, 0, 0, 0, 5, 14,
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,
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,
646 0, 14, 0, 3, 4, 5, 10, 11, 15, 16,
647 16, 16, 16, 4, 5, 6, 7, 9, 10, 12,
654 0, 13, 14, 14, 15, 15, 16, 16, 16, 16,
661 0, 2, 0, 2, 1, 2, 1, 3, 3, 3,
666 #define yyerrok (yyerrstatus = 0)
667 #define yyclearin (yychar = YYEMPTY)
671 #define YYACCEPT goto yyacceptlab
672 #define YYABORT goto yyabortlab
673 #define YYERROR goto yyerrorlab
676 #define YYRECOVERING() (!!yyerrstatus)
678 #define YYBACKUP(Token, Value) \
680 if (yychar == YYEMPTY) \
684 YYPOPSTACK (yylen); \
690 yyerror (YY_("syntax error: cannot back up")); \
697 #define YYERRCODE 256
706 # define YYFPRINTF fprintf
709 # define YYDPRINTF(Args) \
716 #ifndef YY_LOCATION_PRINT
717 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
721 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
725 YYFPRINTF (stderr, "%s ", Title); \
726 yy_symbol_print (stderr, \
728 YYFPRINTF (stderr, "\n"); \
740 FILE *yyoutput = yyo;
746 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
777 for (; yybottom <= yytop; yybottom++)
779 int yybot = *yybottom;
785 # define YY_STACK_PRINT(Bottom, Top) \
788 yy_stack_print ((Bottom), (Top)); \
800 int yynrhs =
yyr2[yyrule];
802 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %d):\n",
805 for (yyi = 0; yyi < yynrhs; yyi++)
809 yystos[yyssp[yyi + 1 - yynrhs]],
810 &yyvsp[(yyi + 1) - (yynrhs)]
816 # define YY_REDUCE_PRINT(Rule) \
819 yy_reduce_print (yyssp, yyvsp, Rule); \
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)
835 # define YYINITDEPTH 200
846 # define YYMAXDEPTH 10000
853 # if defined __GLIBC__ && defined _STRING_H
854 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
858 yystrlen (
const char *yystr)
861 for (yylen = 0; yystr[yylen]; yylen++)
869 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
870 # define yystpcpy stpcpy
875 yystpcpy (
char *yydest,
const char *yysrc)
878 const char *yys = yysrc;
880 while ((*yyd++ = *yys++) !=
'\0')
897 yytnamerr (
char *yyres,
const char *yystr)
902 char const *yyp = yystr;
909 goto do_not_strip_quotes;
913 goto do_not_strip_quotes;
929 do_not_strip_quotes: ;
933 return yystpcpy (yyres, yystr) - yyres;
935 return yystrlen (yystr);
948 yysyntax_error (
YYPTRDIFF_T *yymsg_alloc,
char **yymsg,
951 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
956 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
990 yyarg[yycount++] =
yytname[yytoken];
996 int yyxbegin = yyn < 0 ? -yyn : 0;
998 int yychecklim =
YYLAST - yyn + 1;
1002 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1006 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1012 yyarg[yycount++] =
yytname[yyx];
1027 # define YYCASE_(N, S) \
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"));
1044 YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
1051 if (*yymsg_alloc < yysize)
1053 *yymsg_alloc = 2 * yysize;
1054 if (! (yysize <= *yymsg_alloc
1066 while ((*yyp = *yyformat) !=
'\0')
1067 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
1069 yyp += yytnamerr (yyp, yyarg[yyi++]);
1152 char *yymsg = yymsgbuf;
1156 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1162 yyssp = yyss = yyssa;
1163 yyvsp = yyvs = yyvsa;
1166 YYDPRINTF ((stderr,
"Starting parse\n"));
1188 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1194 if (yyss + yystacksize - 1 <= yyssp)
1195 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1196 goto yyexhaustedlab;
1202 # if defined yyoverflow
1214 yyoverflow (
YY_(
"memory exhausted"),
1215 &yyss1, yysize *
YYSIZEOF (*yyssp),
1216 &yyvs1, yysize *
YYSIZEOF (*yyvsp),
1224 goto yyexhaustedlab;
1231 union yyalloc *yyptr =
1235 goto yyexhaustedlab;
1236 YYSTACK_RELOCATE (yyss_alloc, yyss);
1237 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1238 # undef YYSTACK_RELOCATE
1244 yyssp = yyss + yysize - 1;
1245 yyvsp = yyvs + yysize - 1;
1248 YYDPRINTF ((stderr,
"Stack size increased to %ld\n",
1249 YY_CAST (
long, yystacksize)));
1252 if (yyss + yystacksize - 1 <= yyssp)
1280 YYDPRINTF ((stderr,
"Reading a token: "));
1287 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1351 yyval = yyvsp[1-yylen];
1358 #line 78 "readcf.yy"
1360 #line 1361 "readcf.cc"
1364 #line 81 "readcf.yy"
1365 { yyval = yyvsp[0]; }
1366 #line 1367 "readcf.cc"
1370 #line 82 "readcf.yy"
1371 { yyval = yyvsp[-2].getval() + yyvsp[0].getval(); }
1372 #line 1373 "readcf.cc"
1376 #line 83 "readcf.yy"
1377 { yyval = yyvsp[-2].getval() - yyvsp[0].getval(); }
1378 #line 1379 "readcf.cc"
1382 #line 84 "readcf.yy"
1383 { yyval = yyvsp[-2].getval() * yyvsp[0].getval(); }
1384 #line 1385 "readcf.cc"
1388 #line 85 "readcf.yy"
1389 { yyval = yyvsp[-2].getval() / yyvsp[0].getval(); }
1390 #line 1391 "readcf.cc"
1394 #line 86 "readcf.yy"
1395 { yyval = -yyvsp[0].getval(); }
1396 #line 1397 "readcf.cc"
1400 #line 87 "readcf.yy"
1401 { yyval = yyvsp[0].getval(); }
1402 #line 1403 "readcf.cc"
1406 #line 88 "readcf.yy"
1407 { yyval =
power( yyvsp[-2].getval(), yyvsp[0].getintval() ); }
1408 #line 1409 "readcf.cc"
1412 #line 89 "readcf.yy"
1413 { yyval = yyvsp[-1].getval(); }
1414 #line 1415 "readcf.cc"
1418 #line 1419 "readcf.cc"
1446 const int yyi =
yypgoto[yylhs] + *yyssp;
1447 yystate = (0 <= yyi && yyi <=
YYLAST &&
yycheck[yyi] == *yyssp
1467 #if ! YYERROR_VERBOSE
1470 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1473 char const *yymsgp =
YY_(
"syntax error");
1474 int yysyntax_error_status;
1475 yysyntax_error_status = YYSYNTAX_ERROR;
1476 if (yysyntax_error_status == 0)
1478 else if (yysyntax_error_status == 1)
1480 if (yymsg != yymsgbuf)
1486 yymsg_alloc =
sizeof yymsgbuf;
1487 yysyntax_error_status = 2;
1491 yysyntax_error_status = YYSYNTAX_ERROR;
1496 if (yysyntax_error_status == 2)
1497 goto yyexhaustedlab;
1499 # undef YYSYNTAX_ERROR
1505 if (yyerrstatus == 3)
1607 #if !defined yyoverflow || YYERROR_VERBOSE
1634 while (yyssp != yyss)
1645 if (yymsg != yymsgbuf)
1650 #line 92 "readcf.yy"
1670 while ((c =
defaultin->get()) ==
' ' || c ==
'\t' || c ==
'\n' ) ;
1671 if ( isdigit( c ) ) {
1676 else if ( isalpha( c ) ) {
1699 this->yylval =
Variable( (
char)c );
1707 this->yylval =
Variable( (
char)c );
1722 YY_parse_CLASS my_parser;
1724 if ( my_parser.yyparse() == 0 ) {
1749 static char * buffer = 0;
1750 static int bufsize = 0;
1752 if ( buffer == 0 ) {
1754 buffer =
new char[bufsize];
1756 int i = 0, c, goon = 1;
1758 while ( isdigit( c =
s.get() ) &&
i < bufsize - 2 ) {
1762 if ( isdigit( c ) ) {
1764 char * newbuffer = (
char*)memcpy(
new char[bufsize], buffer, bufsize - 1000 );