|NN regnode *source|NN regnode *stclass \
|U32 depth
# ifdef DEBUGGING
+Es |void |regdump_intflags|NULLOK const char *lead| const U32 flags
Es |void |regdump_extflags|NULLOK const char *lead| const U32 flags
Es |const regnode*|dumpuntil|NN const regexp *r|NN const regnode *start \
|NN const regnode *node \
#define dumpuntil(a,b,c,d,e,f,g,h) S_dumpuntil(aTHX_ a,b,c,d,e,f,g,h)
#define put_byte(a,b) S_put_byte(aTHX_ a,b)
#define regdump_extflags(a,b) S_regdump_extflags(aTHX_ a,b)
+#define regdump_intflags(a,b) S_regdump_intflags(aTHX_ a,b)
#define regtail_study(a,b,c,d) S_regtail_study(aTHX_ a,b,c,d)
# endif
# if defined(PERL_IN_REGEXEC_C)
assert(sv)
STATIC void S_regdump_extflags(pTHX_ const char *lead, const U32 flags);
+STATIC void S_regdump_intflags(pTHX_ const char *lead, const U32 flags);
STATIC U8 S_regtail_study(pTHX_ struct RExC_state_t *pRExC_state, regnode *p, const regnode *val, U32 depth)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2)
- regdump - dump a regexp onto Perl_debug_log in vaguely comprehensible form
*/
#ifdef DEBUGGING
+
+static void
+S_regdump_intflags(pTHX_ const char *lead, const U32 flags)
+{
+ int bit;
+ int set=0;
+ regex_charset cs;
+
+ for (bit=0; bit<32; bit++) {
+ if (flags & (1<<bit)) {
+ if (!set++ && lead)
+ PerlIO_printf(Perl_debug_log, "%s",lead);
+ PerlIO_printf(Perl_debug_log, "%s ",PL_reg_intflags_name[bit]);
+ }
+ }
+ if (lead) {
+ if (set)
+ PerlIO_printf(Perl_debug_log, "\n");
+ else
+ PerlIO_printf(Perl_debug_log, "%s[none-set]\n",lead);
+ }
+}
+
static void
S_regdump_extflags(pTHX_ const char *lead, const U32 flags)
{
if (r->extflags & RXf_EVAL_SEEN)
PerlIO_printf(Perl_debug_log, "with eval ");
PerlIO_printf(Perl_debug_log, "\n");
- DEBUG_FLAGS_r(regdump_extflags("r->extflags: ",r->extflags));
+ DEBUG_FLAGS_r({
+ regdump_extflags("r->extflags: ",r->extflags);
+ regdump_intflags("r->intflags: ",r->intflags);
+ });
#else
PERL_ARGS_ASSERT_REGDUMP;
PERL_UNUSED_CONTEXT;
};
#endif /* DOINIT */
+EOP
+
+{
+print $out <<EOP;
/* PL_reg_extflags_name[] - Opcode/state names in string form, for debugging */
#ifndef DOINIT
# optional leading '_'. Return symbol in $1, and strip it from
# rest of line
- if (s/ \# \s* define \s+ ( _? RXf_ \w+ ) \s+ //xi) {
+ if (s/^ \# \s* define \s+ ( _? RXf_ \w+ ) \s+ //xi) {
chomp;
my $define = $1;
my $orig= $_;
#endif /* DOINIT */
EOP
+}
+{
+print $out <<EOP;
+/* PL_reg_intflags_name[] - Opcode/state names in string form, for debugging */
+
+#ifndef DOINIT
+EXTCONST char * PL_reg_intflags_name[];
+#else
+EXTCONST char * const PL_reg_intflags_name[] = {
+EOP
+
+my %rxfv;
+my %definitions; # Remember what the symbol definitions are
+my $val = 0;
+my %reverse;
+foreach my $file ("regcomp.h") {
+ open my $fh, "<", $file or die "Can't read $file: $!";
+ while (<$fh>) {
+ # optional leading '_'. Return symbol in $1, and strip it from
+ # rest of line
+ if (m/^ \# \s* define \s+ ( PREGf_ ( \w+ ) ) \s+ 0x([0-9a-f]+)(?:\s*\/\*(.*)\*\/)?/xi) {
+ chomp;
+ my $define = $1;
+ my $abbr= $2;
+ my $hex= $3;
+ my $comment= $4;
+ my $val= hex($hex);
+ $comment= $comment ? " - $comment" : "";
+
+ printf $out qq(\t%-30s/* 0x%08x - %s%s */\n), qq("$abbr",), $val, $define, $comment;
+ }
+ }
+}
+
+print $out <<EOP;
+};
+#endif /* DOINIT */
+
+EOP
+}
+
print $out process_flags('V', 'varies', <<'EOC');
/* The following have no fixed length. U8 so we can do strchr() on it. */
};
#endif /* DOINIT */
+/* PL_reg_intflags_name[] - Opcode/state names in string form, for debugging */
+
+#ifndef DOINIT
+EXTCONST char * PL_reg_intflags_name[];
+#else
+EXTCONST char * const PL_reg_intflags_name[] = {
+ "SKIP", /* 0x00000001 - PREGf_SKIP */
+ "IMPLICIT", /* 0x00000002 - PREGf_IMPLICIT - Converted .* to ^.* */
+ "NAUGHTY", /* 0x00000004 - PREGf_NAUGHTY - how exponential is this pattern? */
+ "VERBARG_SEEN", /* 0x00000008 - PREGf_VERBARG_SEEN */
+ "CUTGROUP_SEEN", /* 0x00000010 - PREGf_CUTGROUP_SEEN */
+ "USE_RE_EVAL", /* 0x00000020 - PREGf_USE_RE_EVAL - compiled with "use re 'eval'" */
+};
+#endif /* DOINIT */
+
/* The following have no fixed length. U8 so we can do strchr() on it. */
#define REGNODE_VARIES(node) (PL_varies_bitmask[(node) >> 3] & (1 << ((node) & 7)))