summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1998-07-12 14:57:47 -0500
committerGurusamy Sarathy <gsar@cpan.org>1998-07-13 02:44:30 +0000
commit8782bef2aa2ca158fdd0d7436e68ae3ac2b01ff7 (patch)
tree5014b290517414faa6839abd622ed81e17116829 /toke.c
parentc70c8a0a59777ed7fb7075471185210bc2169b49 (diff)
downloadperl-8782bef2aa2ca158fdd0d7436e68ae3ac2b01ff7.tar.gz
added patch, tweaked PERL_OBJECT things
Message-Id: <19980712195747.C493@pobox.com> Subject: [ PATCH perl5.004_72] patch to add qr// p4raw-id: //depot/perl@1461
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/toke.c b/toke.c
index 538625ed8a..db8775859a 100644
--- a/toke.c
+++ b/toke.c
@@ -28,7 +28,7 @@ static char *scan_heredoc _((char *s));
static char *scan_ident _((char *s, char *send, char *dest, STRLEN destlen,
I32 ck_uni));
static char *scan_inputsymbol _((char *start));
-static char *scan_pat _((char *start));
+static char *scan_pat _((char *start, I32 type));
static char *scan_str _((char *start));
static char *scan_subst _((char *start));
static char *scan_trans _((char *start));
@@ -710,7 +710,7 @@ sublex_push(void)
curcop->cop_line = multi_start;
lex_inwhat = sublex_info.sub_inwhat;
- if (lex_inwhat == OP_MATCH || lex_inwhat == OP_SUBST)
+ if (lex_inwhat == OP_MATCH || lex_inwhat == OP_QR || lex_inwhat == OP_SUBST)
lex_inpat = sublex_info.sub_op;
else
lex_inpat = Nullop;
@@ -2651,7 +2651,7 @@ yylex(void)
&& (*last_uni != 's' || s - last_uni < 5
|| memNE(last_uni, "study", 5) || isALNUM(last_uni[5])))
check_uni();
- s = scan_pat(s);
+ s = scan_pat(s,OP_MATCH);
TERM(sublex_start());
}
tmp = *s++;
@@ -2792,7 +2792,7 @@ yylex(void)
tmp = (len == 1 && strchr("msyq", tokenbuf[0]) ||
len == 2 && ((tokenbuf[0] == 't' && tokenbuf[1] == 'r') ||
(tokenbuf[0] == 'q' &&
- strchr("qwx", tokenbuf[1]))));
+ strchr("qwxr", tokenbuf[1]))));
/* x::* is just a word, unless x is "CORE" */
if (!tmp && *s == ':' && s[1] == ':' && strNE(tokenbuf, "CORE"))
@@ -3500,7 +3500,7 @@ yylex(void)
UNI(OP_LSTAT);
case KEY_m:
- s = scan_pat(s);
+ s = scan_pat(s,OP_MATCH);
TERM(sublex_start());
case KEY_map:
@@ -3661,6 +3661,10 @@ yylex(void)
SvIVX(lex_stuff) = 0; /* qq'$foo' should intepolate */
TERM(sublex_start());
+ case KEY_qr:
+ s = scan_pat(s,OP_QR);
+ TERM(sublex_start());
+
case KEY_qx:
s = scan_str(s);
if (!s)
@@ -4458,6 +4462,7 @@ keyword(register char *d, I32 len)
case 'q':
if (len <= 2) {
if (strEQ(d,"q")) return KEY_q;
+ if (strEQ(d,"qr")) return KEY_qr;
if (strEQ(d,"qq")) return KEY_qq;
if (strEQ(d,"qw")) return KEY_qw;
if (strEQ(d,"qx")) return KEY_qx;
@@ -4967,7 +4972,7 @@ void pmflag(U16 *pmfl, int ch)
}
STATIC char *
-scan_pat(char *start)
+scan_pat(char *start, I32 type)
{
PMOP *pm;
char *s;
@@ -4980,11 +4985,17 @@ scan_pat(char *start)
croak("Search pattern not terminated");
}
- pm = (PMOP*)newPMOP(OP_MATCH, 0);
+ pm = (PMOP*)newPMOP(type, 0);
if (multi_open == '?')
pm->op_pmflags |= PMf_ONCE;
- while (*s && strchr("iogcmsx", *s))
- pmflag(&pm->op_pmflags,*s++);
+ if(type == OP_QR) {
+ while (*s && strchr("iomsx", *s))
+ pmflag(&pm->op_pmflags,*s++);
+ }
+ else {
+ while (*s && strchr("iogcmsx", *s))
+ pmflag(&pm->op_pmflags,*s++);
+ }
pm->op_pmpermflags = pm->op_pmflags;
lex_op = (OP*)pm;