#define REG_COMP_C
#include "regcomp.h"
-#ifdef USE_THREADS
+#ifdef op
#undef op
-#endif /* USE_THREADS */
+#endif /* op */
static regnode regdummy;
static char * regparse; /* Input-scan pointer. */
#define SF_HAS_PAR 0x80
#define SF_IN_PAR 0x100
#define SF_HAS_EVAL 0x200
+#define SCF_DO_SUBSTR 0x400
static void
scan_commit(scan_data_t *data)
data->flags &= ~SF_BEFORE_EOL;
}
-#define SCF_DO_SUBSTR 1
-
/* Stops at toplevel WHILEM as well as at `last'. At end *scanp is set
to the position after last scanned or to NULL. */
scan = next;
if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))
pars++;
- if (data_fake.flags & SF_HAS_EVAL)
+ if (data && (data_fake.flags & SF_HAS_EVAL))
data->flags |= SF_HAS_EVAL;
if (code == SUSPEND)
break;
data->last_start_max = is_inf
? I32_MAX : data->pos_min + data->pos_delta;
}
- sv_catpvn(data->last_found, OPERAND(scan)+1, l);
+ sv_catpvn(data->last_found, (char *)(OPERAND(scan)+1), l);
data->last_end = data->pos_min + l;
data->pos_min += l; /* As in the first entry. */
data->flags &= ~SF_BEFORE_EOL;
data->longest = &(data->longest_float);
}
}
- if (fl & SF_HAS_EVAL)
+ if (data && (fl & SF_HAS_EVAL))
data->flags |= SF_HAS_EVAL;
optimize_curly_tail:
#ifdef REGALIGN
}
if (data && data_fake.flags & (SF_HAS_PAR|SF_IN_PAR))
pars++;
- if (data_fake.flags & SF_HAS_EVAL)
+ if (data && (data_fake.flags & SF_HAS_EVAL))
data->flags |= SF_HAS_EVAL;
} else if (OP(scan) == OPEN) {
pars++;
DEBUG_r(
if (!colorset) {
int i = 0;
- char *s = getenv("TERMCAP_COLORS");
+ char *s = PerlEnv_getenv("TERMCAP_COLORS");
colorset = 1;
if (s) {
rx->data->data[n+1] = (void*)av;
rx->data->data[n+2] = (void*)sop;
SvREFCNT_dec(sv);
+ } else { /* First pass */
+ if (tainted)
+ FAIL("Eval-group in insecure regular expression");
}
nextchar();
- if (tainted)
- FAIL("Eval-group in insecure regular expression");
return reganode(EVAL, n);
}
case '(':
ret = reg_node((regflags & PMf_FOLD)
? ((regflags & PMf_LOCALE) ? EXACTFL : EXACTF)
: EXACT);
- s = OPERAND(ret);
+ s = (char *) OPERAND(ret);
regc(0, s++); /* save spot for len */
for (len = 0, p = regparse - 1;
len < 127 && p < regxend;
register I32 def;
I32 numlen;
- s = opnd = OPERAND(regcode);
+ s = opnd = (char *) OPERAND(regcode);
ret = reg_node(ANYOF);
for (Class = 0; Class < 33; Class++)
regc(0, s++);
while (regparse < regxend && *regparse != ']') {
skipcond:
Class = UCHARAT(regparse++);
+ if (Class == '[' && regparse + 1 < regxend &&
+ /* I smell either [: or [= or [. -- POSIX has been here, right? */
+ (*regparse == ':' || *regparse == '=' || *regparse == '.')) {
+ char posixccc = *regparse;
+ char* posixccs = regparse++;
+
+ while (regparse < regxend && *regparse != posixccc)
+ regparse++;
+ if (regparse == regxend)
+ /* Grandfather lone [:, [=, [. */
+ regparse = posixccs;
+ else {
+ regparse++; /* skip over the posixccc */
+ if (*regparse == ']') {
+ /* Not Implemented Yet.
+ * (POSIX Extended Character Classes, that is)
+ * The text between e.g. [: and :] would start
+ * at posixccs + 1 and stop at regparse - 2. */
+ if (dowarn && !SIZE_ONLY)
+ warn("Character class syntax [%c %c] is reserved for future extensions", posixccc, posixccc);
+ regparse++; /* skip over the ending ] */
+ }
+ }
+ }
if (Class == '\\') {
Class = UCHARAT(regparse++);
switch (Class) {
- reg_node - emit a node
*/
static regnode * /* Location. */
-#ifdef CAN_PROTOTYPE
reg_node(U8 op)
-#else
-reg_node(op)
-U8 op;
-#endif
{
register regnode *ret;
register regnode *ptr;
- reganode - emit a node with an argument
*/
static regnode * /* Location. */
-#ifdef CAN_PROTOTYPE
reganode(U8 op, U32 arg)
-#else
-reganode(op, arg)
-U8 op;
-U32 arg;
-#endif
{
register regnode *ret;
register regnode *ptr;
/*
- regc - emit (if appropriate) a byte of code
*/
-#ifdef CAN_PROTOTYPE
static void
regc(U8 b, char* s)
-#else
-static void
-regc(b, s)
-U8 b;
-char *s;
-#endif
{
if (!SIZE_ONLY)
*s = b;
*
* Means relocating the operand.
*/
-#ifdef CAN_PROTOTYPE
static void
reginsert(U8 op, regnode *opnd)
-#else
-static void
-reginsert(op, opnd)
-U8 op;
-regnode *opnd;
-#endif
{
register regnode *src;
register regnode *dst;
buf[l1] = '\0'; /* Overwrite \n */
croak("%s", buf);
}
-