diff options
author | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-03-28 18:40:44 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-03-28 18:40:44 +0000 |
commit | 11343788cbaaede18e3146b5219d2fbdaeaf516e (patch) | |
tree | ef2be09ece0508b3408a222a86980d39e20bcd42 /toke.c | |
parent | a4f68e9b64464684b732bc17fd65ed4a1aa4708c (diff) | |
download | perl-11343788cbaaede18e3146b5219d2fbdaeaf516e.tar.gz |
Initial 3-way merge from (5.001m, thr1m, 5.003) plus fixups.
p4raw-id: //depot/thrperl@4
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 49 |
1 files changed, 34 insertions, 15 deletions
@@ -326,6 +326,7 @@ static char * skipspace(s) register char *s; { + dTHR; if (lex_formbrack && lex_brackets <= lex_formbrack) { while (s < bufend && (*s == ' ' || *s == '\t')) s++; @@ -500,11 +501,11 @@ register char *s; int kind; { if (s && *s) { - OP* op = (OP*)newSVOP(OP_CONST, 0, newSVpv(s,0)); - nextval[nexttoke].opval = op; + OP* o = (OP*)newSVOP(OP_CONST, 0, newSVpv(s,0)); + nextval[nexttoke].opval = o; force_next(WORD); if (kind) { - op->op_private = OPpCONST_ENTERED; + o->op_private = OPpCONST_ENTERED; gv_fetchpv(s, TRUE, kind == '$' ? SVt_PV : kind == '@' ? SVt_PVAV : @@ -1145,6 +1146,7 @@ extern int yychar; /* last token */ int yylex() { + dTHR; register char *s; register char *d; register I32 tmp; @@ -1657,7 +1659,7 @@ yylex() TERM('%'); } if (!strchr(tokenbuf,':')) { - if (tmp = pad_findmy(tokenbuf)) { + if ((tmp = pad_findmy(tokenbuf)) != NOT_IN_PAD) { nextval[nexttoke].opval = newOP(OP_PADANY, 0); nextval[nexttoke].opval->op_targ = tmp; force_next(PRIVATEREF); @@ -1969,7 +1971,7 @@ yylex() PREREF(DOLSHARP); if (!strchr(tokenbuf+1,':')) { tokenbuf[0] = '@'; - if (tmp = pad_findmy(tokenbuf)) { + if ((tmp = pad_findmy(tokenbuf)) != NOT_IN_PAD) { nextval[nexttoke].opval = newOP(OP_PADANY, 0); nextval[nexttoke].opval->op_targ = tmp; expect = XOPERATOR; @@ -2060,7 +2062,7 @@ yylex() tokenbuf[0] = '%'; } } - if (tmp = pad_findmy(tokenbuf)) { + if ((tmp = pad_findmy(tokenbuf)) != NOT_IN_PAD) { if (!tokenbuf[2] && *tokenbuf =='$' && tokenbuf[1] <= 'b' && tokenbuf[1] >= 'a') { @@ -2113,7 +2115,7 @@ yylex() if (*s == '{') tokenbuf[0] = '%'; } - if (tmp = pad_findmy(tokenbuf)) { + if (tmp = pad_findmy(tokenbuf) != NOT_IN_PAD) { nextval[nexttoke].opval = newOP(OP_PADANY, 0); nextval[nexttoke].opval->op_targ = tmp; force_next(PRIVATEREF); @@ -4334,6 +4336,7 @@ void hoistmust(pm) register PMOP *pm; { + dTHR; if (!pm->op_pmshort && pm->op_pmregexp->regstart && (!pm->op_pmregexp->regmust || pm->op_pmregexp->reganch & ROPT_ANCH) ) { @@ -4375,7 +4378,7 @@ scan_trans(start) char *start; { register char* s; - OP *op; + OP *o; short *tbl; I32 squash; I32 delete; @@ -4405,7 +4408,7 @@ char *start; } New(803,tbl,256,short); - op = newPVOP(OP_TRANS, 0, (char*)tbl); + o = newPVOP(OP_TRANS, 0, (char*)tbl); complement = delete = squash = 0; while (*s == 'c' || *s == 'd' || *s == 's') { @@ -4417,9 +4420,9 @@ char *start; squash = OPpTRANS_SQUASH; s++; } - op->op_private = delete|squash|complement; + o->op_private = delete|squash|complement; - lex_op = op; + lex_op = o; yylval.ival = OP_TRANS; return s; } @@ -4428,6 +4431,7 @@ static char * scan_heredoc(s) register char *s; { + dTHR; SV *herewas; I32 op_type = OP_SCALAR; I32 len; @@ -4575,10 +4579,10 @@ char *start; (void)strcpy(d,"ARGV"); if (*d == '$') { I32 tmp; - if (tmp = pad_findmy(d)) { - OP *op = newOP(OP_PADSV, 0); - op->op_targ = tmp; - lex_op = (OP*)newUNOP(OP_READLINE, 0, newUNOP(OP_RV2GV, 0, op)); + if ((tmp = pad_findmy(d)) != NOT_IN_PAD) { + OP *o = newOP(OP_PADSV, 0); + o->op_targ = tmp; + lex_op = (OP*)newUNOP(OP_READLINE, 0, newUNOP(OP_RV2GV, 0, o)); } else { GV *gv = gv_fetchpv(d+1,TRUE, SVt_PV); @@ -4602,6 +4606,7 @@ static char * scan_str(start) char *start; { + dTHR; SV *sv; char *tmps; register char *s = start; @@ -4812,6 +4817,7 @@ static char * scan_formline(s) register char *s; { + dTHR; register char *eol; register char *t; SV *stuff = newSVpv("",0); @@ -4890,6 +4896,7 @@ set_csh() int start_subparse() { + dTHR; int oldsavestack_ix = savestack_ix; CV* outsidecv = compcv; AV* comppadlist; @@ -4915,6 +4922,9 @@ start_subparse() comppad = newAV(); comppad_name = newAV(); comppad_name_fill = 0; +#ifdef USE_THREADS + av_store(comppad_name, 0, newSVpv("@_", 2)); +#endif /* USE_THREADS */ min_intro_pending = 0; av_push(comppad, Nullsv); curpad = AvARRAY(comppad); @@ -4928,6 +4938,13 @@ start_subparse() CvPADLIST(compcv) = comppadlist; CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc((SV*)outsidecv); +#ifdef USE_THREADS + CvOWNER(compcv) = 0; + New(666, CvMUTEXP(compcv), 1, pthread_mutex_t); + MUTEX_INIT(CvMUTEXP(compcv)); + New(666, CvCONDP(compcv), 1, pthread_cond_t); + COND_INIT(CvCONDP(compcv)); +#endif /* USE_THREADS */ return oldsavestack_ix; } @@ -4936,6 +4953,7 @@ int yywarn(s) char *s; { + dTHR; --error_count; in_eval |= 2; yyerror(s); @@ -4947,6 +4965,7 @@ int yyerror(s) char *s; { + dTHR; char tmpbuf[258]; char *tname = tmpbuf; |