diff options
author | Larry Wall <lwall@netlabs.com> | 1991-06-09 12:36:21 +0000 |
---|---|---|
committer | Larry Wall <lwall@netlabs.com> | 1991-06-09 12:36:21 +0000 |
commit | 1462b684862954f3522657efc93a3264698e4a9f (patch) | |
tree | c92554143d0076f4bd8a6f41f8caa3315eef035d /toke.c | |
parent | d48672a2009b4897fb5bf74d6723c050cdd015e0 (diff) | |
download | perl-1462b684862954f3522657efc93a3264698e4a9f.tar.gz |
perl 4.0 patch 10: (combined patch)
Subject: pack(hh,1) dumped core
Subject: read didn't work from character special files open for writing
Subject: close-on-exec wrongly set on system file descriptors
Subject: //g only worked first time through
Subject: perl -v printed incorrect copyright notice
Subject: certain pattern optimizations were botched
Subject: documented some newer features in addenda
Subject: $) and $| incorrectly handled in run-time patterns
Subject: added tests for case-insensitive regular expressions
Subject: m'$foo' now treats string as single quoted
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $RCSfile: toke.c,v $$Revision: 4.0.1.2 $$Date: 91/06/07 12:05:56 $ +/* $RCSfile: toke.c,v $$Revision: 4.0.1.3 $$Date: 91/06/10 01:32:26 $ * * Copyright (c) 1991, Larry Wall * @@ -6,6 +6,10 @@ * License or the Artistic License, as specified in the README file. * * $Log: toke.c,v $ + * Revision 4.0.1.3 91/06/10 01:32:26 lwall + * patch10: m'$foo' now treats string as single quoted + * patch10: certain pattern optimizations were botched + * * Revision 4.0.1.2 91/06/07 12:05:56 lwall * patch4: new copyright notice * patch4: debugger lost track of lines in eval @@ -1514,6 +1518,7 @@ register char *s; int len; SPAT savespat; STR *str = Str_new(93,0); + char delim; Newz(801,spat,1,SPAT); spat->spat_next = curstash->tbl_spatroot; /* link into spat list */ @@ -1538,7 +1543,7 @@ register char *s; yylval.arg = Nullarg; return s; } - s++; + delim = *s++; while (*s == 'i' || *s == 'o' || *s == 'g') { if (*s == 'i') { s++; @@ -1556,7 +1561,11 @@ register char *s; } len = str->str_cur; e = str->str_ptr + len; - for (d = str->str_ptr; d < e; d++) { + if (delim == '\'') + d = e; + else + d = str->str_ptr; + for (; d < e; d++) { if (*d == '\\') d++; else if ((*d == '$' && d[1] && d[1] != '|' && d[1] != ')') || @@ -1738,15 +1747,18 @@ get_repl: return s; } +void hoistmust(spat) register SPAT *spat; { if (!spat->spat_short && spat->spat_regexp->regstart && (!spat->spat_regexp->regmust || spat->spat_regexp->reganch & ROPT_ANCH) ) { - spat->spat_short = spat->spat_regexp->regstart; if (!(spat->spat_regexp->reganch & ROPT_ANCH)) spat->spat_flags |= SPAT_SCANFIRST; + else if (spat->spat_flags & SPAT_FOLD) + return; + spat->spat_short = str_smake(spat->spat_regexp->regstart); } else if (spat->spat_regexp->regmust) {/* is there a better short-circuit? */ if (spat->spat_short && |