From: Rafael Garcia-Suarez Date: Mon, 29 May 2006 12:40:15 +0000 (+0000) Subject: Regen headers following change 28325. Also, make it compile X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8e11feef835e00eadf3e49c408e281a3e0255459;p=p5sagit%2Fp5-mst-13.2.git Regen headers following change 28325. Also, make it compile with gcc by forward-declaring struct _reg_trie_data; and tweak the new re test to use test.pl, in order to portably run a new interpreter p4raw-id: //depot/perl@28326 --- diff --git a/embed.h b/embed.h index b2ea284..66c67a7 100644 --- a/embed.h +++ b/embed.h @@ -1304,16 +1304,9 @@ #define regpiece S_regpiece #define reginsert S_reginsert #define regtail S_regtail +#define regtail_study S_regtail_study #define regwhite S_regwhite #define nextchar S_nextchar -#endif -# ifdef DEBUGGING -#if defined(PERL_CORE) || defined(PERL_EXT) -#define dumpuntil S_dumpuntil -#define put_byte S_put_byte -#endif -# endif -#if defined(PERL_CORE) || defined(PERL_EXT) #define scan_commit S_scan_commit #define cl_anything S_cl_anything #define cl_is_anything S_cl_is_anything @@ -1330,10 +1323,17 @@ #if defined(PERL_CORE) || defined(PERL_EXT) #define regpposixcc S_regpposixcc #define checkposixcc S_checkposixcc +#define make_trie S_make_trie #endif +# ifdef DEBUGGING #if defined(PERL_CORE) || defined(PERL_EXT) -#define make_trie S_make_trie +#define dumpuntil S_dumpuntil +#define put_byte S_put_byte +#define dump_trie S_dump_trie +#define dump_trie_interim_list S_dump_trie_interim_list +#define dump_trie_interim_table S_dump_trie_interim_table #endif +# endif #endif #if defined(PERL_IN_REGEXEC_C) || defined(PERL_DECL_PROT) #if defined(PERL_CORE) || defined(PERL_EXT) @@ -3461,27 +3461,20 @@ #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_DECL_PROT) #if defined(PERL_CORE) || defined(PERL_EXT) -#define reg(a,b,c) S_reg(aTHX_ a,b,c) +#define reg(a,b,c,d) S_reg(aTHX_ a,b,c,d) #define reganode(a,b,c) S_reganode(aTHX_ a,b,c) -#define regatom(a,b) S_regatom(aTHX_ a,b) -#define regbranch(a,b,c) S_regbranch(aTHX_ a,b,c) +#define regatom(a,b,c) S_regatom(aTHX_ a,b,c) +#define regbranch(a,b,c,d) S_regbranch(aTHX_ a,b,c,d) #define reguni(a,b,c) S_reguni(aTHX_ a,b,c) -#define regclass(a) S_regclass(aTHX_ a) +#define regclass(a,b) S_regclass(aTHX_ a,b) #define regcurly S_regcurly #define reg_node(a,b) S_reg_node(aTHX_ a,b) -#define regpiece(a,b) S_regpiece(aTHX_ a,b) +#define regpiece(a,b,c) S_regpiece(aTHX_ a,b,c) #define reginsert(a,b,c) S_reginsert(aTHX_ a,b,c) -#define regtail(a,b,c) S_regtail(aTHX_ a,b,c) +#define regtail(a,b,c,d) S_regtail(aTHX_ a,b,c,d) +#define regtail_study(a,b,c,d) S_regtail_study(aTHX_ a,b,c,d) #define regwhite S_regwhite #define nextchar(a) S_nextchar(aTHX_ a) -#endif -# ifdef DEBUGGING -#if defined(PERL_CORE) || defined(PERL_EXT) -#define dumpuntil(a,b,c,d,e,f) S_dumpuntil(aTHX_ a,b,c,d,e,f) -#define put_byte(a,b) S_put_byte(aTHX_ a,b) -#endif -# endif -#if defined(PERL_CORE) || defined(PERL_EXT) #define scan_commit(a,b) S_scan_commit(aTHX_ a,b) #define cl_anything S_cl_anything #define cl_is_anything S_cl_is_anything @@ -3497,10 +3490,17 @@ #if defined(PERL_CORE) || defined(PERL_EXT) #define regpposixcc(a,b) S_regpposixcc(aTHX_ a,b) #define checkposixcc(a) S_checkposixcc(aTHX_ a) +#define make_trie(a,b,c,d,e,f,g) S_make_trie(aTHX_ a,b,c,d,e,f,g) #endif +# ifdef DEBUGGING #if defined(PERL_CORE) || defined(PERL_EXT) -#define make_trie(a,b,c,d,e,f) S_make_trie(aTHX_ a,b,c,d,e,f) +#define dumpuntil(a,b,c,d,e,f) S_dumpuntil(aTHX_ a,b,c,d,e,f) +#define put_byte(a,b) S_put_byte(aTHX_ a,b) +#define dump_trie(a,b) S_dump_trie(aTHX_ a,b) +#define dump_trie_interim_list(a,b,c) S_dump_trie_interim_list(aTHX_ a,b,c) +#define dump_trie_interim_table(a,b,c) S_dump_trie_interim_table(aTHX_ a,b,c) #endif +# endif #endif #if defined(PERL_IN_REGEXEC_C) || defined(PERL_DECL_PROT) #if defined(PERL_CORE) || defined(PERL_EXT) diff --git a/ext/re/t/regop.t b/ext/re/t/regop.t index 5947980..8bfacda 100644 --- a/ext/re/t/regop.t +++ b/ext/re/t/regop.t @@ -1,40 +1,39 @@ #!./perl BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; - require Config; - if (($Config::Config{'extensions'} !~ /\bre\b/) ){ - print "1..0 # Skip -- Perl configured without re module\n"; - exit 0; - } + chdir 't' if -d 't'; + @INC = '../lib'; + require Config; + if (($Config::Config{'extensions'} !~ /\bre\b/) ){ + print "1..0 # Skip -- Perl configured without re module\n"; + exit 0; + } } use strict; -use Test::More; +require "./test.pl"; chomp(my @strs=grep { !/^\s*\#/ } ); -chdir "../ext/re/t" or die "Can't chdir '../ext/re/t':$!\n"; -my $out=`$^X regop.pl 2>&1`; -my @tests=grep { /\S/ } split /(?=Compiling REx)/,$out; +my $out = runperl(progfile => "../ext/re/t/regop.pl", stderr => 1); +my @tests = grep { /\S/ && !/EXECUTING/ } split /(?=Compiling REx)/,$out; -plan tests => 2+(@strs-grep { !$_ or /^---/ } @strs)+@tests; +plan(2 + (@strs - grep { !$_ or /^---/ } @strs) + @tests); my $numtests=4; -ok(@tests==$numtests,"Expecting output for $numtests patterns"); +is(scalar @tests, $numtests, "Expecting output for $numtests patterns"); ok(defined $out,'regop.pl'); $out||=""; my $test=1; foreach my $testout (@tests) { my ($pattern)=$testout=~/Compiling REx "([^"]+)"/; - ok($pattern,"Pattern for test ".($test++)); - while (@strs) { + ok($pattern, "Pattern found for test ".($test++)); + while (@strs) { my $str=shift @strs; last if !$str or $str=~/^---/; next if $str=~/^\s*#/; - ok($testout=~/\Q$str\E/,"$str: /$pattern/"); - } -} + ok($testout=~/\Q$str\E/,"$str: /$pattern/"); + } +} __END__ #Compiling REx "X(A|[B]Q||C|D)Y" diff --git a/perl.h b/perl.h index cdb2b86..999c619 100644 --- a/perl.h +++ b/perl.h @@ -2198,6 +2198,7 @@ int isnan(double d); #endif struct RExC_state_t; +struct _reg_trie_data; typedef MEM_SIZE STRLEN; diff --git a/proto.h b/proto.h index 5063dce..5eea726 100644 --- a/proto.h +++ b/proto.h @@ -3507,18 +3507,18 @@ STATIC SV * S_space_join_names_mortal(pTHX_ char *const *array) #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_DECL_PROT) -STATIC regnode* S_reg(pTHX_ struct RExC_state_t *state, I32 paren, I32 *flagp) +STATIC regnode* S_reg(pTHX_ struct RExC_state_t *state, I32 paren, I32 *flagp, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); STATIC regnode* S_reganode(pTHX_ struct RExC_state_t *state, U8 op, U32 arg) __attribute__nonnull__(pTHX_1); -STATIC regnode* S_regatom(pTHX_ struct RExC_state_t *state, I32 *flagp) +STATIC regnode* S_regatom(pTHX_ struct RExC_state_t *state, I32 *flagp, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); -STATIC regnode* S_regbranch(pTHX_ struct RExC_state_t *state, I32 *flagp, I32 first) +STATIC regnode* S_regbranch(pTHX_ struct RExC_state_t *state, I32 *flagp, I32 first, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); @@ -3526,7 +3526,7 @@ STATIC STRLEN S_reguni(pTHX_ const struct RExC_state_t *state, UV uv, char *s) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); -STATIC regnode* S_regclass(pTHX_ struct RExC_state_t *state) +STATIC regnode* S_regclass(pTHX_ struct RExC_state_t *state, U32 depth) __attribute__nonnull__(pTHX_1); STATIC I32 S_regcurly(const char *) @@ -3536,7 +3536,7 @@ STATIC I32 S_regcurly(const char *) STATIC regnode* S_reg_node(pTHX_ struct RExC_state_t *state, U8 op) __attribute__nonnull__(pTHX_1); -STATIC regnode* S_regpiece(pTHX_ struct RExC_state_t *state, I32 *flagp) +STATIC regnode* S_regpiece(pTHX_ struct RExC_state_t *state, I32 *flagp, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); @@ -3544,7 +3544,12 @@ STATIC void S_reginsert(pTHX_ struct RExC_state_t *state, U8 op, regnode *opnd) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); -STATIC void S_regtail(pTHX_ const struct RExC_state_t *state, regnode *p, const regnode *val) +STATIC void S_regtail(pTHX_ struct RExC_state_t *state, regnode *p, const regnode *val, U32 depth) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); + +STATIC U8 S_regtail_study(pTHX_ struct RExC_state_t *state, regnode *p, const regnode *val, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); @@ -3557,17 +3562,6 @@ STATIC char* S_regwhite(char *p, const char *e) STATIC char* S_nextchar(pTHX_ struct RExC_state_t *state) __attribute__nonnull__(pTHX_1); -# ifdef DEBUGGING -STATIC const regnode* S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, const regnode *last, SV* sv, I32 l) - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2) - __attribute__nonnull__(pTHX_3) - __attribute__nonnull__(pTHX_5); - -STATIC void S_put_byte(pTHX_ SV* sv, int c) - __attribute__nonnull__(pTHX_1); - -# endif STATIC void S_scan_commit(pTHX_ const struct RExC_state_t* state, struct scan_data_t *data) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); @@ -3619,14 +3613,33 @@ STATIC I32 S_regpposixcc(pTHX_ struct RExC_state_t* state, I32 value) STATIC void S_checkposixcc(pTHX_ struct RExC_state_t* state) __attribute__nonnull__(pTHX_1); - -STATIC I32 S_make_trie(pTHX_ struct RExC_state_t* state, regnode *startbranch, regnode *first, regnode *last, regnode *tail, U32 flags) +STATIC I32 S_make_trie(pTHX_ struct RExC_state_t* state, regnode *startbranch, regnode *first, regnode *last, regnode *tail, U32 flags, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) __attribute__nonnull__(pTHX_4) __attribute__nonnull__(pTHX_5); +# ifdef DEBUGGING +STATIC const regnode* S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, const regnode *last, SV* sv, I32 l) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_5); + +STATIC void S_put_byte(pTHX_ SV* sv, int c) + __attribute__nonnull__(pTHX_1); + +STATIC void S_dump_trie(pTHX_ const struct _reg_trie_data *trie, U32 depth) + __attribute__nonnull__(pTHX_1); + +STATIC void S_dump_trie_interim_list(pTHX_ const struct _reg_trie_data *trie, U32 next_alloc, U32 depth) + __attribute__nonnull__(pTHX_1); + +STATIC void S_dump_trie_interim_table(pTHX_ const struct _reg_trie_data *trie, U32 next_alloc, U32 depth) + __attribute__nonnull__(pTHX_1); + +# endif #endif #if defined(PERL_IN_REGEXEC_C) || defined(PERL_DECL_PROT) diff --git a/regcomp.c b/regcomp.c index 6f56929..8f21f8e 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1022,12 +1022,12 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs SV *re_trie_maxbuff; #ifndef DEBUGGING /* these are only used during construction but are useful during - debugging so we store them in the struct when debugging. - Wordcount is actually superfluous in debugging as we have - (AV*)trie->words to use for it, but thats not available when - not debugging... We could make the macro use the AV during - debugging tho... - */ + * debugging so we store them in the struct when debugging. + * Wordcount is actually superfluous in debugging as we have + * (AV*)trie->words to use for it, but that's not available when + * not debugging... We could make the macro use the AV during + * debugging though... + */ U16 trie_wordcount=0; STRLEN trie_charcount=0; U32 trie_laststate=0; @@ -1563,61 +1563,63 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs if ( trie->bitmap && !trie->widecharmap ) { U32 state; DEBUG_OPTIMISE_r( - PerlIO_printf( Perl_debug_log,"%*sLaststate:%d\n", - (int)depth * 2 + 2,"", - TRIE_LASTSTATE(trie))); - for( state= 1 ; state < TRIE_LASTSTATE(trie)-1 ; state++ ) { + PerlIO_printf(Perl_debug_log, "%*sLaststate:%"UVuf"\n", + (int)depth * 2 + 2, "", + TRIE_LASTSTATE(trie)) + ); + for ( state = 1 ; state < TRIE_LASTSTATE(trie)-1 ; state++ ) { U32 ofs = 0; - I32 idx= -1; - U32 count= 0; - const U32 base= trie->states[ state ].trans.base; + I32 idx = -1; + U32 count = 0; + const U32 base = trie->states[ state ].trans.base; if ( trie->states[state].wordnum ) - count =1; - - for ( ofs= 0 ; ofs < trie->uniquecharcount ; ofs++ ) - { + count = 1; + for ( ofs = 0 ; ofs < trie->uniquecharcount ; ofs++ ) { if ( ( base + ofs >= trie->uniquecharcount ) && ( base + ofs - trie->uniquecharcount < trie->lasttrans ) && trie->trans[ base + ofs - trie->uniquecharcount ].check == state ) { if ( ++count > 1 ) { - SV **tmp= av_fetch( TRIE_REVCHARMAP(trie), ofs, 0); - const char *ch= SvPV_nolen_const( *tmp ); - if (state==1) break; + SV **tmp = av_fetch( TRIE_REVCHARMAP(trie), ofs, 0); + const char *ch = SvPV_nolen_const( *tmp ); + if ( state == 1 ) break; if ( count == 2 ) { Zero(trie->bitmap, ANYOF_BITMAP_SIZE, char); DEBUG_OPTIMISE_r( - PerlIO_printf( Perl_debug_log,"%*sNew Start State=%d Class: [", - (int)depth * 2 + 2,"", + PerlIO_printf(Perl_debug_log, + "%*sNew Start State=%"UVuf" Class: [", + (int)depth * 2 + 2, "", state)); if (idx>-1) { - SV **tmp= av_fetch( TRIE_REVCHARMAP(trie), idx, 0); - const char *ch= SvPV_nolen_const( *tmp ); - + SV **tmp = av_fetch( TRIE_REVCHARMAP(trie), idx, 0); + const char *ch = SvPV_nolen_const( *tmp ); + TRIE_BITMAP_SET(trie,*ch); - if ( folder ) - TRIE_BITMAP_SET(trie,folder[ *ch ]); + if ( folder ) + TRIE_BITMAP_SET(trie, folder[ *ch ]); DEBUG_OPTIMISE_r( - PerlIO_printf( Perl_debug_log,"%s", ch) + PerlIO_printf(Perl_debug_log, ch) ); - } - } - TRIE_BITMAP_SET(trie,*ch); - if ( folder ) TRIE_BITMAP_SET(trie,folder[ *ch ]); - DEBUG_OPTIMISE_r(PerlIO_printf( Perl_debug_log,"%s", ch)); - } - idx= ofs; - } + } + } + TRIE_BITMAP_SET(trie,*ch); + if ( folder ) + TRIE_BITMAP_SET(trie,folder[ *ch ]); + DEBUG_OPTIMISE_r(PerlIO_printf( Perl_debug_log,"%s", ch)); + } + idx = ofs; + } } if ( count == 1 ) { SV **tmp = av_fetch( TRIE_REVCHARMAP(trie), idx, 0); - const char *ch= SvPV_nolen_const( *tmp ); + const char *ch = SvPV_nolen_const( *tmp ); DEBUG_OPTIMISE_r( - PerlIO_printf( Perl_debug_log,"%*sPrefix State: %d Idx:%d Char='%s'\n", - (int)depth * 2 + 2,"", - state, idx, ch) + PerlIO_printf( Perl_debug_log, + "%*sPrefix State: %"UVuf" Idx:%"UVuf" Char='%s'\n", + (int)depth * 2 + 2, "", + state, idx, ch) ); if ( state==1 ) { OP( convert ) = nodetype; @@ -1627,29 +1629,29 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs *str++=*ch; STR_LEN(convert)++; - } else { - if (state>1) - DEBUG_OPTIMISE_r(PerlIO_printf( Perl_debug_log,"]\n")); - break; - } - } + } else { + if (state>1) + DEBUG_OPTIMISE_r(PerlIO_printf( Perl_debug_log,"]\n")); + break; + } + } if (str) { - regnode *n= convert+NODE_SZ_STR(convert); + regnode *n = convert+NODE_SZ_STR(convert); NEXT_OFF(convert)= NODE_SZ_STR(convert); - trie->startstate= state; + trie->startstate = state; trie->minlen-= (state-1); trie->maxlen-= (state-1); - if (trie->maxlen) - convert= n; - else { + if (trie->maxlen) { + convert = n; + } else { NEXT_OFF(convert) = (U16)(tail - convert); } } } if ( trie->maxlen ) { OP( convert ) = TRIE; - NEXT_OFF( convert ) = (U16)(tail - convert); - ARG_SET( convert, data_slot ); + NEXT_OFF( convert ) = (U16)(tail - convert); + ARG_SET( convert, data_slot ); /* store the type in the flags */ convert->flags = nodetype; @@ -1709,11 +1711,10 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, I32 *deltap, GET_RE_DEBUG_FLAGS_DECL; -PEEP: while (scan && OP(scan) != END && scan < last) { - #ifdef DEBUGGING +#ifdef DEBUGGING int merged=0; - #endif +#endif /* Peephole optimizer: */ DEBUG_OPTIMISE_r({ SV * const mysv=sv_newmortal(); @@ -3422,7 +3423,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm) else \ PerlIO_printf(Perl_debug_log,"%4s",""); \ PerlIO_printf(Perl_debug_log,"%*s%-4s", \ - 10+(depth*2),"", \ + (int)(10+(depth*2)), "", \ (funcname) \ ); \ RExC_lastnum=num; \ @@ -3953,7 +3954,6 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) register char *next; I32 flags; const char * const origparse = RExC_parse; - char *maxpos; I32 min; I32 max = REG_INFTY; char *parse_start; @@ -6567,11 +6567,11 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, l--; next = regnext((regnode *)node); /* Where, what. */ - if ( OP(node) == OPTIMIZED) { + if (OP(node) == OPTIMIZED) { if (!optstart && (SvIV(re_debug_flags) & RE_DEBUG_OPTIMISE)) - optstart= node; + optstart = node; else - goto after_print; + goto after_print; } else CLEAR_OPTSTART; regprop(r, sv, node); @@ -6579,11 +6579,11 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, (int)(2*l + 1), "", SvPVX_const(sv)); if (OP(node) != OPTIMIZED) { - if (next == NULL) /* Next ptr. */ - PerlIO_printf(Perl_debug_log, "(0)"); - else - PerlIO_printf(Perl_debug_log, "(%"IVdf")", (IV)(next - start)); - (void)PerlIO_putc(Perl_debug_log, '\n'); + if (next == NULL) /* Next ptr. */ + PerlIO_printf(Perl_debug_log, "(0)"); + else + PerlIO_printf(Perl_debug_log, "(%"IVdf")", (IV)(next - start)); + (void)PerlIO_putc(Perl_debug_log, '\n'); } after_print: @@ -6604,16 +6604,16 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, const I32 arry_len = av_len(trie->words)+1; I32 word_idx; PerlIO_printf(Perl_debug_log, - "%*s[Start:%d Words:%d Chars:%d Unique:%d States:%"IVdf" Minlen:%d Maxlen:%d", - (int)(2*(l+3)), - "", - trie->startstate, - TRIE_WORDCOUNT(trie), - (int)TRIE_CHARCOUNT(trie), - trie->uniquecharcount, - (IV)TRIE_LASTSTATE(trie)-1, - trie->minlen, trie->maxlen - ); + "%*s[Start:%"UVuf" Words:%d Chars:%d Unique:%d States:%"IVdf" Minlen:%d Maxlen:%d", + (int)(2*(l+3)), + "", + trie->startstate, + TRIE_WORDCOUNT(trie), + (int)TRIE_CHARCOUNT(trie), + trie->uniquecharcount, + (IV)TRIE_LASTSTATE(trie)-1, + trie->minlen, trie->maxlen + ); if (trie->bitmap) { int i; int rangestart= -1; diff --git a/regcomp.h b/regcomp.h index 62e7691..553baea 100644 --- a/regcomp.h +++ b/regcomp.h @@ -442,7 +442,7 @@ typedef struct _reg_trie_trans reg_trie_trans; /* anything in here that needs to be freed later -should be dealt with in pregfree */ + should be dealt with in pregfree */ struct _reg_trie_data { U16 uniquecharcount; U32 lasttrans; @@ -453,8 +453,8 @@ struct _reg_trie_data { char *bitmap; U32 refcount; U32 startstate; - STRLEN minlen; - STRLEN maxlen; + STRLEN minlen; + STRLEN maxlen; #ifdef DEBUGGING U16 wordcount; /* Build only */ STRLEN charcount; /* Build only */ diff --git a/regexec.c b/regexec.c index 535bb74..5b8f244 100644 --- a/regexec.c +++ b/regexec.c @@ -104,10 +104,10 @@ ? reghop3((U8*)pos, off, (U8*)(off >= 0 ? PL_regeol : PL_bostr)) \ : (U8*)(pos + off)) #define HOPBACKc(pos, off) \ - (char*)(PL_reg_match_utf8\ + (char*)(PL_reg_match_utf8 \ ? reghopmaybe3((U8*)pos, -off, (U8*)PL_bostr) \ - : (pos - off >= PL_bostr) \ - ? pos - off \ + : (pos - off >= PL_bostr) \ + ? (U8*)pos - off \ : NULL) #define HOP3(pos,off,lim) (PL_reg_match_utf8 ? reghop3((U8*)pos, off, (U8*)lim) : (U8*)(pos + off)) diff --git a/regnodes.h b/regnodes.h index 56a113d..312530d 100644 --- a/regnodes.h +++ b/regnodes.h @@ -66,9 +66,9 @@ #define LOGICAL 59 /* 0x3b Next opcode should set the flag only. */ #define RENUM 60 /* 0x3c Group with independently numbered parens. */ #define OPTIMIZED 61 /* 0x3d Placeholder for dump. */ -#define TRIE 62 /* 0x3e Match one or more of many EXACT strings */ -#define TRIEF 63 /* 0x3f Match one or more of many EXACTF strings */ -#define TRIEFL 64 /* 0x40 Match one or more of many EXACTFL strings */ +#define TRIE 62 /* 0x3e Match many EXACT(FL?)? at once. flags==type */ +#define TRIEC 63 /* 0x3f Trie + charclass. (unused at present) */ +#define PSEUDO 64 /* 0x40 Pseudo opcode for internal use. */ #ifndef DOINIT EXTCONST U8 PL_regkind[]; @@ -137,8 +137,8 @@ EXTCONST U8 PL_regkind[] = { BRANCHJ, /* RENUM */ NOTHING, /* OPTIMIZED */ TRIE, /* TRIE */ - TRIE, /* TRIEF */ - TRIE, /* TRIEFL */ + TRIE, /* TRIEC */ + PSEUDO, /* PSEUDO */ }; #endif @@ -208,8 +208,8 @@ static const U8 regarglen[] = { EXTRA_SIZE(struct regnode_1), /* RENUM */ 0, /* OPTIMIZED */ EXTRA_SIZE(struct regnode_1), /* TRIE */ - EXTRA_SIZE(struct regnode_1), /* TRIEF */ - EXTRA_SIZE(struct regnode_1), /* TRIEFL */ + EXTRA_SIZE(struct regnode_1), /* TRIEC */ + 0, /* PSEUDO */ }; static const char reg_off_by_arg[] = { @@ -276,8 +276,8 @@ static const char reg_off_by_arg[] = { 1, /* RENUM */ 0, /* OPTIMIZED */ 0, /* TRIE */ - 0, /* TRIEF */ - 0, /* TRIEFL */ + 0, /* TRIEC */ + 0, /* PSEUDO */ }; #ifdef DEBUGGING @@ -345,8 +345,8 @@ static const char * const reg_name[] = { "RENUM", /* 0x3c */ "OPTIMIZED", /* 0x3d */ "TRIE", /* 0x3e */ - "TRIEF", /* 0x3f */ - "TRIEFL", /* 0x40 */ + "TRIEC", /* 0x3f */ + "PSEUDO", /* 0x40 */ }; static const int reg_num = 65;