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