Index: data/c.m4 =================================================================== RCS file: /sources/bison/bison/data/c.m4,v retrieving revision 1.53 diff -u -r1.53 c.m4 --- data/c.m4 22 Jan 2006 07:38:49 -0000 1.53 +++ data/c.m4 17 Mar 2006 19:34:11 -0000 @@ -62,6 +62,9 @@ /* Pure parsers. */ [#]define YYPURE b4_pure +/* Push parsers. */ +[#]define YYPUSH b4_push + /* Using locations. */ [#]define YYLSP_NEEDED b4_locations_flag ]) @@ -185,6 +188,15 @@ [$2])]) +# b4_push_if(IF-TRUE, IF-FALSE) +# ----------------------------- +# Expand IF-TRUE, if %push-parser, IF-FALSE otherwise. +m4_define([b4_push_if], +[m4_if(b4_push, [1], + [$1], + [$2])]) + + ## ------------------------- ## ## Assigning token numbers. ## Index: data/yacc.c =================================================================== RCS file: /sources/bison/bison/data/yacc.c,v retrieving revision 1.135 diff -u -r1.135 yacc.c --- data/yacc.c 12 Mar 2006 14:45:27 -0000 1.135 +++ data/yacc.c 17 Mar 2006 19:34:12 -0000 @@ -49,7 +49,7 @@ # --------------- # Arguments passed to yyerror: user args plus yylloc. m4_define([b4_yyerror_args], -[b4_yacc_pure_if([b4_location_if([&yylloc, ])])dnl +[b4_yacc_pure_if([b4_location_if([&]b4_yylloc[, ])])dnl m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])]) @@ -58,8 +58,8 @@ # Accumulate in b4_lex_param all the yylex arguments. # b4_lex_param arrives quoted twice, but we want to keep only one level. m4_define([b4_lex_param], -m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&yylval]]][]dnl -b4_location_if([, [[YYLTYPE *], [&yylloc]]])m4_ifdef([b4_lex_param], [, ])])dnl +m4_dquote(b4_pure_if([[[[YYSTYPE *]], [[&]b4_yylval[]]][]dnl +b4_location_if([, [[YYLTYPE *], [&]b4_yylloc[]]])m4_ifdef([b4_lex_param], [, ])])dnl m4_ifdef([b4_lex_param], b4_lex_param))) @@ -95,7 +95,7 @@ # -------------------- # Expansion of $$. m4_define([b4_lhs_value], -[(yyval[]m4_ifval([$1], [.$1]))]) +[(pv->yyval[]m4_ifval([$1], [.$1]))]) # b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) @@ -103,8 +103,10 @@ # Expansion of $NUM, where the current rule has RULE-LENGTH # symbols on RHS. m4_define([b4_rhs_value], -[(address@hidden($2) - ($1)@}m4_ifval([$3], [.$3]))]) +[(pv->address@hidden($2) - ($1)@}m4_ifval([$3], [.$3]))]) +m4_define([b4_rhs_value_no_pv], +[(address@hidden($2) - ($1)@}m4_ifval([$3], [.$3]))]) ## ----------- ## @@ -115,7 +117,7 @@ # ----------------- # Expansion of @$. m4_define([b4_lhs_location], -[(yyloc)]) +[(pv->yyloc)]) # b4_rhs_location(RULE-LENGTH, NUM) @@ -123,6 +125,9 @@ # Expansion of @NUM, where the current rule has RULE-LENGTH symbols # on RHS. m4_define([b4_rhs_location], +[(pv->address@hidden($2) - ($1)@})]) + +m4_define([b4_rhs_location_no_pv], [(address@hidden($2) - ($1)@})]) @@ -157,13 +162,18 @@ m4_if(b4_prefix, [yy], [], [/* Substitute the variable and function names. */ #define yyparse b4_prefix[]parse +#define yypvarsinit b4_prefix[]pvarsinit #define yylex b4_prefix[]lex #define yyerror b4_prefix[]error #define yylval b4_prefix[]lval #define yychar b4_prefix[]char #define yydebug b4_prefix[]debug #define yynerrs b4_prefix[]nerrs -b4_location_if([#define yylloc b4_prefix[]lloc])])[ +b4_location_if([#define yylloc b4_prefix[]lloc])]) +m4_define([b4_yychar],[b4_pure_if([(pv->yychar)],b4_push_if([(pv->yychar)],yychar))]) +m4_define([b4_yylval],[b4_pure_if([(pv->yylval)],b4_push_if([(pv->yylval)],yylval))]) +m4_define([b4_yynerrs],[b4_pure_if([(pv->yynerrs)],[b4_push_if([(pv->yynerrs)],[yynerrs])])]) +m4_define([b4_yylloc],[b4_pure_if([(pv->yylloc)],b4_push_if([(pv->yylloc)],yylloc))])[ ]b4_token_enums_defines(b4_tokens)[ @@ -416,9 +426,9 @@ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + YYCOPY (&yyptr->Stack, pv->Stack, yysize); \ + pv->Stack = &yyptr->Stack; \ + yynewbytes = pv->yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) @@ -553,8 +563,8 @@ ]b4_stos[ }; -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) +#define yyerrok (pv->yyerrstatus = 0) +#define yyclearin (]b4_yychar[ = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 @@ -569,15 +579,15 @@ #define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) +#define YYRECOVERING() (!!pv->yyerrstatus) #define YYBACKUP(Token, Value) \ do \ - if (yychar == YYEMPTY && yylen == 1) \ + if (]b4_yychar[ == YYEMPTY && yylen == 1) \ { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ + ]b4_yychar[ = (Token); \ + ]b4_yylval[ = (Value); \ + yytoken = YYTRANSLATE (]b4_yychar[); \ YYPOPSTACK (1); \ goto yybackup; \ } \ @@ -638,7 +648,7 @@ /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM -# define YYLEX yylex (]b4_pure_if([&yylval[]b4_location_if([, &yylloc]), ])[YYLEX_PARAM) +# define YYLEX yylex (]b4_pure_if([&]b4_yylval[[]b4_location_if([, &]b4_yylloc[]), ])[YYLEX_PARAM) #else # define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[ #endif @@ -712,8 +722,8 @@ { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &]b4_rhs_value(yynrhs, yyi + 1)[ - ]b4_location_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl + &]b4_rhs_value_no_pv(yynrhs, yyi + 1)[ + ]b4_location_if([, &]b4_rhs_location_no_pv(yynrhs, yyi + 1))[]dnl b4_user_args[); fprintf (stderr, "\n"); } @@ -722,7 +732,7 @@ # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (yyvsp, ]b4_location_if([yylsp, ])[Rule]b4_user_args[); \ + yy_reduce_print (pv->yyvsp, ]b4_location_if([pv->yylsp, ])[Rule]b4_user_args[); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that @@ -958,6 +968,12 @@ #ifdef YYPARSE_PARAM ]b4_c_function_decl([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[ +#elif YYPUSH +]b4_c_function_decl([get_yyresult], [int], [[void *PVVOID], [PVVOID]])[ +]b4_c_function_decl([set_yychar], [void], [[void *PVVOID], [PVVOID]], [[int yychar], [yychar]])[ +]b4_c_function_decl([yypvarsinit], [void *], [[void], []])[ +]b4_c_function_decl([yyparse], [void], + [[void *PVVOID], [PVVOID]])[ #else /* ! YYPARSE_PARAM */ ]b4_c_function_decl([yyparse], [int], b4_parse_param)[ #endif /* ! YYPARSE_PARAM */ @@ -980,11 +996,129 @@ /* Location data for the look-ahead symbol. */ YYLTYPE yylloc;]) ]) + +m4_define([b4_init_parser_variables],[ + b4_yychar = YYEMPTY; /* Cause a token to be read. */ + b4_yynerrs = 0; +b4_location_if([[ +#if YYLTYPE_IS_TRIVIAL + /* Initialize the default location before parsing starts. */ + ]b4_yylloc[.first_line = ]b4_yylloc[.last_line = 1; + ]b4_yylloc[.first_column = ]b4_yylloc[.last_column = 0; +#endif +]])]) + +# b4_declare_yyparse_variables +# ---------------------------- +# Declare all the variables that are needed local to YYPARSE +m4_define([b4_declare_yyparse_variables], +[[struct yypvars + { +]]b4_declare_parser_variables[[ + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg; + YYSIZE_T yymsg_alloc; +#endif + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp;]]b4_location_if([[[ + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2];]]])[ +#define YYPOPSTACK(N) (pv->yyvsp -= (N), pv->yyssp -= (N)]b4_location_if([[, pv->yylsp -= (N)]])[) + YYSIZE_T yystacksize; + int yylen; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + /* Used to determine if this is the first time this instance has + been used. */ + int yynew;]b4_location_if([YYLTYPE yyloc;])[ + }; + +/* Init the parser data structure. Use malloc, should perhaps use a + system dependent equivalent function. */ +void* +yypvarsinit (void) +{ + struct yypvars *pv; + pv= (struct yypvars *) malloc(sizeof(struct yypvars)); + pv->yystate = 0; + pv->yyresult = -1; + pv->yyerrstatus = 0; + pv->yytoken = 0; + +#if YYERROR_VERBOSE + pv->yymsg = pv->yymsgbuf; + pv->yymsg_alloc = sizeof pv->yymsgbuf; +#endif + + pv->yyss = pv->yyssa; + pv->yyvs = pv->yyvsa; + + ]b4_location_if([pv->yyls = pv->yylsa;])[ + pv->yystacksize = YYINITDEPTH; + + pv->yyssp = pv->yyss; + pv->yyvsp = pv->yyvs; + + pv->yynew = 1; + +]b4_location_if([ pv->yylsp = pv->yyls;])[ + /* Init parser variables */ + ]b4_init_parser_variables()[ + + return (void*) pv; +} + +int +get_yyresult (void *PVVOID) +{ + struct yypvars *pv = (struct yypvars*)PVVOID; + return pv->yyresult; +} + +void +set_yychar (void *PVVOID, int yychar) +{ + struct yypvars *pv = (struct yypvars*)PVVOID; + if (pv) + pv->yychar = yychar; +}]) m4_divert_pop([KILL])dnl# ====================== End of M4 code. -b4_pure_if([], - [b4_declare_parser_variables]) +b4_pure_if([], b4_push_if([], + [b4_declare_parser_variables])) +b4_declare_yyparse_variables /*----------. | yyparse. | @@ -992,88 +1126,30 @@ #ifdef YYPARSE_PARAM b4_c_function_def([yyparse], [int], [[void *YYPARSE_PARAM], [YYPARSE_PARAM]]) +#elif YYPUSH +b4_c_function_def([yyparse], [void], [[void *PVVOID], [PVVOID]]) #else /* ! YYPARSE_PARAM */ b4_c_function_def([yyparse], [int], b4_parse_param) #endif {[ ]b4_pure_if([b4_declare_parser_variables])[ - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - -]b4_location_if( -[[ /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2];]])[ - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)]b4_location_if([, yylsp -= (N)])[) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; -]b4_location_if([ YYLTYPE yyloc;])[ + struct yypvars *pv; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ - int yylen = 0; - YYDPRINTF ((stderr, "Starting parse\n")); - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + ]b4_push_if([pv = (struct yypvars*)PVVOID;],[pv = yypvarsinit ();])[ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ + ]b4_push_if([],[b4_init_parser_variables])[ - yyssp = yyss; - yyvsp = yyvs; -]b4_location_if([[ yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL - /* Initialize the default location before parsing starts. */ - yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; -#endif -]]) -m4_ifdef([b4_initial_action], [ -m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl -m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl +]m4_ifdef([b4_initial_action], [ +m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])]b4_yylloc[])dnl +m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])]b4_yylval[])dnl /* User initialization code. */ b4_initial_action m4_popdef([b4_dollar_dollar])dnl @@ -1081,11 +1157,15 @@ /* Line __line__ of yacc.c. */ b4_syncline(address@hidden@], address@hidden@]) ])dnl -m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval; +m4_ifdef([b4_dollar_dollar_used],[[ pv->yyvsp[0] = ]b4_yylval[; ]])dnl -m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc; +m4_ifdef([b4_at_dollar_used], [[ pv->yylsp[0] = ]b4_yylloc[; ]])dnl -[ goto yysetstate; +[ ]b4_push_if([ + if (pv->yynew == 0) goto gottoken; + pv->yynew= 0;])[ + + goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | @@ -1093,15 +1173,15 @@ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; + pv->yyssp++; yysetstate: - *yyssp = yystate; + *pv->yyssp = pv->yystate; - if (yyss + yystacksize - 1 <= yyssp) + if (pv->yyss + pv->yystacksize - 1 <= pv->yyssp) { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = pv->yyssp - pv->yyss + 1; #ifdef yyoverflow { @@ -1120,7 +1200,7 @@ &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), ]b4_location_if([ &yyls1, yysize * sizeof (*yylsp),])[ - &yystacksize); + &pv->yystacksize); ]b4_location_if([ yyls = yyls1;])[ yyss = yyss1; yyvs = yyvs1; @@ -1130,40 +1210,43 @@ goto yyexhaustedlab; # else /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) + if (YYMAXDEPTH <= pv->yystacksize) goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + pv->yystacksize *= 2; + if (YYMAXDEPTH < pv->yystacksize) + pv->yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yytype_int16 *yyss; + YYSTYPE *yyvs;]b4_location_if([YYLTYPE *yyls;])[ + + yytype_int16 *yyss1 = pv->yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (pv->yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); ]b4_location_if([ YYSTACK_RELOCATE (yyls);])[ # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) + if (yyss1 != pv->yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; -]b4_location_if([ yylsp = yyls + yysize - 1;])[ + pv->yyssp = pv->yyss + yysize - 1; + pv->yyvsp = pv->yyvs + yysize - 1; +]b4_location_if([ pv->yylsp = pv->yyls + yysize - 1;])[ YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) pv->yystacksize)); - if (yyss + yystacksize - 1 <= yyssp) + if (pv->yyss + pv->yystacksize - 1 <= pv->yyssp) YYABORT; } - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YYDPRINTF ((stderr, "Entering state %d\n", pv->yystate)); goto yybackup; @@ -1176,62 +1259,68 @@ look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + pv->yyn = yypact[pv->yystate]; + if (pv->yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ - if (yychar == YYEMPTY) + if (]b4_yychar[ == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + ]b4_push_if([ + YYDPRINTF ((stderr, "Returns for a new token: ")); + pv->yyresult= 4; + return; +gottoken: + YYDPRINTF((stderr, "\nGot token %d", pv->yychar));],[ + YYDPRINTF ((stderr, "Reading a token: ")); + ]b4_yychar[ = YYLEX;])[ } - if (yychar <= YYEOF) + if (]b4_yychar[ <= YYEOF) { - yychar = yytoken = YYEOF; + ]b4_yychar[ = pv->yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + pv->yytoken = YYTRANSLATE (]b4_yychar[); + YY_SYMBOL_PRINT ("Next token is", pv->yytoken, &]b4_yylval[, &]b4_yylloc[); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + pv->yyn += pv->yytoken; + if (pv->yyn < 0 || YYLAST < pv->yyn || yycheck[pv->yyn] != pv->yytoken) goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) + pv->yyn = yytable[pv->yyn]; + if (pv->yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) + if (pv->yyn == 0 || pv->yyn == YYTABLE_NINF) goto yyerrlab; - yyn = -yyn; + pv->yyn = -pv->yyn; goto yyreduce; } - if (yyn == YYFINAL) + if (pv->yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) - yyerrstatus--; + if (pv->yyerrstatus) + pv->yyerrstatus--; /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Shifting", pv->yytoken, &]b4_yylval[, &]b4_yylloc[); /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + if (]b4_yychar[ != YYEOF) + ]b4_yychar[ = YYEMPTY; - yystate = yyn; - *++yyvsp = yylval; -]b4_location_if([ *++yylsp = yylloc;])[ + pv->yystate = pv->yyn; + *++(pv->yyvsp) = ]b4_yylval[; +]b4_location_if([ *++(pv->yylsp) = ]b4_yylloc[;])[ goto yynewstate; @@ -1239,8 +1328,8 @@ | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) + pv->yyn = yydefact[pv->yystate]; + if (pv->yyn == 0) goto yyerrlab; goto yyreduce; @@ -1250,7 +1339,7 @@ `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; + pv->yylen = yyr2[pv->yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. @@ -1260,39 +1349,39 @@ users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; + pv->yyval = pv->yyvsp[1-pv->yylen]; ]b4_location_if( [[ /* Default location. */ - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);]])[ - YY_REDUCE_PRINT (yyn); - switch (yyn) + YYLLOC_DEFAULT (pv->yyloc, (pv->yylsp - pv->yylen), pv->yylen);]])[ + YY_REDUCE_PRINT (pv->yyn); + switch (pv->yyn) { ]b4_actions /* Line __line__ of yacc.c. */ b4_syncline(address@hidden@], address@hidden@])[ default: break; } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", yyr1[pv->yyn], &pv->yyval, &pv->yyloc); - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); + YYPOPSTACK (pv->yylen); + pv->yylen = 0; + YY_STACK_PRINT (pv->yyss, pv->yyssp); - *++yyvsp = yyval; -]b4_location_if([ *++yylsp = yyloc;])[ + *++(pv->yyvsp) = pv->yyval; +]b4_location_if([ *++(pv->yylsp) = pv->yyloc;])[ /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - yyn = yyr1[yyn]; + pv->yyn = yyr1[pv->yyn]; - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; + pv->yystate = yypgoto[pv->yyn - YYNTOKENS] + *pv->yyssp; + if (0 <= pv->yystate && pv->yystate <= YYLAST && yycheck[pv->yystate] == *pv->yyssp) + pv->yystate = yytable[pv->yystate]; else - yystate = yydefgoto[yyn - YYNTOKENS]; + pv->yystate = yydefgoto[pv->yyn - YYNTOKENS]; goto yynewstate; @@ -1302,35 +1391,35 @@ `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) + if (!pv->yyerrstatus) { - ++yynerrs; + ++]b4_yynerrs[; #if ! YYERROR_VERBOSE yyerror (]b4_yyerror_args[YY_("syntax error")); #else { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + YYSIZE_T yysize = yysyntax_error (0, pv->yystate, ]b4_yychar[); + if (pv->yymsg_alloc < yysize && pv->yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; + if (pv->yymsg != pv->yymsgbuf) + YYSTACK_FREE (pv->yymsg); + pv->yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (pv->yymsg) + pv->yymsg_alloc = yyalloc; else { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; + pv->yymsg = pv->yymsgbuf; + pv->yymsg_alloc = sizeof pv->yymsgbuf; } } - if (0 < yysize && yysize <= yymsg_alloc) + if (0 < yysize && yysize <= pv->yymsg_alloc) { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (]b4_yyerror_args[yymsg); + (void) yysyntax_error (pv->yymsg, pv->yystate, ]b4_yychar[); + yyerror (]b4_yyerror_args[pv->yymsg); } else { @@ -1342,24 +1431,24 @@ #endif } -]b4_location_if([[ yyerror_range[0] = yylloc;]])[ +]b4_location_if([[ pv->yyerror_range[0] = ]b4_yylloc[;]])[ - if (yyerrstatus == 3) + if (pv->yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ - if (yychar <= YYEOF) + if (]b4_yychar[ <= YYEOF) { /* Return failure if at end of input. */ - if (yychar == YYEOF) + if (]b4_yychar[ == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", - yytoken, &yylval]b4_location_if([, &yylloc])[]b4_user_args[); - yychar = YYEMPTY; + pv->yytoken, &]b4_yylval[]b4_location_if([, &]b4_yylloc[])[]b4_user_args[); + ]b4_yychar[ = YYEMPTY; } } @@ -1379,13 +1468,13 @@ if (/*CONSTCOND*/ 0) goto yyerrorlab; -]b4_location_if([[ yyerror_range[0] = yylsp[1-yylen]; +]b4_location_if([[ pv->yyerror_range[0] = pv->yylsp[1-pv->yylen]; ]])[ /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; + YYPOPSTACK (pv->yylen); + pv->yylen = 0; + YY_STACK_PRINT (pv->yyss, pv->yyssp); + pv->yystate = *pv->yyssp; goto yyerrlab1; @@ -1393,49 +1482,49 @@ | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + pv->yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + pv->yyn = yypact[pv->yystate]; + if (pv->yyn != YYPACT_NINF) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + pv->yyn += YYTERROR; + if (0 <= pv->yyn && pv->yyn <= YYLAST && yycheck[pv->yyn] == YYTERROR) { - yyn = yytable[yyn]; - if (0 < yyn) + pv->yyn = yytable[pv->yyn]; + if (0 < pv->yyn) break; } } /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) + if (pv->yyssp == pv->yyss) YYABORT; -]b4_location_if([[ yyerror_range[0] = *yylsp;]])[ +]b4_location_if([[ pv->yyerror_range[0] = *pv->yylsp;]])[ yydestruct ("Error: popping", - yystos[yystate], yyvsp]b4_location_if([, yylsp])[]b4_user_args[); + yystos[pv->yystate], pv->yyvsp]b4_location_if([, pv->yylsp])[]b4_user_args[); YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); + pv->yystate = *pv->yyssp; + YY_STACK_PRINT (pv->yyss, pv->yyssp); } - if (yyn == YYFINAL) + if (pv->yyn == YYFINAL) YYACCEPT; - *++yyvsp = yylval; + *++(pv->yyvsp) = ]b4_yylval[; ]b4_location_if([[ - yyerror_range[1] = yylloc; + pv->yyerror_range[1] = ]b4_yylloc[; /* Using YYLLOC is tempting, but would change the location of the look-ahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); - *++yylsp = yyloc;]])[ + YYLLOC_DEFAULT (pv->yyloc, (pv->yyerror_range - 1), 2); + *++(pv->yylsp) = pv->yyloc;]])[ /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", yystos[pv->yyn], pv->yyvsp, pv->yylsp); - yystate = yyn; + pv->yystate = pv->yyn; goto yynewstate; @@ -1443,14 +1532,14 @@ | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: - yyresult = 0; + pv->yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: - yyresult = 1; + pv->yyresult = 1; goto yyreturn; #ifndef yyoverflow @@ -1459,33 +1548,37 @@ `-------------------------------------------------*/ yyexhaustedlab: yyerror (]b4_yyerror_args[YY_("memory exhausted")); - yyresult = 2; + pv->yyresult = 2; /* Fall through. */ #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (]b4_yychar[ != YYEOF && ]b4_yychar[ != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval]b4_location_if([, &yylloc])[]b4_user_args[); + pv->yytoken, &]b4_yylval[]b4_location_if([, &]b4_yylloc[])[]b4_user_args[); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) + YYPOPSTACK (pv->yylen); + YY_STACK_PRINT (pv->yyss, pv->yyssp); + while (pv->yyssp != pv->yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[]b4_user_args[); + yystos[*pv->yyssp], pv->yyvsp]b4_location_if([, pv->yylsp])[]b4_user_args[); YYPOPSTACK (1); } #ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); + if (pv->yyss != pv->yyssa) + YYSTACK_FREE (pv->yyss); #endif #if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); + if (pv->yymsg != pv->yymsgbuf) + YYSTACK_FREE (pv->yymsg); #endif - return yyresult; + + ]b4_push_if([],[{ + int yyresult = pv->yyresult; + free (pv); + return yyresult;}])[ ]} Index: src/getargs.c =================================================================== RCS file: /sources/bison/bison/src/getargs.c,v retrieving revision 1.66 diff -u -r1.66 getargs.c --- src/getargs.c 3 Jan 2006 19:12:55 -0000 1.66 +++ src/getargs.c 17 Mar 2006 19:34:12 -0000 @@ -58,6 +58,7 @@ bool nondeterministic_parser = false; bool glr_parser = false; bool pure_parser = false; +bool push_parser = false; const char *skeleton = NULL; const char *include = NULL; Index: src/getargs.h =================================================================== RCS file: /sources/bison/bison/src/getargs.h,v retrieving revision 1.28 diff -u -r1.28 getargs.h --- src/getargs.h 24 Jul 2005 07:24:22 -0000 1.28 +++ src/getargs.h 17 Mar 2006 19:34:12 -0000 @@ -50,6 +50,11 @@ extern bool pure_parser; +/* PUSH_PARSER is true if should generate a parser that is capble of being + called asynchronously. Is must be pure and reentrant. */ + +extern bool push_parser; + /* NONDETERMINISTIC_PARSER is true iff conflicts are accepted. This is used by the GLR parser, and might be used in BackTracking parsers too. */ Index: src/output.c =================================================================== RCS file: /sources/bison/bison/src/output.c,v retrieving revision 1.245 diff -u -r1.245 output.c --- src/output.c 21 Jan 2006 04:35:09 -0000 1.245 +++ src/output.c 17 Mar 2006 19:34:12 -0000 @@ -590,6 +590,7 @@ MUSCLE_INSERT_BOOL ("error_verbose", error_verbose); MUSCLE_INSERT_BOOL ("locations_flag", locations_flag); MUSCLE_INSERT_BOOL ("pure", pure_parser); + MUSCLE_INSERT_BOOL ("push", push_parser); MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag); /* File names. */ Index: src/parse-gram.c =================================================================== RCS file: /sources/bison/bison/src/parse-gram.c,v retrieving revision 1.108 diff -u -r1.108 parse-gram.c --- src/parse-gram.c 17 Feb 2006 00:23:08 -0000 1.108 +++ src/parse-gram.c 17 Mar 2006 19:34:12 -0000 @@ -45,6 +45,9 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH b4_push + /* Using locations. */ #define YYLSP_NEEDED 1 @@ -98,22 +101,23 @@ PERCENT_OUTPUT = 288, PERCENT_PARSE_PARAM = 289, PERCENT_PURE_PARSER = 290, - PERCENT_REQUIRE = 291, - PERCENT_SKELETON = 292, - PERCENT_START = 293, - PERCENT_TOKEN_TABLE = 294, - PERCENT_VERBOSE = 295, - PERCENT_YACC = 296, - TYPE = 297, - EQUAL = 298, - SEMICOLON = 299, - PIPE = 300, - ID = 301, - ID_COLON = 302, - PERCENT_PERCENT = 303, - PROLOGUE = 304, - EPILOGUE = 305, - BRACED_CODE = 306 + PERCENT_PUSH_PARSER = 291, + PERCENT_REQUIRE = 292, + PERCENT_SKELETON = 293, + PERCENT_START = 294, + PERCENT_TOKEN_TABLE = 295, + PERCENT_VERBOSE = 296, + PERCENT_YACC = 297, + TYPE = 298, + EQUAL = 299, + SEMICOLON = 300, + PIPE = 301, + ID = 302, + ID_COLON = 303, + PERCENT_PERCENT = 304, + PROLOGUE = 305, + EPILOGUE = 306, + BRACED_CODE = 307 }; #endif /* Tokens. */ @@ -151,28 +155,29 @@ #define PERCENT_OUTPUT 288 #define PERCENT_PARSE_PARAM 289 #define PERCENT_PURE_PARSER 290 -#define PERCENT_REQUIRE 291 -#define PERCENT_SKELETON 292 -#define PERCENT_START 293 -#define PERCENT_TOKEN_TABLE 294 -#define PERCENT_VERBOSE 295 -#define PERCENT_YACC 296 -#define TYPE 297 -#define EQUAL 298 -#define SEMICOLON 299 -#define PIPE 300 -#define ID 301 -#define ID_COLON 302 -#define PERCENT_PERCENT 303 -#define PROLOGUE 304 -#define EPILOGUE 305 -#define BRACED_CODE 306 +#define PERCENT_PUSH_PARSER 291 +#define PERCENT_REQUIRE 292 +#define PERCENT_SKELETON 293 +#define PERCENT_START 294 +#define PERCENT_TOKEN_TABLE 295 +#define PERCENT_VERBOSE 296 +#define PERCENT_YACC 297 +#define TYPE 298 +#define EQUAL 299 +#define SEMICOLON 300 +#define PIPE 301 +#define ID 302 +#define ID_COLON 303 +#define PERCENT_PERCENT 304 +#define PROLOGUE 305 +#define EPILOGUE 306 +#define BRACED_CODE 307 /* Copy the first part of user declarations. */ -#line 1 "parse-gram.y" +#line 1 "../../bison/src/parse-gram.y" /* Bison Grammar Parser -*- C -*- Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -267,7 +272,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 95 "parse-gram.y" +#line 95 "../../bison/src/parse-gram.y" { symbol *symbol; symbol_list *list; @@ -276,8 +281,8 @@ assoc assoc; uniqstr uniqstr; } -/* Line 198 of yacc.c. */ -#line 281 "parse-gram.c" +/* Line 203 of yacc.c. */ +#line 286 "../../bison/src/parse-gram.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -301,8 +306,8 @@ /* Copy the second part of user declarations. */ -/* Line 221 of yacc.c. */ -#line 306 "parse-gram.c" +/* Line 226 of yacc.c. */ +#line 311 "../../bison/src/parse-gram.c" #ifdef short # undef short @@ -507,9 +512,9 @@ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + YYCOPY (&yyptr->Stack, pv->Stack, yysize); \ + pv->Stack = &yyptr->Stack; \ + yynewbytes = pv->yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) @@ -519,20 +524,20 @@ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 161 +#define YYLAST 162 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 52 +#define YYNTOKENS 53 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 26 /* YYNRULES -- Number of rules. */ -#define YYNRULES 82 +#define YYNRULES 83 /* YYNRULES -- Number of states. */ -#define YYNSTATES 111 +#define YYNSTATES 112 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 306 +#define YYMAXUTOK 307 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -570,7 +575,7 @@ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51 + 45, 46, 47, 48, 49, 50, 51, 52 }; #if YYDEBUG @@ -580,53 +585,54 @@ { 0, 0, 3, 8, 9, 12, 14, 16, 18, 21, 25, 27, 29, 32, 35, 39, 41, 43, 45, 47, - 51, 53, 55, 59, 61, 63, 66, 69, 71, 73, - 75, 77, 79, 81, 84, 86, 89, 92, 94, 96, - 97, 101, 102, 106, 110, 114, 116, 118, 120, 121, - 123, 125, 128, 130, 132, 135, 138, 142, 144, 147, - 149, 152, 154, 157, 160, 161, 165, 167, 171, 174, - 175, 178, 181, 185, 189, 193, 195, 197, 198, 201, - 203, 205, 206 + 51, 53, 55, 59, 61, 63, 65, 68, 71, 73, + 75, 77, 79, 81, 83, 86, 88, 91, 94, 96, + 98, 99, 103, 104, 108, 112, 116, 118, 120, 122, + 123, 125, 127, 130, 132, 134, 137, 140, 144, 146, + 149, 151, 154, 156, 159, 162, 163, 167, 169, 173, + 176, 177, 180, 183, 187, 191, 195, 197, 199, 200, + 203, 205, 207, 208 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 53, 0, -1, 54, 48, 66, 77, -1, -1, 54, - 55, -1, 56, -1, 49, -1, 17, -1, 19, 76, - -1, 19, 76, 76, -1, 20, -1, 21, -1, 22, - 4, -1, 23, 4, -1, 24, 43, 76, -1, 25, - -1, 26, -1, 27, -1, 28, -1, 29, 43, 76, - -1, 31, -1, 32, -1, 33, 43, 76, -1, 34, - -1, 35, -1, 36, 76, -1, 37, 76, -1, 39, - -1, 40, -1, 41, -1, 44, -1, 60, -1, 57, - -1, 38, 72, -1, 10, -1, 8, 63, -1, 9, - 63, -1, 18, -1, 30, -1, -1, 6, 58, 65, - -1, -1, 5, 59, 65, -1, 7, 42, 63, -1, - 61, 62, 63, -1, 11, -1, 12, -1, 13, -1, - -1, 42, -1, 72, -1, 63, 72, -1, 42, -1, - 46, -1, 46, 4, -1, 46, 75, -1, 46, 4, - 75, -1, 64, -1, 65, 64, -1, 67, -1, 66, - 67, -1, 68, -1, 56, 44, -1, 1, 44, -1, - -1, 47, 69, 70, -1, 71, -1, 70, 45, 71, - -1, 70, 44, -1, -1, 71, 72, -1, 71, 73, - -1, 71, 14, 72, -1, 71, 15, 4, -1, 71, - 16, 42, -1, 46, -1, 75, -1, -1, 74, 51, - -1, 3, -1, 3, -1, -1, 48, 50, -1 + 54, 0, -1, 55, 49, 67, 78, -1, -1, 55, + 56, -1, 57, -1, 50, -1, 17, -1, 19, 77, + -1, 19, 77, 77, -1, 20, -1, 21, -1, 22, + 4, -1, 23, 4, -1, 24, 44, 77, -1, 25, + -1, 26, -1, 27, -1, 28, -1, 29, 44, 77, + -1, 31, -1, 32, -1, 33, 44, 77, -1, 34, + -1, 35, -1, 36, -1, 37, 77, -1, 38, 77, + -1, 40, -1, 41, -1, 42, -1, 45, -1, 61, + -1, 58, -1, 39, 73, -1, 10, -1, 8, 64, + -1, 9, 64, -1, 18, -1, 30, -1, -1, 6, + 59, 66, -1, -1, 5, 60, 66, -1, 7, 43, + 64, -1, 62, 63, 64, -1, 11, -1, 12, -1, + 13, -1, -1, 43, -1, 73, -1, 64, 73, -1, + 43, -1, 47, -1, 47, 4, -1, 47, 76, -1, + 47, 4, 76, -1, 65, -1, 66, 65, -1, 68, + -1, 67, 68, -1, 69, -1, 57, 45, -1, 1, + 45, -1, -1, 48, 70, 71, -1, 72, -1, 71, + 46, 72, -1, 71, 45, -1, -1, 72, 73, -1, + 72, 74, -1, 72, 14, 73, -1, 72, 15, 4, + -1, 72, 16, 43, -1, 47, -1, 76, -1, -1, + 75, 52, -1, 3, -1, 3, -1, -1, 49, 51, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 203, 203, 211, 213, 217, 218, 219, 220, 225, - 226, 227, 228, 229, 230, 231, 236, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 257, 258, 259, 263, 279, 286, 293, 297, 304, - 304, 309, 309, 314, 324, 339, 340, 341, 345, 346, - 352, 353, 358, 362, 367, 373, 379, 390, 391, 400, - 401, 407, 408, 409, 416, 416, 420, 421, 422, 427, - 428, 430, 431, 433, 435, 440, 441, 457, 457, 463, - 472, 477, 479 + 0, 204, 204, 212, 214, 218, 219, 220, 221, 226, + 227, 228, 229, 230, 231, 232, 237, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 259, 260, 261, 265, 281, 288, 295, 299, + 306, 306, 311, 311, 316, 326, 341, 342, 343, 347, + 348, 354, 355, 360, 364, 369, 375, 381, 392, 393, + 402, 403, 409, 410, 411, 418, 418, 422, 423, 424, + 429, 430, 432, 433, 435, 437, 442, 443, 459, 459, + 465, 474, 479, 481 }; #endif @@ -644,11 +650,11 @@ "\"%initial-action {...}\"", "\"%lex-param {...}\"", "\"%locations\"", "\"%name-prefix\"", "\"%no-default-prec\"", "\"%no-lines\"", "\"%nondeterministic-parser\"", "\"%output\"", "\"%parse-param {...}\"", - "\"%pure-parser\"", "\"%require\"", "\"%skeleton\"", "\"%start\"", - "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"", - "\";\"", "\"|\"", "\"identifier\"", "\"identifier:\"", "\"%%\"", - "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", "$accept", "input", - "declarations", "declaration", "grammar_declaration", + "\"%pure-parser\"", "\"%push-parser\"", "\"%require\"", "\"%skeleton\"", + "\"%start\"", "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", + "\"type\"", "\"=\"", "\";\"", "\"|\"", "\"identifier\"", + "\"identifier:\"", "\"%%\"", "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", + "$accept", "input", "declarations", "declaration", "grammar_declaration", "symbol_declaration", "@1", "@2", "precedence_declaration", "precedence_declarator", "type.opt", "symbols.1", "symbol_def", "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules", @@ -667,22 +673,22 @@ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306 + 305, 306, 307 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 52, 53, 54, 54, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, - 55, 56, 56, 56, 56, 56, 56, 56, 56, 58, - 57, 59, 57, 57, 60, 61, 61, 61, 62, 62, - 63, 63, 64, 64, 64, 64, 64, 65, 65, 66, - 66, 67, 67, 67, 69, 68, 70, 70, 70, 71, - 71, 71, 71, 71, 71, 72, 72, 74, 73, 75, - 76, 77, 77 + 0, 53, 54, 55, 55, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, + 59, 58, 60, 58, 58, 61, 62, 62, 62, 63, + 63, 64, 64, 65, 65, 65, 65, 65, 66, 66, + 67, 67, 68, 68, 68, 70, 69, 71, 71, 71, + 72, 72, 72, 72, 72, 72, 73, 73, 75, 74, + 76, 77, 78, 78 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -690,13 +696,13 @@ { 0, 2, 4, 0, 2, 1, 1, 1, 2, 3, 1, 1, 2, 2, 3, 1, 1, 1, 1, 3, - 1, 1, 3, 1, 1, 2, 2, 1, 1, 1, - 1, 1, 1, 2, 1, 2, 2, 1, 1, 0, - 3, 0, 3, 3, 3, 1, 1, 1, 0, 1, - 1, 2, 1, 1, 2, 2, 3, 1, 2, 1, - 2, 1, 2, 2, 0, 3, 1, 3, 2, 0, - 2, 2, 3, 3, 3, 1, 1, 0, 2, 1, - 1, 0, 2 + 1, 1, 3, 1, 1, 1, 2, 2, 1, 1, + 1, 1, 1, 1, 2, 1, 2, 2, 1, 1, + 0, 3, 0, 3, 3, 3, 1, 1, 1, 0, + 1, 1, 2, 1, 1, 2, 2, 3, 1, 2, + 1, 2, 1, 2, 2, 0, 3, 1, 3, 2, + 0, 2, 2, 3, 3, 3, 1, 1, 0, 2, + 1, 1, 0, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -704,121 +710,121 @@ means the default is an error. */ static const yytype_uint8 yydefact[] = { - 3, 0, 0, 1, 41, 39, 0, 0, 0, 34, - 45, 46, 47, 7, 37, 0, 10, 11, 0, 0, - 0, 15, 16, 17, 18, 0, 38, 20, 21, 0, - 23, 24, 0, 0, 0, 27, 28, 29, 30, 0, - 6, 4, 5, 32, 31, 48, 0, 0, 0, 79, - 75, 35, 50, 76, 36, 80, 8, 12, 13, 0, - 0, 0, 25, 26, 33, 0, 64, 0, 0, 59, - 61, 49, 0, 52, 53, 57, 42, 40, 43, 51, - 9, 14, 19, 22, 63, 69, 62, 0, 60, 2, - 44, 54, 55, 58, 65, 66, 82, 56, 68, 69, - 0, 0, 0, 70, 71, 0, 67, 72, 73, 74, - 78 + 3, 0, 0, 1, 42, 40, 0, 0, 0, 35, + 46, 47, 48, 7, 38, 0, 10, 11, 0, 0, + 0, 15, 16, 17, 18, 0, 39, 20, 21, 0, + 23, 24, 25, 0, 0, 0, 28, 29, 30, 31, + 0, 6, 4, 5, 33, 32, 49, 0, 0, 0, + 80, 76, 36, 51, 77, 37, 81, 8, 12, 13, + 0, 0, 0, 26, 27, 34, 0, 65, 0, 0, + 60, 62, 50, 0, 53, 54, 58, 43, 41, 44, + 52, 9, 14, 19, 22, 64, 70, 63, 0, 61, + 2, 45, 55, 56, 59, 66, 67, 83, 57, 69, + 70, 0, 0, 0, 71, 72, 0, 68, 73, 74, + 75, 79 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 2, 41, 67, 43, 47, 46, 44, 45, - 72, 51, 75, 76, 68, 69, 70, 85, 94, 95, - 52, 104, 105, 53, 56, 89 + -1, 1, 2, 42, 68, 44, 48, 47, 45, 46, + 73, 52, 76, 77, 69, 70, 71, 86, 95, 96, + 53, 105, 106, 54, 57, 90 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -69 +#define YYPACT_NINF -71 static const yytype_int8 yypact[] = { - -69, 5, 112, -69, -69, -69, -35, 0, 0, -69, - -69, -69, -69, -69, -69, 13, -69, -69, 20, 31, - -18, -69, -69, -69, -69, -6, -69, -69, -69, -5, - -69, -69, 13, 13, 0, -69, -69, -69, -69, 69, - -69, -69, -69, -69, -69, -2, -38, -38, 0, -69, - -69, 0, -69, -69, 0, -69, 13, -69, -69, 13, - 13, 13, -69, -69, -69, -8, -69, 3, 21, -69, - -69, -69, 0, -69, 6, -69, -38, -38, 0, -69, - -69, -69, -69, -69, -69, -69, -69, 2, -69, -69, - 0, 39, -69, -69, -33, -1, -69, -69, -69, -69, - 0, 44, 1, -69, -69, 4, -1, -69, -69, -69, - -69 + -71, 18, 112, -71, -71, -71, -20, -2, -2, -71, + -71, -71, -71, -71, -71, 22, -71, -71, 25, 34, + -5, -71, -71, -71, -71, -4, -71, -71, -71, -3, + -71, -71, -71, 22, 22, -2, -71, -71, -71, -71, + 68, -71, -71, -71, -71, -71, 4, -19, -19, -2, + -71, -71, -2, -71, -71, -2, -71, 22, -71, -71, + 22, 22, 22, -71, -71, -71, 1, -71, 12, 3, + -71, -71, -71, -2, -71, 31, -71, -19, -19, -2, + -71, -71, -71, -71, -71, -71, -71, -71, 7, -71, + -71, -2, 45, -71, -71, -39, 16, -71, -71, -71, + -71, -2, 55, 6, -71, -71, 8, 16, -71, -71, + -71, -71 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -69, -69, -69, -69, 47, -69, -69, -69, -69, -69, - -69, -7, -58, 7, -69, -15, -69, -69, -69, -42, - -34, -69, -69, -68, 30, -69 + -71, -71, -71, -71, 60, -71, -71, -71, -71, -71, + -71, -6, -41, 17, -71, 2, -71, -71, -71, -36, + -35, -71, -71, -70, -7, -71 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -82 +#define YYTABLE_NINF -83 static const yytype_int8 yytable[] = { - 64, 54, 49, 49, 73, 3, 92, 48, 74, 49, - 91, 98, 99, 100, 101, 102, 55, 79, 93, 93, - 79, -81, 65, 97, 57, 59, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 58, 84, 60, 61, 14, - 71, 78, 49, 109, 79, 50, 50, 86, 108, 42, - -77, 26, 96, 88, 77, 110, 79, 106, 0, 34, - 0, 103, 62, 63, 0, 90, 107, 0, 66, 87, - 65, 0, 103, 0, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 0, 0, 0, 80, 14, 0, 81, - 82, 83, 0, 0, 0, 0, 0, 0, 0, 26, - 0, 0, 0, 0, 0, 0, 0, 34, 0, 0, - 0, 0, 0, 0, 0, 0, 66, 4, 5, 6, + 65, 50, 55, -82, 66, 93, 99, 100, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 80, 3, 50, + 80, 14, 98, 49, 74, 56, 63, 64, 75, 58, + 101, 102, 103, 26, 50, 92, 94, 94, 59, 60, + 61, 62, 35, 79, 80, 51, 85, 72, 50, 110, + 81, 67, 88, 82, 83, 84, 80, 87, 97, 109, + 111, 104, 43, 51, 107, 78, 108, 91, -78, 66, + 0, 89, 104, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 0, 0, 0, 0, 14, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, + 0, 0, 0, 0, 0, 0, 0, 35, 0, 0, + 0, 0, 0, 0, 0, 0, 67, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 0, 0, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 0, 0, 38, 0, 0, 0, - 39, 40 + 34, 35, 36, 37, 38, 0, 0, 39, 0, 0, + 0, 40, 41 }; static const yytype_int8 yycheck[] = { - 34, 8, 3, 3, 42, 0, 74, 42, 46, 3, - 4, 44, 45, 14, 15, 16, 3, 51, 76, 77, - 54, 0, 1, 91, 4, 43, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 4, 44, 43, 43, 18, - 42, 48, 3, 42, 78, 46, 46, 44, 4, 2, - 51, 30, 50, 68, 47, 51, 90, 99, -1, 38, - -1, 95, 32, 33, -1, 72, 100, -1, 47, 48, - 1, -1, 106, -1, 5, 6, 7, 8, 9, 10, - 11, 12, 13, -1, -1, -1, 56, 18, -1, 59, - 60, 61, -1, -1, -1, -1, -1, -1, -1, 30, - -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, - -1, -1, -1, -1, -1, -1, 47, 5, 6, 7, + 35, 3, 8, 0, 1, 75, 45, 46, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 52, 0, 3, + 55, 18, 92, 43, 43, 3, 33, 34, 47, 4, + 14, 15, 16, 30, 3, 4, 77, 78, 4, 44, + 44, 44, 39, 49, 79, 47, 45, 43, 3, 43, + 57, 48, 49, 60, 61, 62, 91, 45, 51, 4, + 52, 96, 2, 47, 100, 48, 101, 73, 52, 1, + -1, 69, 107, 5, 6, 7, 8, 9, 10, 11, + 12, 13, -1, -1, -1, -1, 18, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, + -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, + -1, -1, -1, -1, -1, -1, 48, 5, 6, 7, 8, 9, 10, 11, 12, 13, -1, -1, -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, -1, -1, 44, -1, -1, -1, - 48, 49 + 38, 39, 40, 41, 42, -1, -1, 45, -1, -1, + -1, 49, 50 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 53, 54, 0, 5, 6, 7, 8, 9, 10, + 0, 54, 55, 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 44, 48, - 49, 55, 56, 57, 60, 61, 59, 58, 42, 3, - 46, 63, 72, 75, 63, 3, 76, 4, 4, 43, - 43, 43, 76, 76, 72, 1, 47, 56, 66, 67, - 68, 42, 62, 42, 46, 64, 65, 65, 63, 72, - 76, 76, 76, 76, 44, 69, 44, 48, 67, 77, - 63, 4, 75, 64, 70, 71, 50, 75, 44, 45, - 14, 15, 16, 72, 73, 74, 71, 72, 4, 42, - 51 + 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, + 49, 50, 56, 57, 58, 61, 62, 60, 59, 43, + 3, 47, 64, 73, 76, 64, 3, 77, 4, 4, + 44, 44, 44, 77, 77, 73, 1, 48, 57, 67, + 68, 69, 43, 63, 43, 47, 65, 66, 66, 64, + 73, 77, 77, 77, 77, 45, 70, 45, 49, 68, + 78, 64, 4, 76, 65, 71, 72, 51, 76, 45, + 46, 14, 15, 16, 73, 74, 75, 72, 73, 4, + 43, 52 }; -#define yyerrok (yyerrstatus = 0) +#define yyerrok (pv->yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 @@ -834,7 +840,7 @@ #define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) +#define YYRECOVERING() (!!pv->yyerrstatus) #define YYBACKUP(Token, Value) \ do \ @@ -964,84 +970,84 @@ switch (yytype) { case 3: /* "\"string\"" */ -#line 180 "parse-gram.y" +#line 181 "../../bison/src/parse-gram.y" { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); }; -#line 970 "parse-gram.c" +#line 976 "../../bison/src/parse-gram.c" break; case 4: /* "\"integer\"" */ -#line 193 "parse-gram.y" +#line 194 "../../bison/src/parse-gram.y" { fprintf (stderr, "%d", (yyvaluep->integer)); }; -#line 975 "parse-gram.c" +#line 981 "../../bison/src/parse-gram.c" break; case 8: /* "\"%destructor {...}\"" */ -#line 182 "parse-gram.y" +#line 183 "../../bison/src/parse-gram.y" { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 980 "parse-gram.c" +#line 986 "../../bison/src/parse-gram.c" break; case 9: /* "\"%printer {...}\"" */ -#line 182 "parse-gram.y" +#line 183 "../../bison/src/parse-gram.y" { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 985 "parse-gram.c" +#line 991 "../../bison/src/parse-gram.c" break; case 10: /* "\"%union {...}\"" */ -#line 182 "parse-gram.y" +#line 183 "../../bison/src/parse-gram.y" { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 990 "parse-gram.c" +#line 996 "../../bison/src/parse-gram.c" break; case 26: /* "\"%initial-action {...}\"" */ -#line 182 "parse-gram.y" +#line 183 "../../bison/src/parse-gram.y" { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 995 "parse-gram.c" +#line 1001 "../../bison/src/parse-gram.c" break; case 27: /* "\"%lex-param {...}\"" */ -#line 182 "parse-gram.y" +#line 183 "../../bison/src/parse-gram.y" { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 1000 "parse-gram.c" +#line 1006 "../../bison/src/parse-gram.c" break; case 34: /* "\"%parse-param {...}\"" */ -#line 182 "parse-gram.y" +#line 183 "../../bison/src/parse-gram.y" { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 1005 "parse-gram.c" +#line 1011 "../../bison/src/parse-gram.c" break; - case 42: /* "\"type\"" */ -#line 191 "parse-gram.y" + case 43: /* "\"type\"" */ +#line 192 "../../bison/src/parse-gram.y" { fprintf (stderr, "<%s>", (yyvaluep->uniqstr)); }; -#line 1010 "parse-gram.c" +#line 1016 "../../bison/src/parse-gram.c" break; - case 46: /* "\"identifier\"" */ -#line 195 "parse-gram.y" + case 47: /* "\"identifier\"" */ +#line 196 "../../bison/src/parse-gram.y" { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; -#line 1015 "parse-gram.c" +#line 1021 "../../bison/src/parse-gram.c" break; - case 47: /* "\"identifier:\"" */ -#line 197 "parse-gram.y" + case 48: /* "\"identifier:\"" */ +#line 198 "../../bison/src/parse-gram.y" { fprintf (stderr, "%s:", (yyvaluep->symbol)->tag); }; -#line 1020 "parse-gram.c" +#line 1026 "../../bison/src/parse-gram.c" break; - case 49: /* "\"%{...%}\"" */ -#line 182 "parse-gram.y" + case 50: /* "\"%{...%}\"" */ +#line 183 "../../bison/src/parse-gram.y" { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 1025 "parse-gram.c" +#line 1031 "../../bison/src/parse-gram.c" break; - case 50: /* "\"epilogue\"" */ -#line 182 "parse-gram.y" + case 51: /* "\"epilogue\"" */ +#line 183 "../../bison/src/parse-gram.y" { fprintf (stderr, "{\n%s\n}", (yyvaluep->chars)); }; -#line 1030 "parse-gram.c" +#line 1036 "../../bison/src/parse-gram.c" break; - case 72: /* "symbol" */ -#line 195 "parse-gram.y" + case 73: /* "symbol" */ +#line 196 "../../bison/src/parse-gram.y" { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; -#line 1035 "parse-gram.c" +#line 1041 "../../bison/src/parse-gram.c" break; - case 75: /* "string_as_id" */ -#line 195 "parse-gram.y" + case 76: /* "string_as_id" */ +#line 196 "../../bison/src/parse-gram.y" { fprintf (stderr, "%s", (yyvaluep->symbol)->tag); }; -#line 1040 "parse-gram.c" +#line 1046 "../../bison/src/parse-gram.c" break; - case 76: /* "string_content" */ -#line 180 "parse-gram.y" + case 77: /* "string_content" */ +#line 181 "../../bison/src/parse-gram.y" { fprintf (stderr, "\"%s\"", (yyvaluep->chars)); }; -#line 1045 "parse-gram.c" +#line 1051 "../../bison/src/parse-gram.c" break; default: break; @@ -1142,7 +1148,7 @@ # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (yyvsp, yylsp, Rule); \ + yy_reduce_print (pv->yyvsp, pv->yylsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that @@ -1439,6 +1445,82 @@ +struct yypvars + { + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg; + YYSIZE_T yymsg_alloc; +#endif + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; +#define YYPOPSTACK(N) (pv->yyvsp -= (N), pv->yyssp -= (N), pv->yylsp -= (N)) + YYSIZE_T yystacksize; + int yylen; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval;YYLTYPE yyloc; + }; + +/* Init the parser data structure. Use malloc, should perhaps use a + system dependent equivalent function. */ +static void* +yypvarsinit (void) +{ + struct yypvars *pv; + pv= (struct yypvars *) malloc(sizeof(struct yypvars)); + pv->yystate = 0; + pv->yyerrstatus = 0; + pv->yytoken = 0; + +#if YYERROR_VERBOSE + pv->yymsg = pv->yymsgbuf; + pv->yymsg_alloc = sizeof pv->yymsgbuf; +#endif + + pv->yyss = pv->yyssa; + pv->yyvs = pv->yyvsa; + + pv->yyls = pv->yylsa; + pv->yystacksize = YYINITDEPTH; + + pv->yyssp = pv->yyss; + pv->yyvsp = pv->yyvs; + + pv->yylsp = pv->yyls; + return (void*) pv; +} /*----------. | yyparse. | @@ -1477,62 +1559,13 @@ /* Location data for the look-ahead symbol. */ YYLTYPE yylloc; - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; + struct yypvars *pv; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ - int yylen = 0; - YYDPRINTF ((stderr, "Starting parse\n")); + pv = yypvarsinit (); - yystate = 0; - yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ @@ -1541,9 +1574,7 @@ so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; - yyvsp = yyvs; - yylsp = yyls; + pv->yylsp = pv->yyls; #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; @@ -1552,7 +1583,7 @@ /* User initialization code. */ -#line 85 "parse-gram.y" +#line 85 "../../bison/src/parse-gram.y" { /* Bison's grammar can initial empty locations, hence a default location is needed. */ @@ -1560,9 +1591,9 @@ yylloc.start.line = yylloc.end.line = 1; yylloc.start.column = yylloc.end.column = 0; } -/* Line 1083 of yacc.c. */ -#line 1565 "parse-gram.c" - yylsp[0] = yylloc; +/* Line 1118 of yacc.c. */ +#line 1596 "../../bison/src/parse-gram.c" + pv->yylsp[0] = yylloc; goto yysetstate; /*------------------------------------------------------------. @@ -1571,15 +1602,15 @@ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; + pv->yyssp++; yysetstate: - *yyssp = yystate; + *pv->yyssp = pv->yystate; - if (yyss + yystacksize - 1 <= yyssp) + if (pv->yyss + pv->yystacksize - 1 <= pv->yyssp) { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYSIZE_T yysize = pv->yyssp - pv->yyss + 1; #ifdef yyoverflow { @@ -1598,7 +1629,7 @@ &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), - &yystacksize); + &pv->yystacksize); yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -1608,40 +1639,43 @@ goto yyexhaustedlab; # else /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) + if (YYMAXDEPTH <= pv->yystacksize) goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; + pv->yystacksize *= 2; + if (YYMAXDEPTH < pv->yystacksize) + pv->yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yytype_int16 *yyss; + YYSTYPE *yyvs;YYLTYPE *yyls; + + yytype_int16 *yyss1 = pv->yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (pv->yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); YYSTACK_RELOCATE (yyls); # undef YYSTACK_RELOCATE - if (yyss1 != yyssa) + if (yyss1 != pv->yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - yylsp = yyls + yysize - 1; + pv->yyssp = pv->yyss + yysize - 1; + pv->yyvsp = pv->yyvs + yysize - 1; + pv->yylsp = pv->yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); + (unsigned long int) pv->yystacksize)); - if (yyss + yystacksize - 1 <= yyssp) + if (pv->yyss + pv->yystacksize - 1 <= pv->yyssp) YYABORT; } - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YYDPRINTF ((stderr, "Entering state %d\n", pv->yystate)); goto yybackup; @@ -1654,8 +1688,8 @@ look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + pv->yyn = yypact[pv->yystate]; + if (pv->yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ @@ -1669,47 +1703,47 @@ if (yychar <= YYEOF) { - yychar = yytoken = YYEOF; + yychar = pv->yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + pv->yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", pv->yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + pv->yyn += pv->yytoken; + if (pv->yyn < 0 || YYLAST < pv->yyn || yycheck[pv->yyn] != pv->yytoken) goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) + pv->yyn = yytable[pv->yyn]; + if (pv->yyn <= 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) + if (pv->yyn == 0 || pv->yyn == YYTABLE_NINF) goto yyerrlab; - yyn = -yyn; + pv->yyn = -pv->yyn; goto yyreduce; } - if (yyn == YYFINAL) + if (pv->yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) - yyerrstatus--; + if (pv->yyerrstatus) + pv->yyerrstatus--; /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + YY_SYMBOL_PRINT ("Shifting", pv->yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; - yystate = yyn; - *++yyvsp = yylval; - *++yylsp = yylloc; + pv->yystate = pv->yyn; + *++(pv->yyvsp) = yylval; + *++(pv->yylsp) = yylloc; goto yynewstate; @@ -1717,8 +1751,8 @@ | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) + pv->yyn = yydefact[pv->yystate]; + if (pv->yyn == 0) goto yyerrlab; goto yyreduce; @@ -1728,7 +1762,7 @@ `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; + pv->yylen = yyr2[pv->yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. @@ -1738,63 +1772,63 @@ users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; + pv->yyval = pv->yyvsp[1-pv->yylen]; /* Default location. */ - YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); - YY_REDUCE_PRINT (yyn); - switch (yyn) + YYLLOC_DEFAULT (pv->yyloc, (pv->yylsp - pv->yylen), pv->yylen); + YY_REDUCE_PRINT (pv->yyn); + switch (pv->yyn) { case 6: -#line 218 "parse-gram.y" - { prologue_augment ((yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); } +#line 219 "../../bison/src/parse-gram.y" + { prologue_augment ((pv->yyvsp[(1) - (1)].chars), (pv->yylsp[(1) - (1)])); } break; case 7: -#line 219 "parse-gram.y" +#line 220 "../../bison/src/parse-gram.y" { debug_flag = true; } break; case 8: -#line 221 "parse-gram.y" +#line 222 "../../bison/src/parse-gram.y" { static char one[] = "1"; - muscle_insert ((yyvsp[(2) - (2)].chars), one); + muscle_insert ((pv->yyvsp[(2) - (2)].chars), one); } break; case 9: -#line 225 "parse-gram.y" - { muscle_insert ((yyvsp[(2) - (3)].chars), (yyvsp[(3) - (3)].chars)); } +#line 226 "../../bison/src/parse-gram.y" + { muscle_insert ((pv->yyvsp[(2) - (3)].chars), (pv->yyvsp[(3) - (3)].chars)); } break; case 10: -#line 226 "parse-gram.y" +#line 227 "../../bison/src/parse-gram.y" { defines_flag = true; } break; case 11: -#line 227 "parse-gram.y" +#line 228 "../../bison/src/parse-gram.y" { error_verbose = true; } break; case 12: -#line 228 "parse-gram.y" - { expected_sr_conflicts = (yyvsp[(2) - (2)].integer); } +#line 229 "../../bison/src/parse-gram.y" + { expected_sr_conflicts = (pv->yyvsp[(2) - (2)].integer); } break; case 13: -#line 229 "parse-gram.y" - { expected_rr_conflicts = (yyvsp[(2) - (2)].integer); } +#line 230 "../../bison/src/parse-gram.y" + { expected_rr_conflicts = (pv->yyvsp[(2) - (2)].integer); } break; case 14: -#line 230 "parse-gram.y" - { spec_file_prefix = (yyvsp[(3) - (3)].chars); } +#line 231 "../../bison/src/parse-gram.y" + { spec_file_prefix = (pv->yyvsp[(3) - (3)].chars); } break; case 15: -#line 232 "parse-gram.y" +#line 233 "../../bison/src/parse-gram.y" { nondeterministic_parser = true; glr_parser = true; @@ -1802,88 +1836,93 @@ break; case 16: -#line 237 "parse-gram.y" +#line 238 "../../bison/src/parse-gram.y" { - muscle_code_grow ("initial_action", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); + muscle_code_grow ("initial_action", (pv->yyvsp[(1) - (1)].chars), (pv->yylsp[(1) - (1)])); } break; case 17: -#line 240 "parse-gram.y" - { add_param ("lex_param", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); } +#line 241 "../../bison/src/parse-gram.y" + { add_param ("lex_param", (pv->yyvsp[(1) - (1)].chars), (pv->yylsp[(1) - (1)])); } break; case 18: -#line 241 "parse-gram.y" +#line 242 "../../bison/src/parse-gram.y" { locations_flag = true; } break; case 19: -#line 242 "parse-gram.y" - { spec_name_prefix = (yyvsp[(3) - (3)].chars); } +#line 243 "../../bison/src/parse-gram.y" + { spec_name_prefix = (pv->yyvsp[(3) - (3)].chars); } break; case 20: -#line 243 "parse-gram.y" +#line 244 "../../bison/src/parse-gram.y" { no_lines_flag = true; } break; case 21: -#line 244 "parse-gram.y" +#line 245 "../../bison/src/parse-gram.y" { nondeterministic_parser = true; } break; case 22: -#line 245 "parse-gram.y" - { spec_outfile = (yyvsp[(3) - (3)].chars); } +#line 246 "../../bison/src/parse-gram.y" + { spec_outfile = (pv->yyvsp[(3) - (3)].chars); } break; case 23: -#line 246 "parse-gram.y" - { add_param ("parse_param", (yyvsp[(1) - (1)].chars), (yylsp[(1) - (1)])); } +#line 247 "../../bison/src/parse-gram.y" + { add_param ("parse_param", (pv->yyvsp[(1) - (1)].chars), (pv->yylsp[(1) - (1)])); } break; case 24: -#line 247 "parse-gram.y" +#line 248 "../../bison/src/parse-gram.y" { pure_parser = true; } break; case 25: -#line 248 "parse-gram.y" - { version_check (&(yylsp[(2) - (2)]), (yyvsp[(2) - (2)].chars)); } +#line 249 "../../bison/src/parse-gram.y" + { push_parser = true; } break; case 26: -#line 249 "parse-gram.y" - { skeleton = (yyvsp[(2) - (2)].chars); } +#line 250 "../../bison/src/parse-gram.y" + { version_check (&(pv->yylsp[(2) - (2)]), (pv->yyvsp[(2) - (2)].chars)); } break; case 27: -#line 250 "parse-gram.y" - { token_table_flag = true; } +#line 251 "../../bison/src/parse-gram.y" + { skeleton = (pv->yyvsp[(2) - (2)].chars); } break; case 28: -#line 251 "parse-gram.y" - { report_flag = report_states; } +#line 252 "../../bison/src/parse-gram.y" + { token_table_flag = true; } break; case 29: -#line 252 "parse-gram.y" +#line 253 "../../bison/src/parse-gram.y" + { report_flag = report_states; } + break; + + case 30: +#line 254 "../../bison/src/parse-gram.y" { yacc_flag = true; } break; - case 33: -#line 260 "parse-gram.y" + case 34: +#line 262 "../../bison/src/parse-gram.y" { - grammar_start_symbol_set ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); + grammar_start_symbol_set ((pv->yyvsp[(2) - (2)].symbol), (pv->yylsp[(2) - (2)])); } break; - case 34: -#line 264 "parse-gram.y" + case 35: +#line 266 "../../bison/src/parse-gram.y" { - char const *body = (yyvsp[(1) - (1)].chars); + char const *body = (pv->yyvsp[(1) - (1)].chars); if (typed) { @@ -1895,281 +1934,281 @@ } typed = true; - muscle_code_grow ("stype", body, (yylsp[(1) - (1)])); + muscle_code_grow ("stype", body, (pv->yylsp[(1) - (1)])); } break; - case 35: -#line 280 "parse-gram.y" + case 36: +#line 282 "../../bison/src/parse-gram.y" { symbol_list *list; - for (list = (yyvsp[(2) - (2)].list); list; list = list->next) - symbol_destructor_set (list->sym, (yyvsp[(1) - (2)].chars), (yylsp[(1) - (2)])); - symbol_list_free ((yyvsp[(2) - (2)].list)); + for (list = (pv->yyvsp[(2) - (2)].list); list; list = list->next) + symbol_destructor_set (list->sym, (pv->yyvsp[(1) - (2)].chars), (pv->yylsp[(1) - (2)])); + symbol_list_free ((pv->yyvsp[(2) - (2)].list)); } break; - case 36: -#line 287 "parse-gram.y" + case 37: +#line 289 "../../bison/src/parse-gram.y" { symbol_list *list; - for (list = (yyvsp[(2) - (2)].list); list; list = list->next) - symbol_printer_set (list->sym, (yyvsp[(1) - (2)].chars), (yylsp[(1) - (2)])); - symbol_list_free ((yyvsp[(2) - (2)].list)); + for (list = (pv->yyvsp[(2) - (2)].list); list; list = list->next) + symbol_printer_set (list->sym, (pv->yyvsp[(1) - (2)].chars), (pv->yylsp[(1) - (2)])); + symbol_list_free ((pv->yyvsp[(2) - (2)].list)); } break; - case 37: -#line 294 "parse-gram.y" + case 38: +#line 296 "../../bison/src/parse-gram.y" { default_prec = true; } break; - case 38: -#line 298 "parse-gram.y" + case 39: +#line 300 "../../bison/src/parse-gram.y" { default_prec = false; } break; - case 39: -#line 304 "parse-gram.y" + case 40: +#line 306 "../../bison/src/parse-gram.y" { current_class = nterm_sym; } break; - case 40: -#line 305 "parse-gram.y" + case 41: +#line 307 "../../bison/src/parse-gram.y" { current_class = unknown_sym; current_type = NULL; } break; - case 41: -#line 309 "parse-gram.y" + case 42: +#line 311 "../../bison/src/parse-gram.y" { current_class = token_sym; } break; - case 42: -#line 310 "parse-gram.y" + case 43: +#line 312 "../../bison/src/parse-gram.y" { current_class = unknown_sym; current_type = NULL; } break; - case 43: -#line 315 "parse-gram.y" + case 44: +#line 317 "../../bison/src/parse-gram.y" { symbol_list *list; - for (list = (yyvsp[(3) - (3)].list); list; list = list->next) - symbol_type_set (list->sym, (yyvsp[(2) - (3)].uniqstr), (yylsp[(2) - (3)])); - symbol_list_free ((yyvsp[(3) - (3)].list)); + for (list = (pv->yyvsp[(3) - (3)].list); list; list = list->next) + symbol_type_set (list->sym, (pv->yyvsp[(2) - (3)].uniqstr), (pv->yylsp[(2) - (3)])); + symbol_list_free ((pv->yyvsp[(3) - (3)].list)); } break; - case 44: -#line 325 "parse-gram.y" + case 45: +#line 327 "../../bison/src/parse-gram.y" { symbol_list *list; ++current_prec; - for (list = (yyvsp[(3) - (3)].list); list; list = list->next) + for (list = (pv->yyvsp[(3) - (3)].list); list; list = list->next) { - symbol_type_set (list->sym, current_type, (yylsp[(2) - (3)])); - symbol_precedence_set (list->sym, current_prec, (yyvsp[(1) - (3)].assoc), (yylsp[(1) - (3)])); + symbol_type_set (list->sym, current_type, (pv->yylsp[(2) - (3)])); + symbol_precedence_set (list->sym, current_prec, (pv->yyvsp[(1) - (3)].assoc), (pv->yylsp[(1) - (3)])); } - symbol_list_free ((yyvsp[(3) - (3)].list)); + symbol_list_free ((pv->yyvsp[(3) - (3)].list)); current_type = NULL; } break; - case 45: -#line 339 "parse-gram.y" - { (yyval.assoc) = left_assoc; } - break; - case 46: -#line 340 "parse-gram.y" - { (yyval.assoc) = right_assoc; } +#line 341 "../../bison/src/parse-gram.y" + { (pv->yyval.assoc) = left_assoc; } break; case 47: -#line 341 "parse-gram.y" - { (yyval.assoc) = non_assoc; } +#line 342 "../../bison/src/parse-gram.y" + { (pv->yyval.assoc) = right_assoc; } break; case 48: -#line 345 "parse-gram.y" - { current_type = NULL; } +#line 343 "../../bison/src/parse-gram.y" + { (pv->yyval.assoc) = non_assoc; } break; case 49: -#line 346 "parse-gram.y" - { current_type = (yyvsp[(1) - (1)].uniqstr); } +#line 347 "../../bison/src/parse-gram.y" + { current_type = NULL; } break; case 50: -#line 352 "parse-gram.y" - { (yyval.list) = symbol_list_new ((yyvsp[(1) - (1)].symbol), (yylsp[(1) - (1)])); } +#line 348 "../../bison/src/parse-gram.y" + { current_type = (pv->yyvsp[(1) - (1)].uniqstr); } break; case 51: -#line 353 "parse-gram.y" - { (yyval.list) = symbol_list_prepend ((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } +#line 354 "../../bison/src/parse-gram.y" + { (pv->yyval.list) = symbol_list_new ((pv->yyvsp[(1) - (1)].symbol), (pv->yylsp[(1) - (1)])); } break; case 52: -#line 359 "parse-gram.y" - { - current_type = (yyvsp[(1) - (1)].uniqstr); - } +#line 355 "../../bison/src/parse-gram.y" + { (pv->yyval.list) = symbol_list_prepend ((pv->yyvsp[(1) - (2)].list), (pv->yyvsp[(2) - (2)].symbol), (pv->yylsp[(2) - (2)])); } break; case 53: -#line 363 "parse-gram.y" +#line 361 "../../bison/src/parse-gram.y" { - symbol_class_set ((yyvsp[(1) - (1)].symbol), current_class, (yylsp[(1) - (1)]), true); - symbol_type_set ((yyvsp[(1) - (1)].symbol), current_type, (yylsp[(1) - (1)])); + current_type = (pv->yyvsp[(1) - (1)].uniqstr); } break; case 54: -#line 368 "parse-gram.y" +#line 365 "../../bison/src/parse-gram.y" { - symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); - symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); - symbol_user_token_number_set ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].integer), (yylsp[(2) - (2)])); - } + symbol_class_set ((pv->yyvsp[(1) - (1)].symbol), current_class, (pv->yylsp[(1) - (1)]), true); + symbol_type_set ((pv->yyvsp[(1) - (1)].symbol), current_type, (pv->yylsp[(1) - (1)])); + } break; case 55: -#line 374 "parse-gram.y" +#line 370 "../../bison/src/parse-gram.y" { - symbol_class_set ((yyvsp[(1) - (2)].symbol), current_class, (yylsp[(1) - (2)]), true); - symbol_type_set ((yyvsp[(1) - (2)].symbol), current_type, (yylsp[(1) - (2)])); - symbol_make_alias ((yyvsp[(1) - (2)].symbol), (yyvsp[(2) - (2)].symbol), (yyloc)); + symbol_class_set ((pv->yyvsp[(1) - (2)].symbol), current_class, (pv->yylsp[(1) - (2)]), true); + symbol_type_set ((pv->yyvsp[(1) - (2)].symbol), current_type, (pv->yylsp[(1) - (2)])); + symbol_user_token_number_set ((pv->yyvsp[(1) - (2)].symbol), (pv->yyvsp[(2) - (2)].integer), (pv->yylsp[(2) - (2)])); } break; case 56: -#line 380 "parse-gram.y" +#line 376 "../../bison/src/parse-gram.y" { - symbol_class_set ((yyvsp[(1) - (3)].symbol), current_class, (yylsp[(1) - (3)]), true); - symbol_type_set ((yyvsp[(1) - (3)].symbol), current_type, (yylsp[(1) - (3)])); - symbol_user_token_number_set ((yyvsp[(1) - (3)].symbol), (yyvsp[(2) - (3)].integer), (yylsp[(2) - (3)])); - symbol_make_alias ((yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol), (yyloc)); + symbol_class_set ((pv->yyvsp[(1) - (2)].symbol), current_class, (pv->yylsp[(1) - (2)]), true); + symbol_type_set ((pv->yyvsp[(1) - (2)].symbol), current_type, (pv->yylsp[(1) - (2)])); + symbol_make_alias ((pv->yyvsp[(1) - (2)].symbol), (pv->yyvsp[(2) - (2)].symbol), (pv->yyloc)); } break; - case 63: -#line 410 "parse-gram.y" + case 57: +#line 382 "../../bison/src/parse-gram.y" { - yyerrok; + symbol_class_set ((pv->yyvsp[(1) - (3)].symbol), current_class, (pv->yylsp[(1) - (3)]), true); + symbol_type_set ((pv->yyvsp[(1) - (3)].symbol), current_type, (pv->yylsp[(1) - (3)])); + symbol_user_token_number_set ((pv->yyvsp[(1) - (3)].symbol), (pv->yyvsp[(2) - (3)].integer), (pv->yylsp[(2) - (3)])); + symbol_make_alias ((pv->yyvsp[(1) - (3)].symbol), (pv->yyvsp[(3) - (3)].symbol), (pv->yyloc)); } break; case 64: -#line 416 "parse-gram.y" - { current_lhs = (yyvsp[(1) - (1)].symbol); current_lhs_location = (yylsp[(1) - (1)]); } +#line 412 "../../bison/src/parse-gram.y" + { + yyerrok; + } break; - case 66: -#line 420 "parse-gram.y" - { grammar_current_rule_end ((yylsp[(1) - (1)])); } + case 65: +#line 418 "../../bison/src/parse-gram.y" + { current_lhs = (pv->yyvsp[(1) - (1)].symbol); current_lhs_location = (pv->yylsp[(1) - (1)]); } break; case 67: -#line 421 "parse-gram.y" - { grammar_current_rule_end ((yylsp[(3) - (3)])); } +#line 422 "../../bison/src/parse-gram.y" + { grammar_current_rule_end ((pv->yylsp[(1) - (1)])); } break; - case 69: -#line 427 "parse-gram.y" - { grammar_current_rule_begin (current_lhs, current_lhs_location); } + case 68: +#line 423 "../../bison/src/parse-gram.y" + { grammar_current_rule_end ((pv->yylsp[(3) - (3)])); } break; case 70: -#line 429 "parse-gram.y" - { grammar_current_rule_symbol_append ((yyvsp[(2) - (2)].symbol), (yylsp[(2) - (2)])); } +#line 429 "../../bison/src/parse-gram.y" + { grammar_current_rule_begin (current_lhs, current_lhs_location); } break; - case 72: -#line 432 "parse-gram.y" - { grammar_current_rule_prec_set ((yyvsp[(3) - (3)].symbol), (yylsp[(3) - (3)])); } + case 71: +#line 431 "../../bison/src/parse-gram.y" + { grammar_current_rule_symbol_append ((pv->yyvsp[(2) - (2)].symbol), (pv->yylsp[(2) - (2)])); } break; case 73: -#line 434 "parse-gram.y" - { grammar_current_rule_dprec_set ((yyvsp[(3) - (3)].integer), (yylsp[(3) - (3)])); } +#line 434 "../../bison/src/parse-gram.y" + { grammar_current_rule_prec_set ((pv->yyvsp[(3) - (3)].symbol), (pv->yylsp[(3) - (3)])); } break; case 74: -#line 436 "parse-gram.y" - { grammar_current_rule_merge_set ((yyvsp[(3) - (3)].uniqstr), (yylsp[(3) - (3)])); } +#line 436 "../../bison/src/parse-gram.y" + { grammar_current_rule_dprec_set ((pv->yyvsp[(3) - (3)].integer), (pv->yylsp[(3) - (3)])); } break; case 75: -#line 440 "parse-gram.y" - { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } +#line 438 "../../bison/src/parse-gram.y" + { grammar_current_rule_merge_set ((pv->yyvsp[(3) - (3)].uniqstr), (pv->yylsp[(3) - (3)])); } break; case 76: -#line 441 "parse-gram.y" - { (yyval.symbol) = (yyvsp[(1) - (1)].symbol); } +#line 442 "../../bison/src/parse-gram.y" + { (pv->yyval.symbol) = (pv->yyvsp[(1) - (1)].symbol); } break; case 77: -#line 457 "parse-gram.y" +#line 443 "../../bison/src/parse-gram.y" + { (pv->yyval.symbol) = (pv->yyvsp[(1) - (1)].symbol); } + break; + + case 78: +#line 459 "../../bison/src/parse-gram.y" { grammar_current_rule_action_append (last_string, last_braced_code_loc); } break; - case 79: -#line 464 "parse-gram.y" + case 80: +#line 466 "../../bison/src/parse-gram.y" { - (yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (yyvsp[(1) - (1)].chars)), (yylsp[(1) - (1)])); - symbol_class_set ((yyval.symbol), token_sym, (yylsp[(1) - (1)]), false); + (pv->yyval.symbol) = symbol_get (quotearg_style (c_quoting_style, (pv->yyvsp[(1) - (1)].chars)), (pv->yylsp[(1) - (1)])); + symbol_class_set ((pv->yyval.symbol), token_sym, (pv->yylsp[(1) - (1)]), false); } break; - case 80: -#line 473 "parse-gram.y" - { (yyval.chars) = (yyvsp[(1) - (1)].chars); } + case 81: +#line 475 "../../bison/src/parse-gram.y" + { (pv->yyval.chars) = (pv->yyvsp[(1) - (1)].chars); } break; - case 82: -#line 480 "parse-gram.y" + case 83: +#line 482 "../../bison/src/parse-gram.y" { - muscle_code_grow ("epilogue", (yyvsp[(2) - (2)].chars), (yylsp[(2) - (2)])); + muscle_code_grow ("epilogue", (pv->yyvsp[(2) - (2)].chars), (pv->yylsp[(2) - (2)])); scanner_last_string_free (); } break; -/* Line 1272 of yacc.c. */ -#line 2151 "parse-gram.c" +/* Line 1310 of yacc.c. */ +#line 2190 "../../bison/src/parse-gram.c" default: break; } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + YY_SYMBOL_PRINT ("-> $$ =", yyr1[pv->yyn], &pv->yyval, &pv->yyloc); - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); + YYPOPSTACK (pv->yylen); + pv->yylen = 0; + YY_STACK_PRINT (pv->yyss, pv->yyssp); - *++yyvsp = yyval; - *++yylsp = yyloc; + *++(pv->yyvsp) = pv->yyval; + *++(pv->yylsp) = pv->yyloc; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ - yyn = yyr1[yyn]; + pv->yyn = yyr1[pv->yyn]; - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; + pv->yystate = yypgoto[pv->yyn - YYNTOKENS] + *pv->yyssp; + if (0 <= pv->yystate && pv->yystate <= YYLAST && yycheck[pv->yystate] == *pv->yyssp) + pv->yystate = yytable[pv->yystate]; else - yystate = yydefgoto[yyn - YYNTOKENS]; + pv->yystate = yydefgoto[pv->yyn - YYNTOKENS]; goto yynewstate; @@ -2179,35 +2218,35 @@ `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) + if (!pv->yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + YYSIZE_T yysize = yysyntax_error (0, pv->yystate, yychar); + if (pv->yymsg_alloc < yysize && pv->yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; + if (pv->yymsg != pv->yymsgbuf) + YYSTACK_FREE (pv->yymsg); + pv->yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (pv->yymsg) + pv->yymsg_alloc = yyalloc; else { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; + pv->yymsg = pv->yymsgbuf; + pv->yymsg_alloc = sizeof pv->yymsgbuf; } } - if (0 < yysize && yysize <= yymsg_alloc) + if (0 < yysize && yysize <= pv->yymsg_alloc) { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); + (void) yysyntax_error (pv->yymsg, pv->yystate, yychar); + yyerror (pv->yymsg); } else { @@ -2219,9 +2258,9 @@ #endif } - yyerror_range[0] = yylloc; + pv->yyerror_range[0] = yylloc; - if (yyerrstatus == 3) + if (pv->yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ @@ -2235,7 +2274,7 @@ else { yydestruct ("Error: discarding", - yytoken, &yylval, &yylloc); + pv->yytoken, &yylval, &yylloc); yychar = YYEMPTY; } } @@ -2256,13 +2295,13 @@ if (/*CONSTCOND*/ 0) goto yyerrorlab; - yyerror_range[0] = yylsp[1-yylen]; + pv->yyerror_range[0] = pv->yylsp[1-pv->yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; + YYPOPSTACK (pv->yylen); + pv->yylen = 0; + YY_STACK_PRINT (pv->yyss, pv->yyssp); + pv->yystate = *pv->yyssp; goto yyerrlab1; @@ -2270,49 +2309,49 @@ | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + pv->yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) + pv->yyn = yypact[pv->yystate]; + if (pv->yyn != YYPACT_NINF) { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + pv->yyn += YYTERROR; + if (0 <= pv->yyn && pv->yyn <= YYLAST && yycheck[pv->yyn] == YYTERROR) { - yyn = yytable[yyn]; - if (0 < yyn) + pv->yyn = yytable[pv->yyn]; + if (0 < pv->yyn) break; } } /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) + if (pv->yyssp == pv->yyss) YYABORT; - yyerror_range[0] = *yylsp; + pv->yyerror_range[0] = *pv->yylsp; yydestruct ("Error: popping", - yystos[yystate], yyvsp, yylsp); + yystos[pv->yystate], pv->yyvsp, pv->yylsp); YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); + pv->yystate = *pv->yyssp; + YY_STACK_PRINT (pv->yyss, pv->yyssp); } - if (yyn == YYFINAL) + if (pv->yyn == YYFINAL) YYACCEPT; - *++yyvsp = yylval; + *++(pv->yyvsp) = yylval; - yyerror_range[1] = yylloc; + pv->yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of the look-ahead. YYLOC is available though. */ - YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); - *++yylsp = yyloc; + YYLLOC_DEFAULT (pv->yyloc, (pv->yyerror_range - 1), 2); + *++(pv->yylsp) = pv->yyloc; /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", yystos[pv->yyn], pv->yyvsp, pv->yylsp); - yystate = yyn; + pv->yystate = pv->yyn; goto yynewstate; @@ -2320,14 +2359,14 @@ | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: - yyresult = 0; + pv->yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: - yyresult = 1; + pv->yyresult = 1; goto yyreturn; #ifndef yyoverflow @@ -2336,37 +2375,41 @@ `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); - yyresult = 2; + pv->yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval, &yylloc); + pv->yytoken, &yylval, &yylloc); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) + YYPOPSTACK (pv->yylen); + YY_STACK_PRINT (pv->yyss, pv->yyssp); + while (pv->yyssp != pv->yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp, yylsp); + yystos[*pv->yyssp], pv->yyvsp, pv->yylsp); YYPOPSTACK (1); } #ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); + if (pv->yyss != pv->yyssa) + YYSTACK_FREE (pv->yyss); #endif #if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); + if (pv->yymsg != pv->yymsgbuf) + YYSTACK_FREE (pv->yymsg); #endif - return yyresult; + { + int yyresult = pv->yyresult; + free (pv); + return yyresult; + } } -#line 486 "parse-gram.y" +#line 488 "../../bison/src/parse-gram.y" Index: src/parse-gram.h =================================================================== RCS file: /sources/bison/bison/src/parse-gram.h,v retrieving revision 1.90 diff -u -r1.90 parse-gram.h --- src/parse-gram.h 17 Feb 2006 00:23:08 -0000 1.90 +++ src/parse-gram.h 17 Mar 2006 19:34:12 -0000 @@ -63,22 +63,23 @@ PERCENT_OUTPUT = 288, PERCENT_PARSE_PARAM = 289, PERCENT_PURE_PARSER = 290, - PERCENT_REQUIRE = 291, - PERCENT_SKELETON = 292, - PERCENT_START = 293, - PERCENT_TOKEN_TABLE = 294, - PERCENT_VERBOSE = 295, - PERCENT_YACC = 296, - TYPE = 297, - EQUAL = 298, - SEMICOLON = 299, - PIPE = 300, - ID = 301, - ID_COLON = 302, - PERCENT_PERCENT = 303, - PROLOGUE = 304, - EPILOGUE = 305, - BRACED_CODE = 306 + PERCENT_PUSH_PARSER = 291, + PERCENT_REQUIRE = 292, + PERCENT_SKELETON = 293, + PERCENT_START = 294, + PERCENT_TOKEN_TABLE = 295, + PERCENT_VERBOSE = 296, + PERCENT_YACC = 297, + TYPE = 298, + EQUAL = 299, + SEMICOLON = 300, + PIPE = 301, + ID = 302, + ID_COLON = 303, + PERCENT_PERCENT = 304, + PROLOGUE = 305, + EPILOGUE = 306, + BRACED_CODE = 307 }; #endif /* Tokens. */ @@ -116,29 +117,30 @@ #define PERCENT_OUTPUT 288 #define PERCENT_PARSE_PARAM 289 #define PERCENT_PURE_PARSER 290 -#define PERCENT_REQUIRE 291 -#define PERCENT_SKELETON 292 -#define PERCENT_START 293 -#define PERCENT_TOKEN_TABLE 294 -#define PERCENT_VERBOSE 295 -#define PERCENT_YACC 296 -#define TYPE 297 -#define EQUAL 298 -#define SEMICOLON 299 -#define PIPE 300 -#define ID 301 -#define ID_COLON 302 -#define PERCENT_PERCENT 303 -#define PROLOGUE 304 -#define EPILOGUE 305 -#define BRACED_CODE 306 +#define PERCENT_PUSH_PARSER 291 +#define PERCENT_REQUIRE 292 +#define PERCENT_SKELETON 293 +#define PERCENT_START 294 +#define PERCENT_TOKEN_TABLE 295 +#define PERCENT_VERBOSE 296 +#define PERCENT_YACC 297 +#define TYPE 298 +#define EQUAL 299 +#define SEMICOLON 300 +#define PIPE 301 +#define ID 302 +#define ID_COLON 303 +#define PERCENT_PERCENT 304 +#define PROLOGUE 305 +#define EPILOGUE 306 +#define BRACED_CODE 307 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 95 "parse-gram.y" +#line 95 "../../bison/src/parse-gram.y" { symbol *symbol; symbol_list *list; @@ -147,8 +149,8 @@ assoc assoc; uniqstr uniqstr; } -/* Line 1538 of yacc.c. */ -#line 152 "parse-gram.h" +/* Line 1580 of yacc.c. */ +#line 154 "../../bison/src/parse-gram.h" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 Index: src/parse-gram.y =================================================================== RCS file: /sources/bison/bison/src/parse-gram.y,v retrieving revision 1.73 diff -u -r1.73 parse-gram.y --- src/parse-gram.y 30 Jan 2006 09:00:40 -0000 1.73 +++ src/parse-gram.y 17 Mar 2006 19:34:12 -0000 @@ -149,6 +149,7 @@ PERCENT_OUTPUT "%output" PERCENT_PARSE_PARAM "%parse-param {...}" PERCENT_PURE_PARSER "%pure-parser" + PERCENT_PUSH_PARSER "%push-parser" PERCENT_REQUIRE "%require" PERCENT_SKELETON "%skeleton" PERCENT_START "%start" @@ -245,6 +246,7 @@ | "%output" "=" string_content { spec_outfile = $3; } | "%parse-param {...}" { add_param ("parse_param", $1, @1); } | "%pure-parser" { pure_parser = true; } +| "%push-parser" { push_parser = true; } | "%require" string_content { version_check (&@2, $2); } | "%skeleton" string_content { skeleton = $2; } | "%token-table" { token_table_flag = true; } Index: src/scan-gram.l =================================================================== RCS file: /sources/bison/bison/src/scan-gram.l,v retrieving revision 1.85 diff -u -r1.85 scan-gram.l --- src/scan-gram.l 30 Jan 2006 07:25:59 -0000 1.85 +++ src/scan-gram.l 17 Mar 2006 19:34:12 -0000 @@ -245,6 +245,7 @@ "%prec" rule_length--; return PERCENT_PREC; "%printer" token_type = PERCENT_PRINTER; BEGIN SC_PRE_CODE; "%pure"[-_]"parser" return PERCENT_PURE_PARSER; + "%push"[-_]"parser" return PERCENT_PUSH_PARSER; "%require" return PERCENT_REQUIRE; "%right" return PERCENT_RIGHT; "%skeleton" return PERCENT_SKELETON;