From bc177e6b66d4907a90c81f2862ce55ad78b6496f Mon Sep 17 00:00:00 2001 From: Dave Mitchell Date: Sat, 5 May 2007 17:38:12 +0000 Subject: [PATCH] move PL_lex_state into the PL_parser struct p4raw-id: //depot/perl@31154 --- embedvar.h | 2 -- intrpvar.h | 3 +-- mg.c | 2 +- op.c | 2 +- parser.h | 1 + perl.c | 1 - perlapi.h | 2 -- pp_ctl.c | 2 +- sv.c | 4 ++-- toke.c | 2 +- 10 files changed, 8 insertions(+), 13 deletions(-) diff --git a/embedvar.h b/embedvar.h index 2218a38..f5334b5 100644 --- a/embedvar.h +++ b/embedvar.h @@ -233,7 +233,6 @@ #define PL_lastfd (vTHX->Ilastfd) #define PL_laststatval (vTHX->Ilaststatval) #define PL_laststype (vTHX->Ilaststype) -#define PL_lex_state (vTHX->Ilex_state) #define PL_lineary (vTHX->Ilineary) #define PL_localpatches (vTHX->Ilocalpatches) #define PL_lockhook (vTHX->Ilockhook) @@ -484,7 +483,6 @@ #define PL_Ilastfd PL_lastfd #define PL_Ilaststatval PL_laststatval #define PL_Ilaststype PL_laststype -#define PL_Ilex_state PL_lex_state #define PL_Ilineary PL_lineary #define PL_Ilocalpatches PL_localpatches #define PL_Ilockhook PL_lockhook diff --git a/intrpvar.h b/intrpvar.h index 02fc97e..e2c7b19 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -285,10 +285,9 @@ PERLVAR(Isv_undef, SV) PERLVAR(Isv_no, SV) PERLVAR(Isv_yes, SV) -PERLVAR(Ilex_state, U8) /* next token is determined */ PERLVAR(Ierror_count, U8) /* how many errors so far, max 10 */ PERLVARI(Icv_has_eval, bool, FALSE) /* PL_compcv includes an entereval or similar */ -/* Space for one more U8 here without increasing the structure size */ +/* Space for two more U8 here without increasing the structure size */ PERLVAR(Imulti_end, I32) /* last line of multi-line string */ diff --git a/mg.c b/mg.c index 328885f..655af2b 100644 --- a/mg.c +++ b/mg.c @@ -807,7 +807,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) break; case '\023': /* ^S */ if (nextchar == '\0') { - if (PL_lex_state != LEX_NOTPARSING) + if (PL_parser && PL_parser->lex_state != LEX_NOTPARSING) SvOK_off(sv); else if (PL_in_eval) sv_setiv(sv, PL_in_eval & ~(EVAL_INREQUIRE)); diff --git a/op.c b/op.c index 2f043c0..40b415d 100644 --- a/op.c +++ b/op.c @@ -2818,7 +2818,7 @@ Perl_mad_free(pTHX_ MADPROP* mp) return; if (mp->mad_next) mad_free(mp->mad_next); -/* if (PL_lex_state != LEX_NOTPARSING && mp->mad_vlen) +/* if (PL_parser && PL_parser->lex_state != LEX_NOTPARSING && mp->mad_vlen) PerlIO_printf(PerlIO_stderr(), "DESTROYING '%c'=<%s>\n", mp->mad_key & 255, mp->mad_val); */ switch (mp->mad_type) { case MAD_NULL: diff --git a/parser.h b/parser.h index b9f4dda..1df14b4 100644 --- a/parser.h +++ b/parser.h @@ -69,6 +69,7 @@ typedef struct yy_parser { char *linestart; /* beginning of most recently read line */ char *last_uni; /* position of last named-unary op */ char *last_lop; /* position of last list operator */ + U8 lex_state; /* next token is determined */ #ifdef PERL_MAD SV *endwhite; diff --git a/perl.c b/perl.c index 3a9d368..da52f85 100644 --- a/perl.c +++ b/perl.c @@ -293,7 +293,6 @@ perl_construct(pTHXx) init_stacks(); init_ids(); - PL_lex_state = LEX_NOTPARSING; JMPENV_BOOTSTRAP; STATUS_ALL_SUCCESS; diff --git a/perlapi.h b/perlapi.h index b4096cf..98dd3aa 100644 --- a/perlapi.h +++ b/perlapi.h @@ -342,8 +342,6 @@ END_EXTERN_C #define PL_laststatval (*Perl_Ilaststatval_ptr(aTHX)) #undef PL_laststype #define PL_laststype (*Perl_Ilaststype_ptr(aTHX)) -#undef PL_lex_state -#define PL_lex_state (*Perl_Ilex_state_ptr(aTHX)) #undef PL_lineary #define PL_lineary (*Perl_Ilineary_ptr(aTHX)) #undef PL_localpatches diff --git a/pp_ctl.c b/pp_ctl.c index 85f8278..26e1cb8 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3009,7 +3009,7 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq) CvDEPTH(PL_compcv) = 1; SP = PL_stack_base + POPMARK; /* pop original mark */ PL_op = saveop; /* The caller may need it. */ - PL_lex_state = LEX_NOTPARSING; /* $^S needs this. */ + PL_parser->lex_state = LEX_NOTPARSING; /* $^S needs this. */ RETURNOP(PL_eval_start); } diff --git a/sv.c b/sv.c index 276b8c7..c4f49d4 100644 --- a/sv.c +++ b/sv.c @@ -9575,6 +9575,8 @@ Perl_parser_dup(pTHX_ const yy_parser *proto, CLONE_PARAMS* param) parser->expect = proto->expect; parser->copline = proto->copline; parser->last_lop_op = proto->last_lop_op; + parser->lex_state = proto->lex_state; + parser->linestr = sv_dup_inc(proto->linestr, param); @@ -11257,8 +11259,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, PL_parser = parser_dup(proto_perl->Iparser, param); - PL_lex_state = proto_perl->Ilex_state; - PL_multi_end = proto_perl->Imulti_end; PL_error_count = proto_perl->Ierror_count; diff --git a/toke.c b/toke.c index 4fca542..9726a31 100644 --- a/toke.c +++ b/toke.c @@ -60,6 +60,7 @@ #define PL_last_uni (PL_parser->last_uni) #define PL_last_lop (PL_parser->last_lop) #define PL_last_lop_op (PL_parser->last_lop_op) +#define PL_lex_state (PL_parser->lex_state) #ifdef PERL_MAD # define PL_endwhite (PL_parser->endwhite) @@ -663,7 +664,6 @@ Perl_lex_start(pTHX_ SV *line) /* initialise lexer state */ - SAVEI8(PL_lex_state); SAVECOPLINE(PL_curcop); SAVEDESTRUCTOR_X(restore_rsfp, PL_rsfp); -- 2.7.4