Commit | Line | Data |
d3b6f988 |
1 | *** perly.c.orig Thu Sep 24 00:32:28 1998 |
2 | --- perly.c Thu Sep 24 00:18:13 1998 |
93a17b20 |
3 | *************** |
d3b6f988 |
4 | *** 7,10 **** |
5 | --- 7,27 ---- |
640b9ef6 |
6 | #include "perl.h" |
7 | |
d3b6f988 |
8 | + #define yydebug PL_yydebug |
9 | + #define yynerrs PL_yynerrs |
10 | + #define yyerrflag PL_yyerrflag |
11 | + #define yychar PL_yychar |
12 | + #define yyssp PL_yyssp |
13 | + #define yyvsp PL_yyvsp |
14 | + #define yyval PL_yyval |
15 | + #define yylval PL_yylval |
16 | + |
640b9ef6 |
17 | + #ifdef PERL_OBJECT |
d3b6f988 |
18 | + static void |
640b9ef6 |
19 | + Dep(CPerlObj *pPerl) |
20 | + { |
21 | + pPerl->deprecate("\"do\" to call subroutines"); |
22 | + } |
23 | + #define dep() Dep(this) |
24 | + #else |
d3b6f988 |
25 | static void |
640b9ef6 |
26 | dep(void) |
27 | *************** |
9d116dd7 |
28 | *** 12,86 **** |
640b9ef6 |
29 | deprecate("\"do\" to call subroutines"); |
a0d0e21e |
30 | } |
31 | |
9d116dd7 |
32 | #line 30 "perly.y" |
33 | - #ifndef OEMVS |
34 | - #line 33 "perly.y" |
35 | - typedef union { |
36 | - I32 ival; |
37 | - char *pval; |
38 | - OP *opval; |
39 | - GV *gvval; |
40 | - } YYSTYPE; |
41 | - #line 41 "perly.y" |
42 | - #endif /* OEMVS */ |
43 | - #line 27 "y.tab.c" |
44 | - #define WORD 257 |
45 | - #define METHOD 258 |
46 | - #define FUNCMETH 259 |
47 | - #define THING 260 |
48 | - #define PMFUNC 261 |
49 | - #define PRIVATEREF 262 |
50 | - #define FUNC0SUB 263 |
51 | - #define UNIOPSUB 264 |
52 | - #define LSTOPSUB 265 |
53 | - #define LABEL 266 |
54 | - #define FORMAT 267 |
55 | - #define SUB 268 |
56 | - #define ANONSUB 269 |
57 | - #define PACKAGE 270 |
58 | - #define USE 271 |
59 | - #define WHILE 272 |
60 | - #define UNTIL 273 |
61 | - #define IF 274 |
62 | - #define UNLESS 275 |
63 | - #define ELSE 276 |
64 | - #define ELSIF 277 |
65 | - #define CONTINUE 278 |
66 | - #define FOR 279 |
67 | - #define LOOPEX 280 |
68 | - #define DOTDOT 281 |
69 | - #define FUNC0 282 |
70 | - #define FUNC1 283 |
71 | - #define FUNC 284 |
72 | - #define UNIOP 285 |
73 | - #define LSTOP 286 |
74 | - #define RELOP 287 |
75 | - #define EQOP 288 |
76 | - #define MULOP 289 |
77 | - #define ADDOP 290 |
78 | - #define DOLSHARP 291 |
79 | - #define DO 292 |
80 | - #define HASHBRACK 293 |
81 | - #define NOAMP 294 |
82 | - #define LOCAL 295 |
83 | - #define MY 296 |
84 | - #define OROP 297 |
85 | - #define ANDOP 298 |
86 | - #define NOTOP 299 |
87 | - #define ASSIGNOP 300 |
88 | - #define OROR 301 |
89 | - #define ANDAND 302 |
90 | - #define BITOROP 303 |
91 | - #define BITANDOP 304 |
92 | - #define SHIFTOP 305 |
93 | - #define MATCHOP 306 |
94 | - #define UMINUS 307 |
95 | - #define REFGEN 308 |
96 | - #define POWOP 309 |
97 | - #define PREINC 310 |
98 | - #define PREDEC 311 |
99 | - #define POSTINC 312 |
100 | - #define POSTDEC 313 |
101 | - #define ARROW 314 |
36477c24 |
102 | #define YYERRCODE 256 |
103 | short yylhs[] = { -1, |
d3b6f988 |
104 | --- 29,35 ---- |
640b9ef6 |
105 | deprecate("\"do\" to call subroutines"); |
36477c24 |
106 | } |
640b9ef6 |
107 | + #endif |
36477c24 |
108 | |
9d116dd7 |
109 | #line 30 "perly.y" |
a0d0e21e |
110 | #define YYERRCODE 256 |
111 | short yylhs[] = { -1, |
a0d0e21e |
112 | *************** |
d3b6f988 |
113 | *** 1337,1365 **** |
114 | #endif |
115 | #endif |
116 | - int yydebug; |
117 | - int yynerrs; |
118 | - int yyerrflag; |
119 | - int yychar; |
120 | - short *yyssp; |
121 | - YYSTYPE *yyvsp; |
122 | - YYSTYPE yyval; |
123 | - YYSTYPE yylval; |
93a17b20 |
124 | - short yyss[YYSTACKSIZE]; |
125 | - YYSTYPE yyvs[YYSTACKSIZE]; |
126 | - #define yystacksize YYSTACKSIZE |
9d116dd7 |
127 | #line 643 "perly.y" |
93a17b20 |
128 | /* PROGRAM */ |
9d116dd7 |
129 | ! #line 1353 "y.tab.c" |
640b9ef6 |
130 | #define YYABORT goto yyabort |
0da4822f |
131 | #define YYACCEPT goto yyaccept |
132 | #define YYERROR goto yyerrlab |
133 | int |
134 | ! yyparse() |
135 | { |
136 | register int yym, yyn, yystate; |
137 | #if YYDEBUG |
138 | register char *yys; |
139 | extern char *getenv(); |
140 | |
141 | if (yys = getenv("YYDEBUG")) |
142 | { |
d3b6f988 |
143 | --- 1286,1350 ---- |
144 | #endif |
145 | #endif |
9d116dd7 |
146 | #line 643 "perly.y" |
640b9ef6 |
147 | /* PROGRAM */ |
9d116dd7 |
148 | ! #line 1353 "perly.c" |
640b9ef6 |
149 | #define YYABORT goto yyabort |
a0d0e21e |
150 | #define YYACCEPT goto yyaccept |
151 | #define YYERROR goto yyerrlab |
152 | + |
153 | + struct ysv { |
154 | + short* yyss; |
155 | + YYSTYPE* yyvs; |
156 | + int oldyydebug; |
157 | + int oldyynerrs; |
158 | + int oldyyerrflag; |
159 | + int oldyychar; |
160 | + YYSTYPE oldyyval; |
161 | + YYSTYPE oldyylval; |
162 | + }; |
163 | + |
164 | + void |
0da4822f |
165 | + yydestruct(void *ptr) |
a0d0e21e |
166 | + { |
167 | + struct ysv* ysave = (struct ysv*)ptr; |
489bbe73 |
168 | + if (ysave->yyss) Safefree(ysave->yyss); |
169 | + if (ysave->yyvs) Safefree(ysave->yyvs); |
a0d0e21e |
170 | + yydebug = ysave->oldyydebug; |
171 | + yynerrs = ysave->oldyynerrs; |
172 | + yyerrflag = ysave->oldyyerrflag; |
173 | + yychar = ysave->oldyychar; |
174 | + yyval = ysave->oldyyval; |
175 | + yylval = ysave->oldyylval; |
489bbe73 |
176 | + Safefree(ysave); |
a0d0e21e |
177 | + } |
178 | + |
179 | int |
0da4822f |
180 | ! yyparse(void) |
93a17b20 |
181 | { |
182 | register int yym, yyn, yystate; |
183 | + register short *yyssp; |
184 | + register YYSTYPE *yyvsp; |
185 | + short* yyss; |
186 | + YYSTYPE* yyvs; |
187 | + unsigned yystacksize = YYSTACKSIZE; |
93a17b20 |
188 | + int retval = 0; |
93a17b20 |
189 | #if YYDEBUG |
190 | register char *yys; |
0da4822f |
191 | + #ifndef __cplusplus |
93a17b20 |
192 | extern char *getenv(); |
a0d0e21e |
193 | + #endif |
0da4822f |
194 | + #endif |
d3b6f988 |
195 | + |
8c52afec |
196 | + struct ysv *ysave; |
197 | + New(73, ysave, 1, struct ysv); |
a0d0e21e |
198 | + SAVEDESTRUCTOR(yydestruct, ysave); |
199 | + ysave->oldyydebug = yydebug; |
200 | + ysave->oldyynerrs = yynerrs; |
201 | + ysave->oldyyerrflag = yyerrflag; |
202 | + ysave->oldyychar = yychar; |
203 | + ysave->oldyyval = yyval; |
204 | + ysave->oldyylval = yylval; |
d3b6f988 |
205 | |
a0d0e21e |
206 | + #if YYDEBUG |
207 | if (yys = getenv("YYDEBUG")) |
208 | { |
93a17b20 |
209 | *************** |
9d116dd7 |
210 | *** 1374,1377 **** |
d3b6f988 |
211 | --- 1359,1372 ---- |
93a17b20 |
212 | yychar = (-1); |
213 | |
214 | + /* |
215 | + ** Initialize private stacks (yyparse may be called from an action) |
216 | + */ |
8c52afec |
217 | + New(73, yyss, yystacksize, short); |
218 | + New(73, yyvs, yystacksize, YYSTYPE); |
219 | + ysave->yyss = yyss; |
220 | + ysave->yyvs = yyvs; |
93a17b20 |
221 | + if (!yyvs || !yyss) |
222 | + goto yyoverflow; |
223 | + |
224 | yyssp = yyss; |
225 | yyvsp = yyvs; |
93a17b20 |
226 | *************** |
9d116dd7 |
227 | *** 1389,1393 **** |
ed6116ce |
228 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
229 | if (!yys) yys = "illegal-symbol"; |
230 | ! printf("yydebug: state %d, reading %d (%s)\n", yystate, |
231 | yychar, yys); |
232 | } |
d3b6f988 |
233 | --- 1384,1388 ---- |
ed6116ce |
234 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
235 | if (!yys) yys = "illegal-symbol"; |
ac4c12e7 |
236 | ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", yystate, |
ed6116ce |
237 | yychar, yys); |
238 | } |
ed6116ce |
239 | *************** |
d3b6f988 |
240 | *** 1399,1408 **** |
ed6116ce |
241 | #if YYDEBUG |
242 | if (yydebug) |
243 | ! printf("yydebug: state %d, shifting to state %d\n", |
244 | yystate, yytable[yyn]); |
93a17b20 |
245 | #endif |
9d116dd7 |
246 | if (yyssp >= yyss + yystacksize - 1) |
247 | { |
248 | ! goto yyoverflow; |
249 | } |
250 | *++yyssp = yystate = yytable[yyn]; |
d3b6f988 |
251 | --- 1394,1417 ---- |
252 | #if YYDEBUG |
253 | if (yydebug) |
254 | ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, shifting to state %d\n", |
255 | yystate, yytable[yyn]); |
256 | #endif |
93a17b20 |
257 | if (yyssp >= yyss + yystacksize - 1) |
258 | { |
259 | ! /* |
260 | ! ** reallocate and recover. Note that pointers |
261 | ! ** have to be reset, or bad things will happen |
262 | ! */ |
263 | ! int yyps_index = (yyssp - yyss); |
264 | ! int yypv_index = (yyvsp - yyvs); |
265 | ! yystacksize += YYSTACKSIZE; |
a0d0e21e |
266 | ! ysave->yyvs = yyvs = |
d3b6f988 |
267 | ! (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); |
a0d0e21e |
268 | ! ysave->yyss = yyss = |
d3b6f988 |
269 | ! (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short)); |
93a17b20 |
270 | ! if (!yyvs || !yyss) |
271 | ! goto yyoverflow; |
272 | ! yyssp = yyss + yyps_index; |
273 | ! yyvsp = yyvs + yypv_index; |
274 | } |
275 | *++yyssp = yystate = yytable[yyn]; |
93a17b20 |
276 | *************** |
9d116dd7 |
277 | *** 1440,1449 **** |
ed6116ce |
278 | #if YYDEBUG |
279 | if (yydebug) |
280 | ! printf("yydebug: state %d, error recovery shifting\ |
281 | ! to state %d\n", *yyssp, yytable[yyn]); |
93a17b20 |
282 | #endif |
283 | if (yyssp >= yyss + yystacksize - 1) |
284 | { |
285 | ! goto yyoverflow; |
286 | } |
287 | *++yyssp = yystate = yytable[yyn]; |
d3b6f988 |
288 | --- 1449,1473 ---- |
ed6116ce |
289 | #if YYDEBUG |
290 | if (yydebug) |
ac4c12e7 |
291 | ! PerlIO_printf(Perl_debug_log, |
ed6116ce |
292 | ! "yydebug: state %d, error recovery shifting to state %d\n", |
293 | ! *yyssp, yytable[yyn]); |
93a17b20 |
294 | #endif |
295 | if (yyssp >= yyss + yystacksize - 1) |
296 | { |
297 | ! /* |
298 | ! ** reallocate and recover. Note that pointers |
299 | ! ** have to be reset, or bad things will happen |
300 | ! */ |
301 | ! int yyps_index = (yyssp - yyss); |
302 | ! int yypv_index = (yyvsp - yyvs); |
303 | ! yystacksize += YYSTACKSIZE; |
d3b6f988 |
304 | ! ysave->yyvs = yyvs = (YYSTYPE*)PerlMem_realloc((char*)yyvs, |
93a17b20 |
305 | ! yystacksize * sizeof(YYSTYPE)); |
d3b6f988 |
306 | ! ysave->yyss = yyss = (short*)PerlMem_realloc((char*)yyss, |
93a17b20 |
307 | ! yystacksize * sizeof(short)); |
308 | ! if (!yyvs || !yyss) |
309 | ! goto yyoverflow; |
310 | ! yyssp = yyss + yyps_index; |
311 | ! yyvsp = yyvs + yypv_index; |
312 | } |
313 | *++yyssp = yystate = yytable[yyn]; |
93a17b20 |
314 | *************** |
9d116dd7 |
315 | *** 1455,1460 **** |
ed6116ce |
316 | #if YYDEBUG |
317 | if (yydebug) |
318 | ! printf("yydebug: error recovery discarding state %d\n", |
319 | ! *yyssp); |
320 | #endif |
321 | if (yyssp <= yyss) goto yyabort; |
d3b6f988 |
322 | --- 1479,1485 ---- |
ed6116ce |
323 | #if YYDEBUG |
324 | if (yydebug) |
ac4c12e7 |
325 | ! PerlIO_printf(Perl_debug_log, |
ed6116ce |
326 | ! "yydebug: error recovery discarding state %d\n", |
327 | ! *yyssp); |
328 | #endif |
329 | if (yyssp <= yyss) goto yyabort; |
ed6116ce |
330 | *************** |
9d116dd7 |
331 | *** 1473,1478 **** |
ed6116ce |
332 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
333 | if (!yys) yys = "illegal-symbol"; |
334 | ! printf("yydebug: state %d, error recovery discards token %d (%s)\n", |
335 | ! yystate, yychar, yys); |
336 | } |
337 | #endif |
d3b6f988 |
338 | --- 1498,1504 ---- |
ed6116ce |
339 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
340 | if (!yys) yys = "illegal-symbol"; |
ac4c12e7 |
341 | ! PerlIO_printf(Perl_debug_log, |
ed6116ce |
342 | ! "yydebug: state %d, error recovery discards token %d (%s)\n", |
343 | ! yystate, yychar, yys); |
344 | } |
345 | #endif |
ed6116ce |
346 | *************** |
9d116dd7 |
347 | *** 1483,1487 **** |
ed6116ce |
348 | #if YYDEBUG |
349 | if (yydebug) |
350 | ! printf("yydebug: state %d, reducing by rule %d (%s)\n", |
351 | yystate, yyn, yyrule[yyn]); |
352 | #endif |
d3b6f988 |
353 | --- 1509,1513 ---- |
ed6116ce |
354 | #if YYDEBUG |
355 | if (yydebug) |
ac4c12e7 |
356 | ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reducing by rule %d (%s)\n", |
ed6116ce |
357 | yystate, yyn, yyrule[yyn]); |
358 | #endif |
ed6116ce |
359 | *************** |
9d116dd7 |
360 | *** 2267,2271 **** |
640b9ef6 |
361 | { yyval.opval = yyvsp[0].opval; } |
362 | break; |
9d116dd7 |
363 | ! #line 2270 "y.tab.c" |
640b9ef6 |
364 | } |
365 | yyssp -= yym; |
d3b6f988 |
366 | --- 2293,2297 ---- |
640b9ef6 |
367 | { yyval.opval = yyvsp[0].opval; } |
368 | break; |
9d116dd7 |
369 | ! #line 2270 "perly.c" |
640b9ef6 |
370 | } |
371 | yyssp -= yym; |
372 | *************** |
9d116dd7 |
373 | *** 2277,2282 **** |
ed6116ce |
374 | #if YYDEBUG |
375 | if (yydebug) |
376 | ! printf("yydebug: after reduction, shifting from state 0 to\ |
377 | ! state %d\n", YYFINAL); |
378 | #endif |
379 | yystate = YYFINAL; |
d3b6f988 |
380 | --- 2303,2309 ---- |
ed6116ce |
381 | #if YYDEBUG |
382 | if (yydebug) |
ac4c12e7 |
383 | ! PerlIO_printf(Perl_debug_log, |
ed6116ce |
384 | ! "yydebug: after reduction, shifting from state 0 to state %d\n", |
385 | ! YYFINAL); |
386 | #endif |
387 | yystate = YYFINAL; |
ed6116ce |
388 | *************** |
9d116dd7 |
389 | *** 2292,2296 **** |
ed6116ce |
390 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
391 | if (!yys) yys = "illegal-symbol"; |
392 | ! printf("yydebug: state %d, reading %d (%s)\n", |
393 | YYFINAL, yychar, yys); |
394 | } |
d3b6f988 |
395 | --- 2319,2323 ---- |
ed6116ce |
396 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
397 | if (!yys) yys = "illegal-symbol"; |
ac4c12e7 |
398 | ! PerlIO_printf(Perl_debug_log, "yydebug: state %d, reading %d (%s)\n", |
ed6116ce |
399 | YYFINAL, yychar, yys); |
400 | } |
ed6116ce |
401 | *************** |
9d116dd7 |
402 | *** 2307,2316 **** |
ed6116ce |
403 | #if YYDEBUG |
404 | if (yydebug) |
405 | ! printf("yydebug: after reduction, shifting from state %d \ |
406 | ! to state %d\n", *yyssp, yystate); |
93a17b20 |
407 | #endif |
408 | if (yyssp >= yyss + yystacksize - 1) |
409 | { |
410 | ! goto yyoverflow; |
411 | } |
412 | *++yyssp = yystate; |
d3b6f988 |
413 | --- 2334,2358 ---- |
ed6116ce |
414 | #if YYDEBUG |
415 | if (yydebug) |
ac4c12e7 |
416 | ! PerlIO_printf(Perl_debug_log, |
ed6116ce |
417 | ! "yydebug: after reduction, shifting from state %d to state %d\n", |
418 | ! *yyssp, yystate); |
93a17b20 |
419 | #endif |
420 | if (yyssp >= yyss + yystacksize - 1) |
421 | { |
422 | ! /* |
423 | ! ** reallocate and recover. Note that pointers |
424 | ! ** have to be reset, or bad things will happen |
425 | ! */ |
426 | ! int yyps_index = (yyssp - yyss); |
427 | ! int yypv_index = (yyvsp - yyvs); |
428 | ! yystacksize += YYSTACKSIZE; |
a0d0e21e |
429 | ! ysave->yyvs = yyvs = |
d3b6f988 |
430 | ! (YYSTYPE*)PerlMem_realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); |
a0d0e21e |
431 | ! ysave->yyss = yyss = |
d3b6f988 |
432 | ! (short*)PerlMem_realloc((char*)yyss,yystacksize * sizeof(short)); |
93a17b20 |
433 | ! if (!yyvs || !yyss) |
434 | ! goto yyoverflow; |
435 | ! yyssp = yyss + yyps_index; |
436 | ! yyvsp = yyvs + yypv_index; |
437 | } |
438 | *++yyssp = yystate; |
bbce6d69 |
439 | *************** |
9d116dd7 |
440 | *** 2318,2325 **** |
bbce6d69 |
441 | goto yyloop; |
442 | yyoverflow: |
443 | ! yyerror("yacc stack overflow"); |
444 | yyabort: |
445 | ! return (1); |
446 | yyaccept: |
447 | ! return (0); |
448 | } |
d3b6f988 |
449 | --- 2360,2367 ---- |
93a17b20 |
450 | goto yyloop; |
451 | yyoverflow: |
452 | ! yyerror("Out of memory for yacc stack"); |
453 | yyabort: |
454 | ! retval = 1; |
455 | yyaccept: |
93a17b20 |
456 | ! return retval; |
457 | } |