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