/* Allow dumping */
n = scan + (*OPERAND(scan) + 2 - 1)/sizeof(regnode) + 2;
while (n <= stop) {
+ /* Purify reports a benign UMR here sometimes, because we
+ * don't initialize the OP() slot of a node when that node
+ * is occupied by just the trailing null of the string in
+ * an EXACT node */
if (regkind[(U8)OP(n)] != NOTHING || OP(n) == NOTHING) {
OP(n) = OPTIMIZED;
NEXT_OFF(n) = 0;
delta += (minnext + deltanext) * maxcount - minnext * mincount;
/* Try powerful optimization CURLYX => CURLYN. */
-#ifdef REGALIGN_STRUCT
if ( OP(oscan) == CURLYX && data
&& data->flags & SF_IN_PAR
&& !(data->flags & SF_HAS_EVAL)
NEXT_OFF(nxt+ 1) = 0; /* just for consistancy. */
#endif
}
-#endif
nogo:
/* Try optimization CURLYX => CURLYM. */
if ( OP(oscan) == CURLYX && data
-#ifdef REGALIGN_STRUCT
&& !(data->flags & SF_HAS_PAR)
-#else
- && !(data->flags & (SF_HAS_PAR|SF_IN_PAR))
-#endif
&& !(data->flags & SF_HAS_EVAL)
&& !deltanext ) {
/* XXXX How to optimize if data == 0? */
&& (OP(nxt2) != WHILEM))
nxt = nxt2;
OP(nxt2) = SUCCEED; /* Whas WHILEM */
-#ifdef REGALIGN_STRUCT
/* Need to optimize away parenths. */
if (data->flags & SF_IN_PAR) {
/* Set the parenth number. */
study_chunk(&nxt1, &deltanext, nxt, NULL, 0);
} else
oscan->flags = 0;
-#endif
}
if (data && fl & (SF_HAS_PAR|SF_IN_PAR))
pars++;
if (data && (fl & SF_HAS_EVAL))
data->flags |= SF_HAS_EVAL;
optimize_curly_tail:
-#ifdef REGALIGN
if (OP(oscan) != CURLYX) {
while (regkind[(U8)OP(next = regnext(oscan))] == NOTHING
&& NEXT_OFF(next))
NEXT_OFF(oscan) += NEXT_OFF(next);
}
-#endif
continue;
default: /* REF only? */
if (flags & SCF_DO_SUBSTR) {
} else if (OP(scan) == OPEN) {
pars++;
} else if (OP(scan) == CLOSE && ARG(scan) == is_par) {
-#ifdef REGALIGN_STRUCT
next = regnext(scan);
if ( next && (OP(next) != WHILEM) && next < last)
-#endif
is_par = 0; /* Disable optimization */
} else if (OP(scan) == EVAL) {
if (data)
/* Small enough for pointer-storage convention?
If extralen==0, this means that we will not need long jumps. */
-#ifndef REGALIGN_STRUCT
- if (regsize >= 0x10000L && extralen)
- FAIL("regexp too big");
-#else
if (regsize >= 0x10000L && extralen)
regsize += extralen;
else
extralen = 0;
-#endif
/* Allocate space and initialize. */
Newc(1001, r, sizeof(regexp) + (unsigned)regsize * sizeof(regnode),
r->reganch |= ROPT_GPOS_SEEN;
if (regseen & REG_SEEN_LOOKBEHIND)
r->reganch |= ROPT_LOOKBEHIND_SEEN;
+ if (regseen & REG_SEEN_EVAL)
+ r->reganch |= ROPT_EVAL_SEEN;
Newz(1002, r->startp, regnpar, char*);
Newz(1002, r->endp, regnpar, char*);
DEBUG_r(regdump(r));
ret = NULL; /* For look-ahead/behind. */
switch (paren) {
case '<':
-#ifndef REGALIGN_STRUCT
- FAIL("lookbehind non-implemented without REGALIGN_STRUCT");
-#endif
regseen |= REG_SEEN_LOOKBEHIND;
if (*regcomp_parse == '!')
paren = ',';
OP_4tree *sop, *rop;
seen_zerolen++;
+ regseen |= REG_SEEN_EVAL;
while (count && (c = *regcomp_parse)) {
if (c == '\\' && regcomp_parse[1])
regcomp_parse++;
if (paren == '>')
node = SUSPEND, flag = 0;
reginsert(node,ret);
-#ifdef REGALIGN_STRUCT
ret->flags = flag;
-#endif
regtail(ret, reg_node(TAIL));
}
}
if (SIZE_ONLY)
extralen += 3;
}
-#ifdef REGALIGN_STRUCT
ret->flags = 0;
-#endif
if (min > 0)
*flagp = (WORST|HASWIDTH);
if (op == '*' && (flags&SIMPLE)) {
reginsert(STAR, ret);
-#ifdef REGALIGN_STRUCT
ret->flags = 0;
-#endif
regnaughty += 4;
}
else if (op == '*') {
goto do_curly;
} else if (op == '+' && (flags&SIMPLE)) {
reginsert(PLUS, ret);
-#ifdef REGALIGN_STRUCT
ret->flags = 0;
-#endif
regnaughty += 3;
}
else if (op == '+') {
if (*regcomp_parse == '?') {
nextchar();
reginsert(MINMOD, ret);
-#ifdef REGALIGN
regtail(ret, ret + NODE_STEP_REGNODE);
-#else
- regtail(ret, ret + 3);
-#endif
}
if (ISMULT2(regcomp_parse))
FAIL("nested *?+ in regexp");
*OPERAND(ret) = len;
regc('\0', s++);
if (SIZE_ONLY) {
-#ifdef REGALIGN_STRUCT
regsize += (len + 2 + sizeof(regnode) - 1) / sizeof(regnode);
-#endif
} else {
regcode += (len + 2 + sizeof(regnode) - 1) / sizeof(regnode);
}
ret = regcode;
if (SIZE_ONLY) {
SIZE_ALIGN(regsize);
-#ifdef REGALIGN_STRUCT
regsize += 1;
-#else
- regsize += 3;
-#endif
return(ret);
}
ret = regcode;
if (SIZE_ONLY) {
SIZE_ALIGN(regsize);
-#ifdef REGALIGN
regsize += 2;
-#else
- regsize += 5;
-#endif
return(ret);
}
src = NEXTOPER(place);
FILL_ADVANCE_NODE(place, op);
Zero(src, offset, regnode);
-#if defined(REGALIGN) && !defined(REGALIGN_STRUCT)
- src[offset + 1] = '\177';
-#endif
}
/*
scan = temp;
}
-#ifdef REGALIGN
-# ifdef REGALIGN_STRUCT
if (reg_off_by_arg[OP(scan)]) {
ARG_SET(scan, val - scan);
} else {
NEXT_OFF(scan) = val - scan;
}
-# else
- offset = val - scan;
-# ifndef lint
- *(short*)(scan+1) = offset;
-# endif
-#endif
-#else
- if (OP(scan) == BACK)
- offset = scan - val;
- else
- offset = val - scan;
- *(scan+1) = (offset>>8)&0377;
- *(scan+2) = offset&0377;
-#endif
}
/*
if (r->reganch & ROPT_IMPLICIT)
PerlIO_printf(Perl_debug_log, "implicit ");
PerlIO_printf(Perl_debug_log, "minlen %ld ", (long) r->minlen);
+ if (r->reganch & ROPT_EVAL_SEEN)
+ PerlIO_printf(Perl_debug_log, "with eval ");
PerlIO_printf(Perl_debug_log, "\n");
#endif /* DEBUGGING */
}
sv_catpvf(sv, "CURLY {%d,%d}", ARG1(o), ARG2(o));
break;
case CURLYM:
-#ifdef REGALIGN_STRUCT
sv_catpvf(sv, "CURLYM[%d] {%d,%d}", o->flags, ARG1(o), ARG2(o));
-#else
- sv_catpvf(sv, "CURLYM {%d,%d}", ARG1(o), ARG2(o));
-#endif
break;
case CURLYN:
-#ifdef REGALIGN_STRUCT
sv_catpvf(sv, "CURLYN[%d] {%d,%d}", o->flags, ARG1(o), ARG2(o));
-#else
- sv_catpvf(sv, "CURLYN {%d,%d}", ARG1(o), ARG2(o));
-#endif
break;
case CURLYX:
sv_catpvf(sv, "CURLYX {%d,%d}", ARG1(o), ARG2(o));
p = "GPOS";
break;
case UNLESSM:
-#ifdef REGALIGN_STRUCT
sv_catpvf(sv, "UNLESSM[-%d]", o->flags);
-#else
- p = "UNLESSM";
-#endif
break;
case IFMATCH:
-#ifdef REGALIGN_STRUCT
sv_catpvf(sv, "IFMATCH[-%d]", o->flags);
-#else
- p = "IFMATCH";
-#endif
break;
case SUCCEED:
p = "SUCCEED";
if (offset == 0)
return(NULL);
-#ifdef REGALIGN
return(p+offset);
-#else
- if (OP(p) == BACK)
- return(p-offset);
- else
- return(p+offset);
-#endif
}
STATIC void
l2 = 510 - l1;
Copy(pat1, buf, l1 , char);
Copy(pat2, buf + l1, l2 , char);
- buf[l1 + l2 + 1] = '\n';
- buf[l1 + l2 + 2] = '\0';
+ buf[l1 + l2] = '\n';
+ buf[l1 + l2 + 1] = '\0';
va_start(args, pat2);
message = mess(buf, &args);
va_end(args);