40#define YYSKELETON_NAME "yacc.c"
103#define LIST_COMMENT 277
104#define ID_LIST_SINGLE 278
105#define IF_KEYWORD 279
106#define ELSE_KEYWORD 280
107#define ENDIF_KEYWORD 281
115#line 1 "autotools.yy"
153#include <tqvaluestack.h>
154#include "autotoolsast.h"
156#define YYSTYPE_IS_DECLARED
158using namespace AutoTools;
189typedef Result YYSTYPE;
191void yyerror(
const char *str) {
192 printf(
"bison error: %s\n", str);
209TQValueStack<ProjectAST*> projects;
232#ifdef YYERROR_VERBOSE
233# undef YYERROR_VERBOSE
234# define YYERROR_VERBOSE 1
236# define YYERROR_VERBOSE 0
239#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
241# define yystype YYSTYPE
242# define YYSTYPE_IS_DECLARED 1
243# define YYSTYPE_IS_TRIVIAL 1
252#line 253 "autotools_yacc.cpp"
254#if ! defined (yyoverflow) || YYERROR_VERBOSE
260# define YYMALLOC malloc
265# ifdef YYSTACK_USE_ALLOCA
266# if YYSTACK_USE_ALLOCA
267# define YYSTACK_ALLOC alloca
270# if defined (alloca) || defined (_ALLOCA_H)
271# define YYSTACK_ALLOC alloca
274# define YYSTACK_ALLOC __builtin_alloca
281# define YYSTACK_FREE(Ptr) do { ; } while (0)
283# if defined (__STDC__) || defined (__cplusplus)
285# define YYSIZE_T size_t
287# define YYSTACK_ALLOC YYMALLOC
288# define YYSTACK_FREE YYFREE
293#if (! defined (yyoverflow) \
294 && (! defined (__cplusplus) \
295 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
305# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
309# define YYSTACK_BYTES(N) \
310 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
311 + YYSTACK_GAP_MAXIMUM)
316# if defined (__GNUC__) && 1 < __GNUC__
317# define YYCOPY(To, From, Count) \
318 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
320# define YYCOPY(To, From, Count) \
324 for (yyi = 0; yyi < (Count); yyi++) \
325 (To)[yyi] = (From)[yyi]; \
336# define YYSTACK_RELOCATE(Stack) \
339 YYSIZE_T yynewbytes; \
340 YYCOPY (&yyptr->Stack, Stack, yysize); \
341 Stack = &yyptr->Stack; \
342 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
343 yyptr += yynewbytes / sizeof (*yyptr); \
349#if defined (__STDC__) || defined (__cplusplus)
350 typedef signed char yysigned_char;
352 typedef short int yysigned_char;
373#define YYTRANSLATE(YYX) \
374 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
377static const unsigned char yytranslate[] =
379 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
382 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
384 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
405 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
406 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
413static const unsigned char yyprhs[] =
415 0, 0, 3, 4, 7, 10, 11, 13, 15, 17,
416 19, 21, 23, 25, 27, 29, 32, 34, 37, 39,
417 42, 46, 49, 51, 54, 55, 58, 61, 63, 65,
418 69, 71, 74, 76, 78, 81
422static const yysigned_char yyrhs[] =
424 30, 0, -1, -1, 31, 32, -1, 32, 33, -1,
425 -1, 37, -1, 34, -1, 36, -1, 35, -1, 41,
426 -1, 42, -1, 43, -1, 45, -1, 46, -1, 24,
427 38, -1, 26, -1, 26, 38, -1, 25, -1, 25,
428 38, -1, 38, 44, 39, -1, 3, 38, -1, 3,
429 -1, 39, 40, -1, -1, 4, 17, -1, 23, 14,
430 -1, 17, -1, 22, -1, 38, 12, 39, -1, 28,
431 -1, 27, 38, -1, 6, -1, 7, -1, 16, 14,
436static const unsigned short int yyrline[] =
438 0, 142, 142, 142, 149, 175, 178, 182, 186, 190,
439 194, 198, 202, 206, 210, 216, 224, 230, 239, 245,
440 254, 264, 266, 269, 273, 276, 277, 278, 279, 282,
441 291, 299, 308, 308, 311, 319
445#if YYDEBUG || YYERROR_VERBOSE
448static const char *
const yytname[] =
450 "$end",
"error",
"$undefined",
"ID_SIMPLE",
"ID_LIST",
"LBRACE",
"EQ",
451 "PLUSEQ",
"MINUSQE",
"STAREQ",
"TILDEEQ",
"RBRACE",
"COLON",
"NUMSIGN",
452 "NEWLINE",
"NUMBER",
"COMMENT",
"CONT",
"DOT",
"RCURLY",
"LCURLY",
453 "ID_ARGS",
"LIST_COMMENT",
"ID_LIST_SINGLE",
"IF_KEYWORD",
454 "ELSE_KEYWORD",
"ENDIF_KEYWORD",
"KEYWORD",
"RULE",
"$accept",
"project",
455 "@1",
"statements",
"statement",
"automake_if",
"endif_statement",
456 "else_statement",
"variable_assignment",
"scoped_identifier",
457 "multiline_values",
"line_body",
"target",
"am_rule",
458 "include_directive",
"operator",
"comment",
"emptyline", 0
465static const unsigned short int yytoknum[] =
467 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
468 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
469 275, 276, 277, 278, 279, 280, 281, 282, 283
474static const unsigned char yyr1[] =
476 0, 29, 31, 30, 32, 32, 33, 33, 33, 33,
477 33, 33, 33, 33, 33, 34, 35, 35, 36, 36,
478 37, 38, 38, 39, 39, 40, 40, 40, 40, 41,
479 42, 43, 44, 44, 45, 46
483static const unsigned char yyr2[] =
485 0, 2, 0, 2, 2, 0, 1, 1, 1, 1,
486 1, 1, 1, 1, 1, 2, 1, 2, 1, 2,
487 3, 2, 1, 2, 0, 2, 2, 1, 1, 3,
494static const unsigned char yydefact[] =
496 2, 0, 5, 1, 3, 22, 35, 0, 0, 18,
497 16, 0, 30, 4, 7, 9, 8, 6, 0, 10,
498 11, 12, 13, 14, 21, 34, 15, 19, 17, 31,
499 32, 33, 24, 24, 29, 20, 0, 27, 28, 0,
504static const yysigned_char yydefgoto[] =
506 -1, 1, 2, 4, 13, 14, 15, 16, 17, 18,
507 34, 40, 19, 20, 21, 33, 22, 23
512#define YYPACT_NINF -18
513static const yysigned_char yypact[] =
515 -18, 2, -18, -18, -3, 0, -18, -6, 0, 0,
516 0, 0, -18, -18, -18, -18, -18, -18, 3, -18,
517 -18, -18, -18, -18, -18, -18, -18, -18, -18, -18,
518 -18, -18, -18, -18, 10, 10, -5, -18, -18, 4,
523static const yysigned_char yypgoto[] =
525 -18, -18, -18, -18, -18, -18, -18, -18, -18, -4,
526 -17, -18, -18, -18, -18, -18, -18, -18
533#define YYTABLE_NINF -1
534static const unsigned char yytable[] =
536 5, 24, 3, 5, 26, 27, 28, 29, 25, 30,
537 31, 6, 41, 7, 36, 32, 35, 0, 42, 0,
538 0, 8, 9, 10, 11, 12, 0, 37, 0, 0,
542static const yysigned_char yycheck[] =
544 3, 5, 0, 3, 8, 9, 10, 11, 14, 6,
545 7, 14, 17, 16, 4, 12, 33, -1, 14, -1,
546 -1, 24, 25, 26, 27, 28, -1, 17, -1, -1,
552static const unsigned char yystos[] =
554 0, 30, 31, 0, 32, 3, 14, 16, 24, 25,
555 26, 27, 28, 33, 34, 35, 36, 37, 38, 41,
556 42, 43, 45, 46, 38, 14, 38, 38, 38, 38,
557 6, 7, 12, 44, 39, 39, 4, 17, 22, 23,
561#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
562# define YYSIZE_T __SIZE_TYPE__
564#if ! defined (YYSIZE_T) && defined (size_t)
565# define YYSIZE_T size_t
567#if ! defined (YYSIZE_T)
568# if defined (__STDC__) || defined (__cplusplus)
570# define YYSIZE_T size_t
573#if ! defined (YYSIZE_T)
574# define YYSIZE_T unsigned int
577#define yyerrok (yyerrstatus = 0)
578#define yyclearin (yychar = YYEMPTY)
582#define YYACCEPT goto yyacceptlab
583#define YYABORT goto yyabortlab
584#define YYERROR goto yyerrorlab
591#define YYFAIL goto yyerrlab
593#define YYRECOVERING() (!!yyerrstatus)
595#define YYBACKUP(Token, Value) \
597 if (yychar == YYEMPTY && yylen == 1) \
601 yytoken = YYTRANSLATE (yychar); \
607 yyerror ("syntax error: cannot back up");\
618#ifndef YYLLOC_DEFAULT
619# define YYLLOC_DEFAULT(Current, Rhs, N) \
620 ((Current).first_line = (Rhs)[1].first_line, \
621 (Current).first_column = (Rhs)[1].first_column, \
622 (Current).last_line = (Rhs)[N].last_line, \
623 (Current).last_column = (Rhs)[N].last_column)
629# define YYLEX yylex (YYLEX_PARAM)
631# define YYLEX yylex ()
639# define YYFPRINTF fprintf
642# define YYDPRINTF(Args) \
648# define YYDSYMPRINT(Args) \
654# define YYDSYMPRINTF(Title, Token, Value, Location) \
658 YYFPRINTF (stderr, "%s ", Title); \
659 yysymprint (stderr, \
661 YYFPRINTF (stderr, "\n"); \
670#if defined (__STDC__) || defined (__cplusplus)
672yy_stack_print (
short int *bottom,
short int *top)
675yy_stack_print (bottom, top)
680 YYFPRINTF (stderr,
"Stack now");
681 for (; bottom <= top; ++bottom)
682 YYFPRINTF (stderr,
" %d", *bottom);
683 YYFPRINTF (stderr,
"\n");
686# define YY_STACK_PRINT(Bottom, Top) \
689 yy_stack_print ((Bottom), (Top)); \
697#if defined (__STDC__) || defined (__cplusplus)
699yy_reduce_print (
int yyrule)
702yy_reduce_print (yyrule)
707 unsigned int yylno = yyrline[yyrule];
708 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %u), ",
711 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
712 YYFPRINTF (stderr,
"%s ", yytname [yyrhs[yyi]]);
713 YYFPRINTF (stderr,
"-> %s\n", yytname [yyr1[yyrule]]);
716# define YY_REDUCE_PRINT(Rule) \
719 yy_reduce_print (Rule); \
726# define YYDPRINTF(Args)
727# define YYDSYMPRINT(Args)
728# define YYDSYMPRINTF(Title, Token, Value, Location)
729# define YY_STACK_PRINT(Bottom, Top)
730# define YY_REDUCE_PRINT(Rule)
736# define YYINITDEPTH 200
746#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
751# define YYMAXDEPTH 10000
759# if defined (__GLIBC__) && defined (_STRING_H)
760# define yystrlen strlen
764# if defined (__STDC__) || defined (__cplusplus)
765yystrlen (
const char *yystr)
771 const char *yys = yystr;
773 while (*yys++ !=
'\0')
776 return yys - yystr - 1;
782# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
783# define yystpcpy stpcpy
788# if defined (__STDC__) || defined (__cplusplus)
789yystpcpy (
char *yydest,
const char *yysrc)
791yystpcpy (yydest, yysrc)
797 const char *yys = yysrc;
799 while ((*yyd++ = *yys++) !=
'\0')
816#if defined (__STDC__) || defined (__cplusplus)
818yysymprint (FILE *yyoutput,
int yytype, YYSTYPE *yyvaluep)
821yysymprint (yyoutput, yytype, yyvaluep)
830 if (yytype < YYNTOKENS)
832 YYFPRINTF (yyoutput,
"token %s (", yytname[yytype]);
834 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
838 YYFPRINTF (yyoutput,
"nterm %s (", yytname[yytype]);
845 YYFPRINTF (yyoutput,
")");
853#if defined (__STDC__) || defined (__cplusplus)
855yydestruct (
int yytype, YYSTYPE *yyvaluep)
858yydestruct (yytype, yyvaluep)
878# if defined (__STDC__) || defined (__cplusplus)
879int yyparse (
void *YYPARSE_PARAM);
884#if defined (__STDC__) || defined (__cplusplus)
909# if defined (__STDC__) || defined (__cplusplus)
910int yyparse (
void *YYPARSE_PARAM)
912int yyparse (YYPARSE_PARAM)
916#if defined (__STDC__) || defined (__cplusplus)
944 short int yyssa[YYINITDEPTH];
945 short int *yyss = yyssa;
949 YYSTYPE yyvsa[YYINITDEPTH];
950 YYSTYPE *yyvs = yyvsa;
955#define YYPOPSTACK (yyvsp--, yyssp--)
957 YYSIZE_T yystacksize = YYINITDEPTH;
968 YYDPRINTF ((stderr,
"Starting parse\n"));
998 if (yyss + yystacksize - 1 <= yyssp)
1001 YYSIZE_T yysize = yyssp - yyss + 1;
1008 YYSTYPE *yyvs1 = yyvs;
1009 short int *yyss1 = yyss;
1016 yyoverflow (
"parser stack overflow",
1017 &yyss1, yysize *
sizeof (*yyssp),
1018 &yyvs1, yysize *
sizeof (*yyvsp),
1026# ifndef YYSTACK_RELOCATE
1030 if (YYMAXDEPTH <= yystacksize)
1033 if (YYMAXDEPTH < yystacksize)
1034 yystacksize = YYMAXDEPTH;
1037 short int *yyss1 = yyss;
1038 union yyalloc *yyptr =
1039 (
union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1042 YYSTACK_RELOCATE (yyss);
1043 YYSTACK_RELOCATE (yyvs);
1045# undef YYSTACK_RELOCATE
1047 YYSTACK_FREE (yyss1);
1052 yyssp = yyss + yysize - 1;
1053 yyvsp = yyvs + yysize - 1;
1056 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1057 (
unsigned long int) yystacksize));
1059 if (yyss + yystacksize - 1 <= yyssp)
1063 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1078 yyn = yypact[yystate];
1079 if (yyn == YYPACT_NINF)
1085 if (yychar == YYEMPTY)
1087 YYDPRINTF ((stderr,
"Reading a token: "));
1091 if (yychar <= YYEOF)
1093 yychar = yytoken = YYEOF;
1094 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1098 yytoken = YYTRANSLATE (yychar);
1099 YYDSYMPRINTF (
"Next token is", yytoken, &yylval, &yylloc);
1105 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1110 if (yyn == 0 || yyn == YYTABLE_NINF)
1120 YYDPRINTF ((stderr,
"Shifting token %s, ", yytname[yytoken]));
1123 if (yychar != YYEOF)
1142 yyn = yydefact[yystate];
1163 yyval = yyvsp[1-yylen];
1166 YY_REDUCE_PRINT (yyn);
1170#line 142 "autotools.yy"
1173 projects.push(projectAST);
1178#line 150 "autotools.yy"
1180 projects.top()->addChildAST(yyvsp[0].node);
1207#line 179 "autotools.yy"
1209 yyval.node = yyvsp[0].node;
1214#line 183 "autotools.yy"
1216 yyval.node = yyvsp[0].node;
1221#line 187 "autotools.yy"
1223 yyval.node = yyvsp[0].node;
1228#line 191 "autotools.yy"
1230 yyval.node = yyvsp[0].node;
1235#line 195 "autotools.yy"
1237 yyval.node = yyvsp[0].node;
1242#line 199 "autotools.yy"
1244 yyval.node = yyvsp[0].node;
1249#line 203 "autotools.yy"
1251 yyval.node = yyvsp[0].node;
1256#line 207 "autotools.yy"
1258 yyval.node = yyvsp[0].node;
1263#line 211 "autotools.yy"
1270#line 217 "autotools.yy"
1272 ConditionAST* projectAST =
new ConditionAST();
1273 projectAST->type =
"if";
1274 projectAST->conditionName = yyvsp[0].value;
1275 yyval.node = projectAST;
1280#line 225 "autotools.yy"
1282 ConditionAST* past =
new ConditionAST();
1283 past->type=
"endif";
1289#line 231 "autotools.yy"
1291 ConditionAST* past =
new ConditionAST();
1292 past->type=
"endif";
1293 past->conditionName = yyvsp[0].value;
1299#line 240 "autotools.yy"
1301 ConditionAST* past =
new ConditionAST();
1302 past->type =
"else";
1308#line 246 "autotools.yy"
1310 ConditionAST* past =
new ConditionAST();
1311 past->type =
"else";
1312 past->conditionName = yyvsp[0].value;
1318#line 255 "autotools.yy"
1322 node->
op = yyvsp[-1].value;
1323 node->
values = yyvsp[0].values;
1329#line 265 "autotools.yy"
1330 { yyval.value = yyvsp[-1].value + yyvsp[0].value; ;}
1334#line 270 "autotools.yy"
1336 yyval.values.append(yyvsp[0].value);
1341#line 273 "autotools.yy"
1342 { yyval.values.clear(); ;}
1346#line 276 "autotools.yy"
1347 { yyval.value = yyvsp[-1].value +
" \\\n"; ;}
1351#line 277 "autotools.yy"
1352 { yyval.value = yyvsp[-1].value +
"\n"; ;}
1356#line 278 "autotools.yy"
1357 { yyval.value =
"\\\n"; ;}
1361#line 283 "autotools.yy"
1363 AutomakeTargetAST *node =
new AutomakeTargetAST();
1364 node->target = yyvsp[-2].value;
1365 node->deps = yyvsp[0].values;
1371#line 292 "autotools.yy"
1380#line 300 "autotools.yy"
1384 node->
values = TQStringList(yyvsp[0].value);
1390#line 312 "autotools.yy"
1393 node->
comment = yyvsp[-1].value +
"\n";
1402#line 1403 "autotools_yacc.cpp"
1408 YY_STACK_PRINT (yyss, yyssp);
1419 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1420 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1421 yystate = yytable[yystate];
1423 yystate = yydefgoto[yyn - YYNTOKENS];
1437 yyn = yypact[yystate];
1439 if (YYPACT_NINF < yyn && yyn < YYLAST)
1441 YYSIZE_T yysize = 0;
1442 int yytype = YYTRANSLATE (yychar);
1443 const char* yyprefix;
1449 int yyxbegin = yyn < 0 ? -yyn : 0;
1452 int yychecklim = YYLAST - yyn;
1453 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1456 yyprefix =
", expecting ";
1457 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1458 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1460 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1468 yysize += (
sizeof (
"syntax error, unexpected ")
1469 + yystrlen (yytname[yytype]));
1470 yymsg = (
char *) YYSTACK_ALLOC (yysize);
1473 char *yyp = yystpcpy (yymsg,
"syntax error, unexpected ");
1474 yyp = yystpcpy (yyp, yytname[yytype]);
1478 yyprefix =
", expecting ";
1479 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1480 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1482 yyp = yystpcpy (yyp, yyprefix);
1483 yyp = yystpcpy (yyp, yytname[yyx]);
1488 YYSTACK_FREE (yymsg);
1491 yyerror (
"syntax error; also virtual memory exhausted");
1495 yyerror (
"syntax error");
1500 if (yyerrstatus == 3)
1505 if (yychar <= YYEOF)
1509 if (yychar == YYEOF)
1515 YYDSYMPRINTF (
"Error: popping", yystos[*yyssp], yyvsp, yylsp);
1516 yydestruct (yystos[*yyssp], yyvsp);
1521 YYDSYMPRINTF (
"Error: discarding", yytoken, &yylval, &yylloc);
1522 yydestruct (yytoken, &yylval);
1559 yyn = yypact[yystate];
1560 if (yyn != YYPACT_NINF)
1563 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1575 YYDSYMPRINTF (
"Error: popping", yystos[*yyssp], yyvsp, yylsp);
1576 yydestruct (yystos[yystate], yyvsp);
1579 YY_STACK_PRINT (yyss, yyssp);
1585 YYDPRINTF ((stderr,
"Shifting error token, "));
1613 yyerror (
"parser stack overflow");
1621 YYSTACK_FREE (yyss);
1627#line 321 "autotools.yy"
1630#include "autotools_lex.cpp"