Devel-RegExp

 view release on metacpan or  search on metacpan

RegExp.xs  view on Meta::CPAN

#endif /* DEBUGGING */

#define regexec(prog, string, len, minend, safebase) \
         pregexec((prog), (string), (string) + (len), (string), \
		  (minend), Nullsv, (safebase))
#define regfree pregfree
#define nparens(rx) ((rx)->nparens)
#define matches(rx) ((rx)->nparens)
#define lastparen(rx) ((rx)->lastparen)

static regexp *
regcomp(exp,pmflags)
char* exp;
U16 pmflags;
{
    PMOP fakepmop;

    fakepmop.op_pmflags = pmflags;
    return pregcomp(exp, exp + strlen(exp), &fakepmop);
}

MODULE = Devel::RegExp		PACKAGE = Devel::RegExp


double
constant(name,arg)
	char *		name
	int		arg


regexp *
regcomp(exp, flag = 0)
char* exp
U16 flag

void
regdump(r)
regexp *r

char *
regprop(op)
char *op

void
regfree(r)
regexp *r

I32
regexec(prog, stringarg, len = strlen(stringarg), minend = 0, safebase = FALSE)
regexp *prog
char *stringarg
I32 len
I32 minend
I32 safebase

void
match(rx, match = -1, base = NULL)
regexp *rx
I32 match
char *base
PPCODE:
     {
	 I32 mx;
	 char *s = rx->subbase, *b, *e;

	 if (s == 0) {
	     if (base == NULL) die("Cannot do regmatch without a saved base");
	     s = base;
	 }
	 if (match == -1) {
	     EXTEND(sp, 2 * rx->nparens);
	     match = 0;
	     mx = rx->nparens;
	 } else if (match < 0) {
	     die("regmatch(rx, match, ...) called with negative match = %i", match);
	 } else if (match <= rx->nparens) {
	     mx = match;
	 } else {
	     die("in regmatch(rx, match, ...) match = %i is too big", match);
	 }
	 while (match <= mx) {
	     b = rx->startp[match];
	     e = rx->endp[match];
	     if (b && e) {
		 PUSHs(sv_2mortal(newSViv(b - s)));
		 PUSHs(sv_2mortal(newSViv(e - s)));
	     } else {
		 PUSHs(&sv_undef);
		 PUSHs(&sv_undef);
	     }
	     match++;
	 }
     }

I32
nparens(rx)
regexp *rx


I32
matches(rx)
regexp *rx

I32
lastparen(rx)
regexp *rx



( run in 0.565 second using v1.01-cache-2.11-cpan-71847e10f99 )