X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/b5b61c616b6a42a9f3a9cc0e9aeaf5124e7cffc5..b85810aec0e5172c813b1cdd511bfce8a0cd4b4f:/src/bison.simple diff --git a/src/bison.simple b/src/bison.simple index 57190178..59ff145b 100644 --- a/src/bison.simple +++ b/src/bison.simple @@ -1,10 +1,11 @@ +%%{section} %%{output-prefix} %%{output-infix} %%".c" /* -*- C -*- */ -/* A Bison parser, made from %%filename - by GNU bison %%version. */ +/* A Bison parser, made from %%{filename} + by GNU bison %%{version}. */ /* Skeleton output parser for bison, - Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc. + Copyright 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,31 +36,31 @@ #define YYBISON 1 /* Pure parsers. */ -#define YYPURE %%pure +#define YYPURE %%{pure} /* Using locations. */ -#define YYLSP_NEEDED %%locations-flag +#define YYLSP_NEEDED %%{locations-flag} /* If NAME_PREFIX is specified substitute the variables and functions names. */ -#define yyparse %%prefix##parse -#define yylex %%prefix##lex -#define yyerror %%prefix##error -#define yylval %%prefix##lval -#define yychar %%prefix##char -#define yydebug %%prefix##debug -#define yynerrs %%prefix##nerrs +#define yyparse %%{prefix}parse +#define yylex %%{prefix}lex +#define yyerror %%{prefix}error +#define yylval %%{prefix}lval +#define yychar %%{prefix}char +#define yydebug %%{prefix}debug +#define yynerrs %%{prefix}nerrs #if YYLSP_NEEDED -# define yylloc %%prefix##lloc +# define yylloc %%{prefix}lloc #endif /* Copy the user declarations. */ -%%prologue +%%{prologue} /* Enabling traces. */ #ifndef YYDEBUG -# define YYDEBUG %%debug +# define YYDEBUG %%{debug} #endif /* Enabling verbose error messages. */ @@ -67,11 +68,11 @@ # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else -# define YYERROR_VERBOSE %%error-verbose +# define YYERROR_VERBOSE %%{error-verbose} #endif #ifndef YYSTYPE -typedef %%stype yystype; +typedef %%{stype} yystype; # define YYSTYPE yystype #endif @@ -83,11 +84,11 @@ typedef struct yyltype int last_line; int last_column; } yyltype; -# define YYLTYPE %%ltype +# define YYLTYPE %%{ltype} #endif -/* Line %%skeleton-line of %%skeleton. */ -#line %%line "%%parser-file-name" +/* Line %%{skeleton-line} of %%{skeleton}. */ +#line %%{line} "%%{parser-file-name}" /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -184,30 +185,30 @@ union yyalloc #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ /* Tokens. */ -%%tokendef +%%{tokendef} /* YYFINAL -- State number of the termination state. */ -#define YYFINAL %%final -#define YYFLAG %%flag -#define YYLAST %%last +#define YYFINAL %%{final} +#define YYFLAG %%{flag} +#define YYLAST %%{last} /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS %%ntokens +#define YYNTOKENS %%{ntokens} /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS %%nnts +#define YYNNTS %%{nnts} /* YYNRULES -- Number of rules. */ -#define YYNRULES %%nrules +#define YYNRULES %%{nrules} /* YYNRULES -- Number of states. */ -#define YYNSTATES %%nstates -#define YYMAXUTOK %%maxtok +#define YYNSTATES %%{nstates} +#define YYMAXUTOK %%{maxtok} /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym) +#define YYTRANSLATE(x) ((unsigned)(x) <= %%{maxtok} ? yytranslate[x] : %%{nsym}) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const char yytranslate[] = { - %%translate + %%{translate} }; #if YYDEBUG @@ -215,19 +216,19 @@ static const char yytranslate[] = YYRHS. */ static const short yyprhs[] = { - %%prhs + %%{prhs} }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const short yyrhs[] = { - %%rhs + %%{rhs} }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - %%rline + %%{rline} }; #endif @@ -236,26 +237,26 @@ static const short yyrline[] = First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { - %%tname + %%{tname} }; #endif /* YYTOKNUM[YYN] -- Index in YYTNAME corresponding to YYLEX. */ static const short yytoknum[] = { - %%toknum + %%{toknum} }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { - %%r1 + %%{r1} }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const short yyr2[] = { - %%r2 + %%{r2} }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -263,26 +264,26 @@ static const short yyr2[] = error. */ static const short yydefact[] = { - %%defact + %%{defact} }; /* YYPGOTO[NTERM-NUM]. */ static const short yydefgoto[] = { - %%defgoto + %%{defgoto} }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const short yypact[] = { - %%pact + %%{pact} }; /* YYPGOTO[NTERM-NUM]. */ static const short yypgoto[] = { - %%pgoto + %%{pgoto} }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -290,12 +291,12 @@ static const short yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. */ static const short yytable[] = { - %%table + %%{table} }; static const short yycheck[] = { - %%check + %%{check} }; @@ -395,12 +396,11 @@ while (0) # ifndef YYFPRINTF # ifdef __cplusplus -# include /* INFRINGES ON USER NAME SPACE */ +# include /* INFRINGES ON USER NAME SPACE */ # else # include /* INFRINGES ON USER NAME SPACE */ # endif # define YYFPRINTF YYSTD (fprintf) -# define YYSTDERR YYSTD (stderr) # endif # define YYDPRINTF(Args) \ @@ -419,7 +419,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -# define YYINITDEPTH %%initdepth +# define YYINITDEPTH %%{initdepth} #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only @@ -434,7 +434,7 @@ int yydebug; #endif #ifndef YYMAXDEPTH -# define YYMAXDEPTH %%maxdepth +# define YYMAXDEPTH %%{maxdepth} #endif @@ -640,7 +640,7 @@ yyparse (YYPARSE_PARAM_ARG) rule. */ int yylen; - YYDPRINTF ((YYSTDERR, "Starting parse\n")); + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; @@ -736,14 +736,14 @@ yyparse (YYPARSE_PARAM_ARG) yylsp = yyls + yysize - 1; #endif - YYDPRINTF ((YYSTDERR, "Stack size increased to %lu\n", + YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyssp >= yyss + yystacksize - 1) YYABORT; } - YYDPRINTF ((YYSTDERR, "Entering state %d\n", yystate)); + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; @@ -769,7 +769,7 @@ yybackup: if (yychar == YYEMPTY) { - YYDPRINTF ((YYSTDERR, "Reading a token: ")); + YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } @@ -780,7 +780,7 @@ yybackup: yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more. */ - YYDPRINTF ((YYSTDERR, "Now at end of input.\n")); + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { @@ -791,14 +791,14 @@ yybackup: which are defined only if `YYDEBUG' is set. */ if (yydebug) { - YYFPRINTF (YYSTDERR, "Next token is %d (%s", + YYFPRINTF (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ # ifdef YYPRINT - YYPRINT (YYSTDERR, yychar, yylval); + YYPRINT (stderr, yychar, yylval); # endif - YYFPRINTF (YYSTDERR, ")\n"); + YYFPRINTF (stderr, ")\n"); } #endif } @@ -830,7 +830,7 @@ yybackup: YYACCEPT; /* Shift the lookahead token. */ - YYDPRINTF ((YYSTDERR, "Shifting token %d (%s), ", + YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1])); /* Discard the token being shifted unless it is eof. */ @@ -892,22 +892,22 @@ yyreduce: { int yyi; - YYFPRINTF (YYSTDERR, "Reducing via rule %d (line %d), ", + YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", yyn - 1, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++) - YYFPRINTF (YYSTDERR, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (YYSTDERR, " -> %s\n", yytname[yyr1[yyn]]); + YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); + YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { -%%actions + %%{actions} } -/* Line %%skeleton-line of %%skeleton. */ -#line %%line "%%parser-file-name" +/* Line %%{skeleton-line} of %%{skeleton}. */ +#line %%{line} "%%{parser-file-name}" yyvsp -= yylen; yyssp -= yylen; @@ -919,10 +919,10 @@ yyreduce: if (yydebug) { short *yyssp1 = yyss - 1; - YYFPRINTF (YYSTDERR, "state stack now"); + YYFPRINTF (stderr, "state stack now"); while (yyssp1 != yyssp) - YYFPRINTF (YYSTDERR, " %d", *++yyssp1); - YYFPRINTF (YYSTDERR, "\n"); + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); } #endif @@ -1018,7 +1018,7 @@ yyerrlab1: /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; - YYDPRINTF ((YYSTDERR, "Discarding token %d (%s).\n", + YYDPRINTF ((stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1])); yychar = YYEMPTY; } @@ -1064,10 +1064,10 @@ yyerrpop: if (yydebug) { short *yyssp1 = yyss - 1; - YYFPRINTF (YYSTDERR, "Error: state stack now"); + YYFPRINTF (stderr, "Error: state stack now"); while (yyssp1 != yyssp) - YYFPRINTF (YYSTDERR, " %d", *++yyssp1); - YYFPRINTF (YYSTDERR, "\n"); + YYFPRINTF (stderr, " %d", *++yyssp1); + YYFPRINTF (stderr, "\n"); } #endif @@ -1097,7 +1097,7 @@ yyerrhandle: if (yyn == YYFINAL) YYACCEPT; - YYDPRINTF ((YYSTDERR, "Shifting error token, ")); + YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; #if YYLSP_NEEDED @@ -1138,4 +1138,4 @@ yyreturn: return yyresult; } -%%epilogue +%%{epilogue}