if (data)
data->flags |= SF_HAS_EVAL;
}
- else if (OP(scan) == LOGICAL && scan->flags == 2) { /* Embedded */
+ else if (OP(scan) == LOGICAL && scan->flags == 2) { /* Embedded follows */
if (flags & SCF_DO_SUBSTR) {
scan_commit(data);
data->longest = &(data->longest_float);
is_inf = is_inf_internal = 1;
if (flags & SCF_DO_STCLASS_OR) /* Allow everything */
cl_anything(data->start_class);
+ flags &= ~SCF_DO_STCLASS;
}
/* Else: zero-length, ignore. */
scan = regnext(scan);
PL_regsize = 0L;
PL_regcode = &PL_regdummy;
PL_reg_whilem_seen = 0;
+#if 0 /* REGC() is (currently) a NOP at the first pass.
+ * Clever compilers notice this and complain. --jhi */
REGC((U8)REG_MAGIC, (char*)PL_regcode);
+#endif
if (reg(0, &flags) == NULL) {
Safefree(PL_regprecomp);
PL_regprecomp = Nullch;
*flagp = TRYAGAIN;
return NULL;
case 'p':
- Perl_warner(aTHX_ WARN_REGEXP, "(?p{}) is deprecated - use (??{})");
+ if (SIZE_ONLY)
+ Perl_warner(aTHX_ WARN_REGEXP,
+ "(?p{}) is deprecated - use (??{})");
/* FALL THROUGH*/
case '?':
logical = 1;
nextchar();
ret = reg(1, &flags);
if (ret == NULL) {
- if (flags & TRYAGAIN)
+ if (flags & TRYAGAIN) {
+ if (PL_regcomp_parse == PL_regxend) {
+ /* Make parent create an empty node if needed. */
+ *flagp |= TRYAGAIN;
+ return(NULL);
+ }
goto tryagain;
+ }
return(NULL);
}
*flagp |= flags&(HASWIDTH|SPSTART|SIMPLE);
if (!e)
FAIL("Missing right brace on \\x{}");
else if (UTF) {
- ender = (UV)scan_hex(p + 1, e - p, &numlen);
- if (numlen + len >= 127) { /* numlen is generous */
+ numlen = 1; /* allow underscores */
+ ender = (UV)scan_hex(p + 1, e - p - 1, &numlen);
+ /* numlen is generous */
+ if (numlen + len >= 127) {
p--;
goto loopdone;
}
FAIL("Can't use \\x{} without 'use utf8' declaration");
}
else {
+ numlen = 0; /* disallow underscores */
ender = (UV)scan_hex(p, 2, &numlen);
p += numlen;
}
case '5': case '6': case '7': case '8':case '9':
if (*p == '0' ||
(isDIGIT(p[1]) && atoi(p) >= PL_regnpar) ) {
+ numlen = 0; /* disallow underscores */
ender = (UV)scan_oct(p, 3, &numlen);
p += numlen;
}
case 'a': value = '\057'; break;
#endif
case 'x':
+ numlen = 0; /* disallow underscores */
value = (UV)scan_hex(PL_regcomp_parse, 2, &numlen);
PL_regcomp_parse += numlen;
break;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
+ numlen = 0; /* disallow underscores */
value = (UV)scan_oct(--PL_regcomp_parse, 3, &numlen);
PL_regcomp_parse += numlen;
break;
e = strchr(PL_regcomp_parse++, '}');
if (!e)
FAIL("Missing right brace on \\x{}");
+ numlen = 1; /* allow underscores */
value = (UV)scan_hex(PL_regcomp_parse,
e - PL_regcomp_parse,
&numlen);
PL_regcomp_parse = e + 1;
}
else {
+ numlen = 0; /* disallow underscores */
value = (UV)scan_hex(PL_regcomp_parse, 2, &numlen);
PL_regcomp_parse += numlen;
}
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
+ numlen = 0; /* disallow underscores */
value = (UV)scan_oct(--PL_regcomp_parse, 3, &numlen);
PL_regcomp_parse += numlen;
break;