summaryrefslogtreecommitdiff
path: root/perly.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-02-28 22:37:08 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-02-28 22:37:08 +0000
commit12fbd33b4c244f0a97c39c9f6411b444814dbc56 (patch)
tree6c02d508ab1042a2f7c121e9e111118886b3437b /perly.c
parent003a92ef523fede541513d0991848d9e3d62707a (diff)
downloadperl-12fbd33b4c244f0a97c39c9f6411b444814dbc56.tar.gz
make the bison-based parser threadsafe and capable of deep
recursion by eradicating Perl_yylex_r() p4raw-id: //depot/perl@22408
Diffstat (limited to 'perly.c')
-rw-r--r--perly.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/perly.c b/perly.c
index b18e202ed1..2e8da7529a 100644
--- a/perly.c
+++ b/perly.c
@@ -76,10 +76,6 @@ while (0)
#define YYTERROR 1
#define YYERRCODE 256
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-# define YYLEX yylex_r (&yylval, &yychar)
-
/* Enable debugging if requested. */
#ifdef DEBUGGING
@@ -335,11 +331,12 @@ Perl_yyparse (pTHX)
YYDPRINTF ((Perl_debug_log, "Starting parse\n"));
-#ifdef USE_ITHREADS
- /* XXX is this needed anymore? DAPM 13-Feb-04;
- * if not, delete the correspinding LEAVE too */
ENTER; /* force stack free before we return */
-#endif
+ SAVEVPTR(PL_yycharp);
+ SAVEVPTR(PL_yylvalp);
+ PL_yycharp = &yychar; /* so PL_yyerror() can access it */
+ PL_yylvalp = &yylval; /* so various functions in toke.c can access it */
+
yyss_sv = NEWSV(73, YYINITDEPTH * sizeof(short));
yyvs_sv = NEWSV(73, YYINITDEPTH * sizeof(YYSTYPE));
SAVEFREESV(yyss_sv);
@@ -437,7 +434,12 @@ Perl_yyparse (pTHX)
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY) {
YYDPRINTF ((Perl_debug_log, "Reading a token: "));
- yychar = YYLEX;
+ yychar = yylex();
+# ifdef EBCDIC
+ if (yychar >= 0 && yychar < 255) {
+ yychar = NATIVE_TO_ASCII(yychar);
+ }
+# endif
}
if (yychar <= YYEOF) {
@@ -722,9 +724,7 @@ Perl_yyparse (pTHX)
yyreturn:
-#ifdef USE_ITHREADS
- LEAVE; /* force stack free before we return */
-#endif
+ LEAVE; /* force stack free before we return */
return yyresult;
}