Commit | Line | Data |
5f05dabc |
1 | Index: perly.c |
ecca16b0 |
2 | *** perly.c.orig Sun Mar 1 21:44:24 1998 |
3 | --- perly.c Sun Mar 1 21:46:32 1998 |
93a17b20 |
4 | *************** |
bbce6d69 |
5 | *** 13,82 **** |
a0d0e21e |
6 | } |
7 | |
36477c24 |
8 | ! #line 29 "perly.y" |
9 | ! typedef union { |
10 | ! I32 ival; |
11 | ! char *pval; |
12 | ! OP *opval; |
13 | ! GV *gvval; |
14 | ! } YYSTYPE; |
15 | ! #line 23 "y.tab.c" |
16 | ! #define WORD 257 |
17 | ! #define METHOD 258 |
18 | ! #define FUNCMETH 259 |
19 | ! #define THING 260 |
20 | ! #define PMFUNC 261 |
21 | ! #define PRIVATEREF 262 |
22 | ! #define FUNC0SUB 263 |
23 | ! #define UNIOPSUB 264 |
24 | ! #define LSTOPSUB 265 |
25 | ! #define LABEL 266 |
26 | ! #define FORMAT 267 |
27 | ! #define SUB 268 |
28 | ! #define ANONSUB 269 |
29 | ! #define PACKAGE 270 |
30 | ! #define USE 271 |
31 | ! #define WHILE 272 |
32 | ! #define UNTIL 273 |
33 | ! #define IF 274 |
34 | ! #define UNLESS 275 |
35 | ! #define ELSE 276 |
36 | ! #define ELSIF 277 |
37 | ! #define CONTINUE 278 |
38 | ! #define FOR 279 |
39 | ! #define LOOPEX 280 |
40 | ! #define DOTDOT 281 |
41 | ! #define FUNC0 282 |
42 | ! #define FUNC1 283 |
43 | ! #define FUNC 284 |
44 | ! #define UNIOP 285 |
45 | ! #define LSTOP 286 |
46 | ! #define RELOP 287 |
47 | ! #define EQOP 288 |
48 | ! #define MULOP 289 |
49 | ! #define ADDOP 290 |
50 | ! #define DOLSHARP 291 |
51 | ! #define DO 292 |
52 | ! #define HASHBRACK 293 |
53 | ! #define NOAMP 294 |
54 | ! #define LOCAL 295 |
55 | ! #define MY 296 |
56 | ! #define OROP 297 |
57 | ! #define ANDOP 298 |
58 | ! #define NOTOP 299 |
59 | ! #define ASSIGNOP 300 |
60 | ! #define OROR 301 |
61 | ! #define ANDAND 302 |
62 | ! #define BITOROP 303 |
63 | ! #define BITANDOP 304 |
64 | ! #define SHIFTOP 305 |
65 | ! #define MATCHOP 306 |
66 | ! #define UMINUS 307 |
67 | ! #define REFGEN 308 |
68 | ! #define POWOP 309 |
69 | ! #define PREINC 310 |
70 | ! #define PREDEC 311 |
71 | ! #define POSTINC 312 |
72 | ! #define POSTDEC 313 |
73 | ! #define ARROW 314 |
74 | #define YYERRCODE 256 |
75 | short yylhs[] = { -1, |
76 | --- 13,17 ---- |
77 | } |
78 | |
79 | ! #line 16 "perly.c" |
a0d0e21e |
80 | #define YYERRCODE 256 |
81 | short yylhs[] = { -1, |
a0d0e21e |
82 | *************** |
ecca16b0 |
83 | *** 1337,1347 **** |
93a17b20 |
84 | int yyerrflag; |
85 | int yychar; |
86 | - short *yyssp; |
87 | - YYSTYPE *yyvsp; |
88 | YYSTYPE yyval; |
89 | YYSTYPE yylval; |
90 | - short yyss[YYSTACKSIZE]; |
91 | - YYSTYPE yyvs[YYSTACKSIZE]; |
92 | - #define yystacksize YYSTACKSIZE |
ecca16b0 |
93 | #line 636 "perly.y" |
93a17b20 |
94 | /* PROGRAM */ |
ecca16b0 |
95 | --- 1272,1277 ---- |
bbce6d69 |
96 | *************** |
ecca16b0 |
97 | *** 1350,1361 **** |
0da4822f |
98 | #define YYACCEPT goto yyaccept |
99 | #define YYERROR goto yyerrlab |
100 | int |
101 | ! yyparse() |
102 | { |
103 | register int yym, yyn, yystate; |
104 | #if YYDEBUG |
105 | register char *yys; |
106 | extern char *getenv(); |
107 | |
108 | if (yys = getenv("YYDEBUG")) |
109 | { |
ecca16b0 |
110 | --- 1280,1338 ---- |
a0d0e21e |
111 | #define YYACCEPT goto yyaccept |
112 | #define YYERROR goto yyerrlab |
113 | + |
114 | + struct ysv { |
115 | + short* yyss; |
116 | + YYSTYPE* yyvs; |
117 | + int oldyydebug; |
118 | + int oldyynerrs; |
119 | + int oldyyerrflag; |
120 | + int oldyychar; |
121 | + YYSTYPE oldyyval; |
122 | + YYSTYPE oldyylval; |
123 | + }; |
124 | + |
125 | + void |
0da4822f |
126 | + yydestruct(void *ptr) |
a0d0e21e |
127 | + { |
128 | + struct ysv* ysave = (struct ysv*)ptr; |
489bbe73 |
129 | + if (ysave->yyss) Safefree(ysave->yyss); |
130 | + if (ysave->yyvs) Safefree(ysave->yyvs); |
a0d0e21e |
131 | + yydebug = ysave->oldyydebug; |
132 | + yynerrs = ysave->oldyynerrs; |
133 | + yyerrflag = ysave->oldyyerrflag; |
134 | + yychar = ysave->oldyychar; |
135 | + yyval = ysave->oldyyval; |
136 | + yylval = ysave->oldyylval; |
489bbe73 |
137 | + Safefree(ysave); |
a0d0e21e |
138 | + } |
139 | + |
140 | int |
0da4822f |
141 | ! yyparse(void) |
93a17b20 |
142 | { |
143 | register int yym, yyn, yystate; |
144 | + register short *yyssp; |
145 | + register YYSTYPE *yyvsp; |
146 | + short* yyss; |
147 | + YYSTYPE* yyvs; |
148 | + unsigned yystacksize = YYSTACKSIZE; |
93a17b20 |
149 | + int retval = 0; |
93a17b20 |
150 | #if YYDEBUG |
151 | register char *yys; |
0da4822f |
152 | + #ifndef __cplusplus |
93a17b20 |
153 | extern char *getenv(); |
a0d0e21e |
154 | + #endif |
0da4822f |
155 | + #endif |
55497cff |
156 | + |
8c52afec |
157 | + struct ysv *ysave; |
158 | + New(73, ysave, 1, struct ysv); |
a0d0e21e |
159 | + SAVEDESTRUCTOR(yydestruct, ysave); |
160 | + ysave->oldyydebug = yydebug; |
161 | + ysave->oldyynerrs = yynerrs; |
162 | + ysave->oldyyerrflag = yyerrflag; |
163 | + ysave->oldyychar = yychar; |
164 | + ysave->oldyyval = yyval; |
165 | + ysave->oldyylval = yylval; |
55497cff |
166 | |
a0d0e21e |
167 | + #if YYDEBUG |
168 | if (yys = getenv("YYDEBUG")) |
169 | { |
93a17b20 |
170 | *************** |
ecca16b0 |
171 | *** 1370,1373 **** |
172 | --- 1347,1360 ---- |
93a17b20 |
173 | yychar = (-1); |
174 | |
175 | + /* |
176 | + ** Initialize private stacks (yyparse may be called from an action) |
177 | + */ |
8c52afec |
178 | + New(73, yyss, yystacksize, short); |
179 | + New(73, yyvs, yystacksize, YYSTYPE); |
180 | + ysave->yyss = yyss; |
181 | + ysave->yyvs = yyvs; |
93a17b20 |
182 | + if (!yyvs || !yyss) |
183 | + goto yyoverflow; |
184 | + |
185 | yyssp = yyss; |
186 | yyvsp = yyvs; |
93a17b20 |
187 | *************** |
ecca16b0 |
188 | *** 1385,1389 **** |
ed6116ce |
189 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
190 | if (!yys) yys = "illegal-symbol"; |
191 | ! printf("yydebug: state %d, reading %d (%s)\n", yystate, |
192 | yychar, yys); |
193 | } |
ecca16b0 |
194 | --- 1372,1376 ---- |
ed6116ce |
195 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
196 | if (!yys) yys = "illegal-symbol"; |
197 | ! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", yystate, |
198 | yychar, yys); |
199 | } |
ed6116ce |
200 | *************** |
ecca16b0 |
201 | *** 1395,1404 **** |
ed6116ce |
202 | #if YYDEBUG |
203 | if (yydebug) |
204 | ! printf("yydebug: state %d, shifting to state %d\n", |
205 | yystate, yytable[yyn]); |
93a17b20 |
206 | #endif |
207 | if (yyssp >= yyss + yystacksize - 1) |
208 | { |
209 | ! goto yyoverflow; |
210 | } |
211 | *++yyssp = yystate = yytable[yyn]; |
ecca16b0 |
212 | --- 1382,1405 ---- |
ed6116ce |
213 | #if YYDEBUG |
214 | if (yydebug) |
215 | ! fprintf(stderr, "yydebug: state %d, shifting to state %d\n", |
216 | yystate, yytable[yyn]); |
93a17b20 |
217 | #endif |
218 | if (yyssp >= yyss + yystacksize - 1) |
219 | { |
220 | ! /* |
221 | ! ** reallocate and recover. Note that pointers |
222 | ! ** have to be reset, or bad things will happen |
223 | ! */ |
224 | ! int yyps_index = (yyssp - yyss); |
225 | ! int yypv_index = (yyvsp - yyvs); |
226 | ! yystacksize += YYSTACKSIZE; |
a0d0e21e |
227 | ! ysave->yyvs = yyvs = |
228 | ! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); |
229 | ! ysave->yyss = yyss = |
230 | ! (short*)realloc((char*)yyss,yystacksize * sizeof(short)); |
93a17b20 |
231 | ! if (!yyvs || !yyss) |
232 | ! goto yyoverflow; |
233 | ! yyssp = yyss + yyps_index; |
234 | ! yyvsp = yyvs + yypv_index; |
235 | } |
236 | *++yyssp = yystate = yytable[yyn]; |
93a17b20 |
237 | *************** |
ecca16b0 |
238 | *** 1436,1445 **** |
ed6116ce |
239 | #if YYDEBUG |
240 | if (yydebug) |
241 | ! printf("yydebug: state %d, error recovery shifting\ |
242 | ! to state %d\n", *yyssp, yytable[yyn]); |
93a17b20 |
243 | #endif |
244 | if (yyssp >= yyss + yystacksize - 1) |
245 | { |
246 | ! goto yyoverflow; |
247 | } |
248 | *++yyssp = yystate = yytable[yyn]; |
ecca16b0 |
249 | --- 1437,1461 ---- |
ed6116ce |
250 | #if YYDEBUG |
251 | if (yydebug) |
252 | ! fprintf(stderr, |
253 | ! "yydebug: state %d, error recovery shifting to state %d\n", |
254 | ! *yyssp, yytable[yyn]); |
93a17b20 |
255 | #endif |
256 | if (yyssp >= yyss + yystacksize - 1) |
257 | { |
258 | ! /* |
259 | ! ** reallocate and recover. Note that pointers |
260 | ! ** have to be reset, or bad things will happen |
261 | ! */ |
262 | ! int yyps_index = (yyssp - yyss); |
263 | ! int yypv_index = (yyvsp - yyvs); |
264 | ! yystacksize += YYSTACKSIZE; |
a0d0e21e |
265 | ! ysave->yyvs = yyvs = (YYSTYPE*)realloc((char*)yyvs, |
93a17b20 |
266 | ! yystacksize * sizeof(YYSTYPE)); |
a0d0e21e |
267 | ! ysave->yyss = yyss = (short*)realloc((char*)yyss, |
93a17b20 |
268 | ! yystacksize * sizeof(short)); |
269 | ! if (!yyvs || !yyss) |
270 | ! goto yyoverflow; |
271 | ! yyssp = yyss + yyps_index; |
272 | ! yyvsp = yyvs + yypv_index; |
273 | } |
274 | *++yyssp = yystate = yytable[yyn]; |
93a17b20 |
275 | *************** |
ecca16b0 |
276 | *** 1451,1456 **** |
ed6116ce |
277 | #if YYDEBUG |
278 | if (yydebug) |
279 | ! printf("yydebug: error recovery discarding state %d\n", |
280 | ! *yyssp); |
281 | #endif |
282 | if (yyssp <= yyss) goto yyabort; |
ecca16b0 |
283 | --- 1467,1473 ---- |
ed6116ce |
284 | #if YYDEBUG |
285 | if (yydebug) |
286 | ! fprintf(stderr, |
287 | ! "yydebug: error recovery discarding state %d\n", |
288 | ! *yyssp); |
289 | #endif |
290 | if (yyssp <= yyss) goto yyabort; |
ed6116ce |
291 | *************** |
ecca16b0 |
292 | *** 1469,1474 **** |
ed6116ce |
293 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
294 | if (!yys) yys = "illegal-symbol"; |
295 | ! printf("yydebug: state %d, error recovery discards token %d (%s)\n", |
296 | ! yystate, yychar, yys); |
297 | } |
298 | #endif |
ecca16b0 |
299 | --- 1486,1492 ---- |
ed6116ce |
300 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
301 | if (!yys) yys = "illegal-symbol"; |
302 | ! fprintf(stderr, |
303 | ! "yydebug: state %d, error recovery discards token %d (%s)\n", |
304 | ! yystate, yychar, yys); |
305 | } |
306 | #endif |
ed6116ce |
307 | *************** |
ecca16b0 |
308 | *** 1479,1483 **** |
ed6116ce |
309 | #if YYDEBUG |
310 | if (yydebug) |
311 | ! printf("yydebug: state %d, reducing by rule %d (%s)\n", |
312 | yystate, yyn, yyrule[yyn]); |
313 | #endif |
ecca16b0 |
314 | --- 1497,1501 ---- |
ed6116ce |
315 | #if YYDEBUG |
316 | if (yydebug) |
317 | ! fprintf(stderr, "yydebug: state %d, reducing by rule %d (%s)\n", |
318 | yystate, yyn, yyrule[yyn]); |
319 | #endif |
ed6116ce |
320 | *************** |
ecca16b0 |
321 | *** 2274,2279 **** |
ed6116ce |
322 | #if YYDEBUG |
323 | if (yydebug) |
324 | ! printf("yydebug: after reduction, shifting from state 0 to\ |
325 | ! state %d\n", YYFINAL); |
326 | #endif |
327 | yystate = YYFINAL; |
ecca16b0 |
328 | --- 2292,2298 ---- |
ed6116ce |
329 | #if YYDEBUG |
330 | if (yydebug) |
331 | ! fprintf(stderr, |
332 | ! "yydebug: after reduction, shifting from state 0 to state %d\n", |
333 | ! YYFINAL); |
334 | #endif |
335 | yystate = YYFINAL; |
ed6116ce |
336 | *************** |
ecca16b0 |
337 | *** 2289,2293 **** |
ed6116ce |
338 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
339 | if (!yys) yys = "illegal-symbol"; |
340 | ! printf("yydebug: state %d, reading %d (%s)\n", |
341 | YYFINAL, yychar, yys); |
342 | } |
ecca16b0 |
343 | --- 2308,2312 ---- |
ed6116ce |
344 | if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
345 | if (!yys) yys = "illegal-symbol"; |
346 | ! fprintf(stderr, "yydebug: state %d, reading %d (%s)\n", |
347 | YYFINAL, yychar, yys); |
348 | } |
ed6116ce |
349 | *************** |
ecca16b0 |
350 | *** 2304,2313 **** |
ed6116ce |
351 | #if YYDEBUG |
352 | if (yydebug) |
353 | ! printf("yydebug: after reduction, shifting from state %d \ |
354 | ! to state %d\n", *yyssp, yystate); |
93a17b20 |
355 | #endif |
356 | if (yyssp >= yyss + yystacksize - 1) |
357 | { |
358 | ! goto yyoverflow; |
359 | } |
360 | *++yyssp = yystate; |
ecca16b0 |
361 | --- 2323,2347 ---- |
ed6116ce |
362 | #if YYDEBUG |
363 | if (yydebug) |
364 | ! fprintf(stderr, |
365 | ! "yydebug: after reduction, shifting from state %d to state %d\n", |
366 | ! *yyssp, yystate); |
93a17b20 |
367 | #endif |
368 | if (yyssp >= yyss + yystacksize - 1) |
369 | { |
370 | ! /* |
371 | ! ** reallocate and recover. Note that pointers |
372 | ! ** have to be reset, or bad things will happen |
373 | ! */ |
374 | ! int yyps_index = (yyssp - yyss); |
375 | ! int yypv_index = (yyvsp - yyvs); |
376 | ! yystacksize += YYSTACKSIZE; |
a0d0e21e |
377 | ! ysave->yyvs = yyvs = |
378 | ! (YYSTYPE*)realloc((char*)yyvs,yystacksize * sizeof(YYSTYPE)); |
379 | ! ysave->yyss = yyss = |
380 | ! (short*)realloc((char*)yyss,yystacksize * sizeof(short)); |
93a17b20 |
381 | ! if (!yyvs || !yyss) |
382 | ! goto yyoverflow; |
383 | ! yyssp = yyss + yyps_index; |
384 | ! yyvsp = yyvs + yypv_index; |
385 | } |
386 | *++yyssp = yystate; |
bbce6d69 |
387 | *************** |
ecca16b0 |
388 | *** 2315,2322 **** |
bbce6d69 |
389 | goto yyloop; |
390 | yyoverflow: |
391 | ! yyerror("yacc stack overflow"); |
392 | yyabort: |
393 | ! return (1); |
394 | yyaccept: |
395 | ! return (0); |
396 | } |
ecca16b0 |
397 | --- 2349,2356 ---- |
93a17b20 |
398 | goto yyloop; |
399 | yyoverflow: |
400 | ! yyerror("Out of memory for yacc stack"); |
401 | yyabort: |
402 | ! retval = 1; |
403 | yyaccept: |
93a17b20 |
404 | ! return retval; |
405 | } |