diff options
author | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-02-06 15:06:18 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1998-02-06 15:06:18 +0000 |
commit | 49d8d3a1123fb996c090905424ed66f675b3df17 (patch) | |
tree | 6627148f7da2ca11dda917d271656821eb0b0a79 /toke.c | |
parent | 69dcf70cb27ded45873eb396cabbcbd82a21a2c8 (diff) | |
download | perl-49d8d3a1123fb996c090905424ed66f675b3df17.tar.gz |
More Chip patches:
Subject: [PATCH] Fix SEGV from combining caller and C<package;>
Date: Thu, 5 Feb 1998 21:47:50 -0500 (EST)
Subject: [PATCH] Fix line numbers after here documents in eval STRING
Date: Thu, 5 Feb 1998 21:50:08 -0500 (EST)
Subject: [PATCH] Make recursive lexical analysis more robust
Date: Thu, 5 Feb 1998 21:57:02 -0500 (EST)
p4raw-id: //depot/perl@464
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -49,6 +49,8 @@ static int uni _((I32 f, char *s)); #endif static char * filter_gets _((SV *sv, PerlIO *fp, STRLEN append)); static void restore_rsfp _((void *f)); +static void restore_expect _((void *e)); +static void restore_lex_expect _((void *e)); static char ident_too_long[] = "Identifier too long"; @@ -257,6 +259,11 @@ lex_start(SV *line) SAVEPPTR(lex_brackstack); SAVEPPTR(lex_casestack); SAVEDESTRUCTOR(restore_rsfp, rsfp); + SAVESPTR(lex_stuff); + SAVEI32(lex_defer); + SAVESPTR(lex_repl); + SAVEDESTRUCTOR(restore_expect, tokenbuf + expect); /* encode as pointer */ + SAVEDESTRUCTOR(restore_lex_expect, tokenbuf + expect); lex_state = LEX_NORMAL; lex_defer = 0; @@ -271,11 +278,7 @@ lex_start(SV *line) *lex_casestack = '\0'; lex_dojoin = 0; lex_starts = 0; - if (lex_stuff) - SvREFCNT_dec(lex_stuff); lex_stuff = Nullsv; - if (lex_repl) - SvREFCNT_dec(lex_repl); lex_repl = Nullsv; lex_inpat = 0; lex_inwhat = 0; @@ -315,6 +318,22 @@ restore_rsfp(void *f) } static void +restore_expect(e) +void *e; +{ + /* a safe way to store a small integer in a pointer */ + expect = (expectation)((char *)e - tokenbuf); +} + +static void +restore_lex_expect(e) +void *e; +{ + /* a safe way to store a small integer in a pointer */ + lex_expect = (expectation)((char *)e - tokenbuf); +} + +static void incline(char *s) { dTHR; @@ -4841,6 +4860,8 @@ scan_heredoc(register char *s) } sv_setpvn(tmpstr,d+1,s-d); s += len - 1; + curcop->cop_line++; /* the preceding stmt passes a newline */ + sv_catpvn(herewas,s,bufend-s); sv_setsv(linestr,herewas); oldoldbufptr = oldbufptr = bufptr = s = linestart = SvPVX(linestr); |