49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
64 #define YYLSP_NEEDED 0
67 #define yyparse csv_parse
69 #define yyerror csv_error
70 #define yylval csv_lval
71 #define yychar csv_char
72 #define yydebug csv_debug
73 #define yynerrs csv_nerrs
113 #define YYERROR_VERBOSE 42
115 #define YYMAXDEPTH 1000000
128 #line 129 "parse_csv.cpp"
136 #ifdef YYERROR_VERBOSE
137 # undef YYERROR_VERBOSE
138 # define YYERROR_VERBOSE 1
140 # define YYERROR_VERBOSE 0
144 #ifndef YYTOKEN_TABLE
145 # define YYTOKEN_TABLE 0
162 #define InvalidCharacter 258
164 #define Identifier 260
170 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
175 #line 57 "parse_csv.y"
185 #line 186 "parse_csv.cpp"
187 # define YYSTYPE_IS_TRIVIAL 1
188 # define yystype YYSTYPE
189 # define YYSTYPE_IS_DECLARED 1
197 #line 198 "parse_csv.cpp"
211 #elif (defined __STDC__ || defined __C99__FUNC__ \
212 || defined __cplusplus || defined _MSC_VER)
231 # ifdef __SIZE_TYPE__
232 # define YYSIZE_T __SIZE_TYPE__
233 # elif defined size_t
234 # define YYSIZE_T size_t
235 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
236 || defined __cplusplus || defined _MSC_VER)
238 # define YYSIZE_T size_t
240 # define YYSIZE_T unsigned int
244 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
249 # include <libintl.h>
250 # define YY_(msgid) dgettext ("bison-runtime", msgid)
254 # define YY_(msgid) msgid
259 #if ! defined lint || defined __GNUC__
260 # define YYUSE(e) ((void) (e))
269 #if (defined __STDC__ || defined __C99__FUNC__ \
270 || defined __cplusplus || defined _MSC_VER)
283 #if ! defined yyoverflow || YYERROR_VERBOSE
287 # ifdef YYSTACK_USE_ALLOCA
288 # if YYSTACK_USE_ALLOCA
290 # define YYSTACK_ALLOC __builtin_alloca
291 # elif defined __BUILTIN_VA_ARG_INCR
294 # define YYSTACK_ALLOC __alloca
295 # elif defined _MSC_VER
297 # define alloca _alloca
299 # define YYSTACK_ALLOC alloca
300 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
301 || defined __cplusplus || defined _MSC_VER)
311 # ifdef YYSTACK_ALLOC
313 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
314 # ifndef YYSTACK_ALLOC_MAXIMUM
319 # define YYSTACK_ALLOC_MAXIMUM 4032
322 # define YYSTACK_ALLOC YYMALLOC
323 # define YYSTACK_FREE YYFREE
324 # ifndef YYSTACK_ALLOC_MAXIMUM
325 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
327 # if (defined __cplusplus && ! defined _STDLIB_H \
328 && ! ((defined YYMALLOC || defined malloc) \
329 && (defined YYFREE || defined free)))
336 # define YYMALLOC malloc
337 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
338 || defined __cplusplus || defined _MSC_VER)
344 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
345 || defined __cplusplus || defined _MSC_VER)
353 #if (! defined yyoverflow \
354 && (! defined __cplusplus \
355 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
365 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
369 # define YYSTACK_BYTES(N) \
370 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
371 + YYSTACK_GAP_MAXIMUM)
376 # if defined __GNUC__ && 1 < __GNUC__
377 # define YYCOPY(To, From, Count) \
378 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
380 # define YYCOPY(To, From, Count) \
384 for (yyi = 0; yyi < (Count); yyi++) \
385 (To)[yyi] = (From)[yyi]; \
396 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
399 YYSIZE_T yynewbytes; \
400 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
401 Stack = &yyptr->Stack_alloc; \
402 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
403 yyptr += yynewbytes / sizeof (*yyptr); \
425 #define YYMAXUTOK 261
427 #define YYTRANSLATE(YYX) \
428 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
433 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 7, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
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, 2, 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, 1, 2, 3, 4,
467 0, 0, 3, 6, 8, 12, 14, 15, 18, 21,
468 24, 25, 29, 31, 34, 36, 37
474 9, 0, -1, 12, 13, -1, 13, -1, 7, 5,
475 7, -1, 5, -1, -1, 10, 11, -1, 11, 6,
476 -1, 6, 12, -1, -1, 14, 6, 13, -1, 14,
477 -1, 6, 13, -1, 15, -1, -1, 4, 15, -1
483 0, 72, 72, 76, 82, 85, 90, 91, 100, 103,
484 108, 109, 113, 116, 121, 124, 125
488 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
491 static const char *
const yytname[] =
493 "$end",
"error",
"$undefined",
"InvalidCharacter",
"Float",
494 "Identifier",
"Eol",
"'\"'",
"$accept",
"Input",
"Header",
"HeaderList",
495 "HeaderLine",
"DataSet",
"DataLine",
"DataList", 0
504 0, 256, 257, 258, 259, 260, 261, 34
511 0, 8, 9, 9, 10, 10, 11, 11, 12, 12,
512 13, 13, 13, 13, 14, 15, 15
518 0, 2, 2, 1, 3, 1, 0, 2, 2, 2,
527 10, 15, 5, 10, 0, 0, 6, 0, 10, 3,
528 12, 14, 16, 9, 13, 0, 1, 7, 8, 10,
535 -1, 5, 6, 7, 8, 14, 10, 11
540 #define YYPACT_NINF -4
543 -3, 1, -4, -3, 8, 11, 2, 9, 6, -4,
544 10, -4, -4, -4, -4, -1, -4, -4, -4, 6,
551 -4, -4, -4, 12, 14, 0, -4, 13
558 #define YYTABLE_NINF -1
561 9, 1, 2, 3, 4, 1, 22, 2, 20, 4,
562 1, 16, 19, 15, 12, 18, 21, 13, 17, 0,
568 0, 4, 5, 6, 7, 4, 7, 5, 8, 7,
569 4, 0, 6, 5, 1, 6, 6, 3, 6, -1,
577 0, 4, 5, 6, 7, 9, 10, 11, 12, 13,
578 14, 15, 15, 12, 13, 5, 0, 11, 6, 6,
582 #define yyerrok (yyerrstatus = 0)
583 #define yyclearin (yychar = YYEMPTY)
587 #define YYACCEPT goto yyacceptlab
588 #define YYABORT goto yyabortlab
589 #define YYERROR goto yyerrorlab
596 #define YYFAIL goto yyerrlab
598 #define YYRECOVERING() (!!yyerrstatus)
600 #define YYBACKUP(Token, Value) \
602 if (yychar == YYEMPTY && yylen == 1) \
606 yytoken = YYTRANSLATE (yychar); \
612 yyerror (YY_("syntax error: cannot back up")); \
619 #define YYERRCODE 256
626 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
627 #ifndef YYLLOC_DEFAULT
628 # define YYLLOC_DEFAULT(Current, Rhs, N) \
632 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
633 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
634 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
635 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
639 (Current).first_line = (Current).last_line = \
640 YYRHSLOC (Rhs, 0).last_line; \
641 (Current).first_column = (Current).last_column = \
642 YYRHSLOC (Rhs, 0).last_column; \
652 #ifndef YY_LOCATION_PRINT
653 # if YYLTYPE_IS_TRIVIAL
654 # define YY_LOCATION_PRINT(File, Loc) \
655 fprintf (File, "%d.%d-%d.%d", \
656 (Loc).first_line, (Loc).first_column, \
657 (Loc).last_line, (Loc).last_column)
659 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
667 # define YYLEX yylex (YYLEX_PARAM)
669 # define YYLEX yylex ()
677 # define YYFPRINTF fprintf
680 # define YYDPRINTF(Args) \
686 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
690 YYFPRINTF (stderr, "%s ", Title); \
691 yy_symbol_print (stderr, \
693 YYFPRINTF (stderr, "\n"); \
703 #if (defined __STDC__ || defined __C99__FUNC__ \
704 || defined __cplusplus || defined _MSC_VER)
709 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
719 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
735 #if (defined __STDC__ || defined __C99__FUNC__ \
736 || defined __cplusplus || defined _MSC_VER)
738 yy_symbol_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep)
741 yy_symbol_print (yyoutput, yytype, yyvaluep)
744 YYSTYPE const * const yyvaluep;
748 YYFPRINTF (yyoutput,
"token %s (", yytname[yytype]);
750 YYFPRINTF (yyoutput,
"nterm %s (", yytname[yytype]);
752 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
761 #if (defined __STDC__ || defined __C99__FUNC__ \
762 || defined __cplusplus || defined _MSC_VER)
767 yy_stack_print (yybottom, yytop)
773 for (; yybottom <=
yytop; yybottom++)
775 int yybot = *yybottom;
781 # define YY_STACK_PRINT(Bottom, Top) \
784 yy_stack_print ((Bottom), (Top)); \
792 #if (defined __STDC__ || defined __C99__FUNC__ \
793 || defined __cplusplus || defined _MSC_VER)
798 yy_reduce_print (yyvsp, yyrule)
803 int yynrhs = yyr2[
yyrule];
806 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
809 for (yyi = 0; yyi < yynrhs; yyi++)
812 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
813 &(yyvsp[(yyi + 1) - (yynrhs)])
819 # define YY_REDUCE_PRINT(Rule) \
822 yy_reduce_print (yyvsp, Rule); \
829 # define YYDPRINTF(Args)
830 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
831 # define YY_STACK_PRINT(Bottom, Top)
832 # define YY_REDUCE_PRINT(Rule)
838 # define YYINITDEPTH 200
849 # define YYMAXDEPTH 10000
857 # if defined __GLIBC__ && defined _STRING_H
858 # define yystrlen strlen
861 #if (defined __STDC__ || defined __C99__FUNC__ \
862 || defined __cplusplus || defined _MSC_VER)
864 yystrlen (
const char *yystr)
872 for (yylen = 0; yystr[
yylen]; yylen++)
880 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
881 # define yystpcpy stpcpy
885 #if (defined __STDC__ || defined __C99__FUNC__ \
886 || defined __cplusplus || defined _MSC_VER)
888 yystpcpy (
char *yydest,
const char *
yysrc)
891 yystpcpy (yydest, yysrc)
899 while ((*yyd++ = *yys++) !=
'\0')
916 yytnamerr (
char *yyres,
const char *yystr)
921 char const *yyp = yystr;
928 goto do_not_strip_quotes;
932 goto do_not_strip_quotes;
945 do_not_strip_quotes: ;
949 return yystrlen (yystr);
951 return yystpcpy (yyres, yystr) - yyres;
963 yysyntax_error (
char *yyresult,
int yystate,
int yychar)
965 int yyn = yypact[yystate];
972 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
975 int yysize_overflow = 0;
976 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
977 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
983 YY_(
"syntax error, unexpected %s");
984 YY_(
"syntax error, unexpected %s, expecting %s");
985 YY_(
"syntax error, unexpected %s, expecting %s or %s");
986 YY_(
"syntax error, unexpected %s, expecting %s or %s or %s");
987 YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s");
991 static char const yyunexpected[] =
"syntax error, unexpected %s";
992 static char const yyexpecting[] =
", expecting %s";
993 static char const yyor[] =
" or %s";
994 char yyformat[
sizeof yyunexpected
995 +
sizeof yyexpecting - 1
996 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
997 * (
sizeof yyor - 1))];
998 char const *yyprefix = yyexpecting;
1002 int yyxbegin = yyn < 0 ? -yyn : 0;
1005 int yychecklim =
YYLAST - yyn + 1;
1009 yyarg[0] = yytname[
yytype];
1010 yyfmt = yystpcpy (yyformat, yyunexpected);
1012 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1013 if (yycheck[yyx + yyn] == yyx && yyx !=
YYTERROR)
1015 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1019 yyformat[
sizeof yyunexpected - 1] =
'\0';
1022 yyarg[yycount++] = yytname[yyx];
1023 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1024 yysize_overflow |= (yysize1 < yysize);
1026 yyfmt = yystpcpy (yyfmt, yyprefix);
1030 yyf =
YY_(yyformat);
1031 yysize1 = yysize + yystrlen (yyf);
1032 yysize_overflow |= (yysize1 < yysize);
1035 if (yysize_overflow)
1043 char *yyp = yyresult;
1045 while ((*yyp = *yyf) !=
'\0')
1047 if (*yyp ==
'%' && yyf[1] ==
's' && yyi < yycount)
1049 yyp += yytnamerr (yyp, yyarg[yyi++]);
1070 #if (defined __STDC__ || defined __C99__FUNC__ \
1071 || defined __cplusplus || defined _MSC_VER)
1073 yydestruct (
const char *yymsg,
int yytype,
YYSTYPE *yyvaluep)
1076 yydestruct (yymsg, yytype, yyvaluep)
1097 #ifdef YYPARSE_PARAM
1098 #if defined __STDC__ || defined __cplusplus
1099 int yyparse (
void *YYPARSE_PARAM);
1104 #if defined __STDC__ || defined __cplusplus
1127 #ifdef YYPARSE_PARAM
1128 #if (defined __STDC__ || defined __C99__FUNC__ \
1129 || defined __cplusplus || defined _MSC_VER)
1135 void *YYPARSE_PARAM;
1138 #if (defined __STDC__ || defined __C99__FUNC__ \
1139 || defined __cplusplus || defined _MSC_VER)
1185 char *yymsg = yymsgbuf;
1186 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1189 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1200 YYDPRINTF ((stderr,
"Starting parse\n"));
1227 if (yyss + yystacksize - 1 <= yyssp)
1230 YYSIZE_T yysize = yyssp - yyss + 1;
1244 yyoverflow (
YY_(
"memory exhausted"),
1245 &yyss1, yysize *
sizeof (*yyssp),
1246 &yyvs1, yysize *
sizeof (*yyvsp),
1253 # ifndef YYSTACK_RELOCATE
1254 goto yyexhaustedlab;
1258 goto yyexhaustedlab;
1268 goto yyexhaustedlab;
1271 # undef YYSTACK_RELOCATE
1278 yyssp = yyss + yysize - 1;
1279 yyvsp = yyvs + yysize - 1;
1281 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1282 (
unsigned long int) yystacksize));
1284 if (yyss + yystacksize - 1 <= yyssp)
1288 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1304 yyn = yypact[yystate];
1313 YYDPRINTF ((stderr,
"Reading a token: "));
1317 if (yychar <=
YYEOF)
1319 yychar = yytoken =
YYEOF;
1320 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1331 if (yyn < 0 ||
YYLAST < yyn || yycheck[yyn] != yytoken)
1363 yyn = yydefact[yystate];
1384 yyval = yyvsp[1-
yylen];
1393 #line 72 "parse_csv.y"
1403 #line 76 "parse_csv.y"
1412 #line 82 "parse_csv.y"
1414 (yyval.
ident) = strdup ((yyvsp[(2) - (3)].ident));
1421 #line 85 "parse_csv.y"
1423 (yyval.
ident) = strdup ((yyvsp[(1) - (1)].ident));
1430 #line 90 "parse_csv.y"
1431 { (yyval.
list) = NULL; }
1437 #line 91 "parse_csv.y"
1439 if ((yyvsp[(2) - (2)].list) == NULL) (yyvsp[(2) - (2)].list) =
new strlist ();
1440 (yyvsp[(2) - (2)].
list)->add ((yyvsp[(1) - (2)].ident));
1441 (yyval.
list) = (yyvsp[(2) - (2)].list);
1442 free ((yyvsp[(1) - (2)].ident));
1449 #line 100 "parse_csv.y"
1451 (yyval.
list) = (yyvsp[(1) - (2)].list);
1458 #line 103 "parse_csv.y"
1460 (yyval.
list) = (yyvsp[(2) - (2)].list);
1467 #line 108 "parse_csv.y"
1468 { (yyval.
v) = NULL; }
1474 #line 109 "parse_csv.y"
1476 (yyvsp[(1) - (3)].
v)->setNext ((yyvsp[(3) - (3)].v));
1477 (yyval.
v) = (yyvsp[(1) - (3)].v);
1484 #line 113 "parse_csv.y"
1486 (yyval.
v) = (yyvsp[(1) - (1)].v);
1493 #line 116 "parse_csv.y"
1495 (yyval.
v) = (yyvsp[(2) - (2)].v);
1502 #line 124 "parse_csv.y"
1503 { (yyval.
v) = NULL; }
1509 #line 125 "parse_csv.y"
1511 if ((yyvsp[(2) - (2)].v) == NULL) (yyvsp[(2) - (2)].v) =
new vector ();
1512 (yyvsp[(2) - (2)].
v)->add ((yyvsp[(1) - (2)].f));
1513 (yyval.
v) = (yyvsp[(2) - (2)].v);
1520 #line 1521 "parse_csv.cpp"
1537 yystate = yypgoto[yyn -
YYNTOKENS] + *yyssp;
1538 if (0 <= yystate && yystate <=
YYLAST && yycheck[yystate] == *yyssp)
1539 yystate = yytable[yystate];
1554 #if ! YYERROR_VERBOSE
1558 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1564 if (yymsg != yymsgbuf)
1572 yymsg_alloc =
sizeof yymsgbuf;
1576 if (0 < yysize && yysize <= yymsg_alloc)
1578 (void) yysyntax_error (yymsg, yystate, yychar);
1585 goto yyexhaustedlab;
1593 if (yyerrstatus == 3)
1598 if (yychar <=
YYEOF)
1601 if (yychar ==
YYEOF)
1606 yydestruct (
"Error: discarding",
1645 yyn = yypact[yystate];
1662 yydestruct (
"Error: popping",
1663 yystos[yystate], yyvsp);
1693 #if !defined(yyoverflow) || YYERROR_VERBOSE
1705 yydestruct (
"Cleanup: discarding lookahead",
1711 while (yyssp != yyss)
1713 yydestruct (
"Cleanup: popping",
1714 yystos[*yyssp], yyvsp);
1722 if (yymsg != yymsgbuf)
1726 return YYID (yyresult);
1732 #line 132 "parse_csv.y"