pike.git/
src/
modules/
Regexp/
pike_regexp.c
Branch:
Tag:
Non-build tags
All tags
No tags
1998-03-26
1998-03-26 00:52:15 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
bfe7636a95a08e2d7da050db89e7208995524ccf (
133
lines) (+
55
/-
78
)
[
Show
|
Annotate
]
Branch:
7.9
expanded to handle 40 parenthesis
Rev: src/modules/Regexp/pike_regexp.c:1.11
123:
#define OPEN 20 /* no Mark this point in input as start of * #n. */ /* OPEN+1 is number 1, etc. */
-
#define CLOSE
30
/* no Analogous to OPEN. */
+
#define CLOSE
(OPEN+NSUBEXP)
/* no Analogous to OPEN. */
/* * Opcode notes:
957:
break; case BACK: break;
-
case OPEN + 1:
-
case OPEN + 2:
-
case OPEN + 3:
-
case OPEN + 4:
-
case OPEN + 5:
-
case OPEN + 6:
-
case OPEN + 7:
-
case OPEN + 8:
-
case OPEN + 9:{
-
register int no;
-
register char *save;
+
-
no = OP(scan) - OPEN;
-
save = reginput;
-
-
if (regmatch(nxt)) {
-
/*
-
* Don't set startp if some later invocation of the same
-
* parentheses already has.
-
*/
-
if (regstartp[no] == (char *)NULL)
-
regstartp[no] = save;
-
return (1);
-
} else
-
return (0);
-
}
-
-
case CLOSE + 1:
-
case CLOSE + 2:
-
case CLOSE + 3:
-
case CLOSE + 4:
-
case CLOSE + 5:
-
case CLOSE + 6:
-
case CLOSE + 7:
-
case CLOSE + 8:
-
case CLOSE + 9:{
-
register int no;
-
register char *save;
-
-
no = OP(scan) - CLOSE;
-
save = reginput;
-
-
if (regmatch(nxt)) {
-
/*
-
* Don't set endp if some later invocation of the same
-
* parentheses already has.
-
*/
-
if (regendp[no] == (char *)NULL)
-
regendp[no] = save;
-
return (1);
-
} else
-
return (0);
-
}
-
+
case BRANCH:{ register char *save;
1061:
return (1); /* Success! */ default:
+
if(OP(scan) >= OPEN && OP(scan)<OPEN+NSUBEXP)
+
{
+
register int no;
+
register char *save;
+
+
no = OP(scan) - OPEN;
+
save = reginput;
+
+
if (regmatch(nxt)) {
+
/*
+
* Don't set startp if some later invocation of the same
+
* parentheses already has.
+
*/
+
if (regstartp[no] == (char *)NULL)
+
regstartp[no] = save;
+
return (1);
+
} else
+
return (0);
+
}
+
+
if(OP(scan) >= CLOSE && OP(scan)<CLOSE+NSUBEXP)
+
{
+
register int no;
+
register char *save;
+
+
no = OP(scan) - CLOSE;
+
save = reginput;
+
+
if (regmatch(nxt)) {
+
/*
+
* Don't set endp if some later invocation of the same
+
* parentheses already has.
+
*/
+
if (regendp[no] == (char *)NULL)
+
regendp[no] = save;
+
return (1);
+
} else
+
return (0);
+
}
regerror("memory corruption"); return (0);
1263:
case END: p = "END"; break;
-
case
OPEN + 1
:
-
case
OPEN
+
2:
-
case OPEN + 3:
-
case
OPEN
+
4:
-
case OPEN + 5
:
-
case
OPEN
+
6:
-
case
OPEN
+
7:
-
case OPEN + 8:
-
case
OPEN
+
9:
+
+
case
STAR
:
+
p
=
"STAR";
+
break;
+
+
default
:
+
if(OP(op)
>=
OPEN
&&
OP(op)
<
OPEN+NSUBEXP)
+
{
sprintf(buf + strlen(buf), "OPEN%d", OP(op) - OPEN); p = (char *)NULL; break;
-
case
CLOSE
+
1:
-
case CLOSE + 2:
-
case
CLOSE
+
3:
-
case
CLOSE
+
4:
-
case CLOSE + 5:
-
case
CLOSE
+
6:
-
case CLOSE + 7:
-
case CLOSE + 8:
-
case CLOSE + 9:
+
}
+
if(OP(op)
>=
CLOSE
&&
OP(op)
<
CLOSE+NSUBEXP)
+
{
sprintf(buf + strlen(buf), "CLOSE%d", OP(op) - CLOSE); p = (char *)NULL; break;
-
case
STAR:
-
p = "STAR";
-
break;
-
default:
+
}
regerror("corrupted opcode"); p=(char *)NULL; break;