This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.0 alpha 5
[perl5.git] / perly.c.diff
CommitLineData
ed6116ce
LW
1*** perly.c.orig Fri Jan 14 03:56:26 1994
2--- perly.c Sun Jan 16 18:29:19 1994
93a17b20 3***************
ed6116ce 4*** 1635,1647 ****
93a17b20
LW
5 int yynerrs;
6 int yyerrflag;
7 int yychar;
8- short *yyssp;
9- YYSTYPE *yyvsp;
10 YYSTYPE yyval;
11 YYSTYPE yylval;
12- short yyss[YYSTACKSIZE];
13- YYSTYPE yyvs[YYSTACKSIZE];
14- #define yystacksize YYSTACKSIZE
ed6116ce 15 #line 605 "perly.y"
93a17b20 16 /* PROGRAM */
ed6116ce
LW
17 #line 1648 "y.tab.c"
18--- 1635,1642 ----
93a17b20 19***************
ed6116ce
LW
20*** 1652,1657 ****
21--- 1647,1665 ----
93a17b20
LW
22 yyparse()
23 {
24 register int yym, yyn, yystate;
25+ register short *yyssp;
26+ register YYSTYPE *yyvsp;
27+ short* yyss;
28+ YYSTYPE* yyvs;
29+ unsigned yystacksize = YYSTACKSIZE;
30+ int oldyydebug = yydebug;
31+ int oldyynerrs = yynerrs;
32+ int oldyyerrflag = yyerrflag;
33+ int oldyychar = yychar;
34+ YYSTYPE oldyyval = yyval;
35+ YYSTYPE oldyylval = yylval;
36+ int retval = 0;
37+
38 #if YYDEBUG
39 register char *yys;
40 extern char *getenv();
41***************
ed6116ce
LW
42*** 1668,1673 ****
43--- 1676,1689 ----
93a17b20
LW
44 yyerrflag = 0;
45 yychar = (-1);
46
47+ /*
48+ ** Initialize private stacks (yyparse may be called from an action)
49+ */
50+ yyss = (short*)malloc(yystacksize*sizeof(short));
51+ yyvs = (YYSTYPE*)malloc(yystacksize*sizeof(YYSTYPE));
52+ if (!yyvs || !yyss)
53+ goto yyoverflow;
54+
55 yyssp = yyss;
56 yyvsp = yyvs;
57 *yyssp = yystate = 0;
58***************
ed6116ce
LW
59*** 1683,1689 ****
60 yys = 0;
61 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
62 if (!yys) yys = "illegal-symbol";
63! printf("yydebug: state %d, reading %d (%s)\n", yystate,
64 yychar, yys);
65 }
66 #endif
67--- 1699,1705 ----
68 yys = 0;
69 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
70 if (!yys) yys = "illegal-symbol";
71! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate,
72 yychar, yys);
73 }
74 #endif
75***************
76*** 1693,1704 ****
77 {
78 #if YYDEBUG
79 if (yydebug)
80! printf("yydebug: state %d, shifting to state %d\n",
81 yystate, yytable[yyn]);
93a17b20
LW
82 #endif
83 if (yyssp >= yyss + yystacksize - 1)
84 {
85! goto yyoverflow;
86 }
87 *++yyssp = yystate = yytable[yyn];
88 *++yyvsp = yylval;
ed6116ce
LW
89--- 1709,1732 ----
90 {
91 #if YYDEBUG
92 if (yydebug)
93! fprintf(stderr, "yydebug: state %d, shifting to state %d\n",
94 yystate, yytable[yyn]);
93a17b20
LW
95 #endif
96 if (yyssp >= yyss + yystacksize - 1)
97 {
98! /*
99! ** reallocate and recover. Note that pointers
100! ** have to be reset, or bad things will happen
101! */
102! int yyps_index = (yyssp - yyss);
103! int yypv_index = (yyvsp - yyvs);
104! yystacksize += YYSTACKSIZE;
105! yyvs = (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
106! yyss = (short*)realloc((char*)yyss,yystacksize * sizeof(short));
107! if (!yyvs || !yyss)
108! goto yyoverflow;
109! yyssp = yyss + yyps_index;
110! yyvsp = yyvs + yypv_index;
111 }
112 *++yyssp = yystate = yytable[yyn];
113 *++yyvsp = yylval;
114***************
ed6116ce
LW
115*** 1734,1745 ****
116 {
117 #if YYDEBUG
118 if (yydebug)
119! printf("yydebug: state %d, error recovery shifting\
120! to state %d\n", *yyssp, yytable[yyn]);
93a17b20
LW
121 #endif
122 if (yyssp >= yyss + yystacksize - 1)
123 {
124! goto yyoverflow;
125 }
126 *++yyssp = yystate = yytable[yyn];
127 *++yyvsp = yylval;
ed6116ce
LW
128--- 1762,1788 ----
129 {
130 #if YYDEBUG
131 if (yydebug)
132! fprintf(stderr,
133! "yydebug: state %d, error recovery shifting to state %d\n",
134! *yyssp, yytable[yyn]);
93a17b20
LW
135 #endif
136 if (yyssp >= yyss + yystacksize - 1)
137 {
138! /*
139! ** reallocate and recover. Note that pointers
140! ** have to be reset, or bad things will happen
141! */
142! int yyps_index = (yyssp - yyss);
143! int yypv_index = (yyvsp - yyvs);
144! yystacksize += YYSTACKSIZE;
145! yyvs = (YYSTYPE*)realloc((char*)yyvs,
146! yystacksize * sizeof(YYSTYPE));
147! yyss = (short*)realloc((char*)yyss,
148! yystacksize * sizeof(short));
149! if (!yyvs || !yyss)
150! goto yyoverflow;
151! yyssp = yyss + yyps_index;
152! yyvsp = yyvs + yypv_index;
153 }
154 *++yyssp = yystate = yytable[yyn];
155 *++yyvsp = yylval;
156***************
ed6116ce
LW
157*** 1749,1756 ****
158 {
159 #if YYDEBUG
160 if (yydebug)
161! printf("yydebug: error recovery discarding state %d\n",
162! *yyssp);
163 #endif
164 if (yyssp <= yyss) goto yyabort;
165 --yyssp;
166--- 1792,1800 ----
167 {
168 #if YYDEBUG
169 if (yydebug)
170! fprintf(stderr,
171! "yydebug: error recovery discarding state %d\n",
172! *yyssp);
173 #endif
174 if (yyssp <= yyss) goto yyabort;
175 --yyssp;
176***************
177*** 1767,1774 ****
178 yys = 0;
179 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
180 if (!yys) yys = "illegal-symbol";
181! printf("yydebug: state %d, error recovery discards token %d (%s)\n",
182! yystate, yychar, yys);
183 }
184 #endif
185 yychar = (-1);
186--- 1811,1819 ----
187 yys = 0;
188 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
189 if (!yys) yys = "illegal-symbol";
190! fprintf(stderr,
191! "yydebug: state %d, error recovery discards token %d (%s)\n",
192! yystate, yychar, yys);
193 }
194 #endif
195 yychar = (-1);
196***************
197*** 1777,1783 ****
198 yyreduce:
199 #if YYDEBUG
200 if (yydebug)
201! printf("yydebug: state %d, reducing by rule %d (%s)\n",
202 yystate, yyn, yyrule[yyn]);
203 #endif
204 yym = yylen[yyn];
205--- 1822,1828 ----
206 yyreduce:
207 #if YYDEBUG
208 if (yydebug)
209! fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n",
210 yystate, yyn, yyrule[yyn]);
211 #endif
212 yym = yylen[yyn];
213***************
214*** 2529,2536 ****
215 {
216 #if YYDEBUG
217 if (yydebug)
218! printf("yydebug: after reduction, shifting from state 0 to\
219! state %d\n", YYFINAL);
220 #endif
221 yystate = YYFINAL;
222 *++yyssp = YYFINAL;
223--- 2574,2582 ----
224 {
225 #if YYDEBUG
226 if (yydebug)
227! fprintf(stderr,
228! "yydebug: after reduction, shifting from state 0 to state %d\n",
229! YYFINAL);
230 #endif
231 yystate = YYFINAL;
232 *++yyssp = YYFINAL;
233***************
234*** 2544,2550 ****
235 yys = 0;
236 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
237 if (!yys) yys = "illegal-symbol";
238! printf("yydebug: state %d, reading %d (%s)\n",
239 YYFINAL, yychar, yys);
240 }
241 #endif
242--- 2590,2596 ----
243 yys = 0;
244 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
245 if (!yys) yys = "illegal-symbol";
246! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n",
247 YYFINAL, yychar, yys);
248 }
249 #endif
250***************
251*** 2559,2578 ****
252 yystate = yydgoto[yym];
253 #if YYDEBUG
254 if (yydebug)
255! printf("yydebug: after reduction, shifting from state %d \
256! to state %d\n", *yyssp, yystate);
93a17b20
LW
257 #endif
258 if (yyssp >= yyss + yystacksize - 1)
259 {
260! goto yyoverflow;
261 }
262 *++yyssp = yystate;
263 *++yyvsp = yyval;
264 goto yyloop;
265 yyoverflow:
266! yyerror("yacc stack overflow");
267 yyabort:
268! return (1);
269 yyaccept:
270! return (0);
271 }
ed6116ce
LW
272--- 2605,2645 ----
273 yystate = yydgoto[yym];
274 #if YYDEBUG
275 if (yydebug)
276! fprintf(stderr,
277! "yydebug: after reduction, shifting from state %d to state %d\n",
278! *yyssp, yystate);
93a17b20
LW
279 #endif
280 if (yyssp >= yyss + yystacksize - 1)
281 {
282! /*
283! ** reallocate and recover. Note that pointers
284! ** have to be reset, or bad things will happen
285! */
286! int yyps_index = (yyssp - yyss);
287! int yypv_index = (yyvsp - yyvs);
288! yystacksize += YYSTACKSIZE;
289! yyvs = (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE));
290! yyss = (short*)realloc((char*)yyss,yystacksize * sizeof(short));
291! if (!yyvs || !yyss)
292! goto yyoverflow;
293! yyssp = yyss + yyps_index;
294! yyvsp = yyvs + yypv_index;
295 }
296 *++yyssp = yystate;
297 *++yyvsp = yyval;
298 goto yyloop;
299 yyoverflow:
300! yyerror("Out of memory for yacc stack");
301 yyabort:
302! retval = 1;
303 yyaccept:
304! if (yyss) free(yyss);
305! if (yyvs) free(yyvs);
306! yydebug = oldyydebug;
307! yynerrs = oldyynerrs;
308! yyerrflag = oldyyerrflag;
309! yychar = oldyychar;
310! yyval = oldyyval;
311! yylval = oldyylval;
312! return retval;
313 }