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