This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
in-place sort preserved element lvalue identity
[perl5.git] / regcomp.h
index f7c8cc4..ec0c9f8 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -90,8 +90,6 @@
 /* This is the stuff that used to live in regexp.h that was truly
    private to the engine itself. It now lives here. */
 
-
-
  typedef struct regexp_internal {
         int name_list_idx;     /* Optional data index of an array of paren names */
         union {
 #define PREGf_ANCH_MBOL         0x00000400
 #define PREGf_ANCH_SBOL         0x00000800
 #define PREGf_ANCH_GPOS         0x00001000
+#define PREGf_RECURSE_SEEN      0x00002000
 
 #define PREGf_ANCH              \
     ( PREGf_ANCH_SBOL | PREGf_ANCH_GPOS | PREGf_ANCH_MBOL )
@@ -369,7 +368,7 @@ struct regnode_ssc {
 
 #define REG_MAGIC 0234
 
-#define SIZE_ONLY (RExC_emit == (regnode *) & RExC_emit_dummy)
+#define SIZE_ONLY cBOOL(RExC_emit == (regnode *) & RExC_emit_dummy)
 #define PASS1 SIZE_ONLY
 #define PASS2 (! SIZE_ONLY)
 
@@ -523,7 +522,7 @@ struct regnode_ssc {
                |ANYOFL_SHARED_UTF8_LOCALE_fold_HAS_MATCHES_nonfold_REQD))   \
              == ANYOFL_SHARED_UTF8_LOCALE_fold_HAS_MATCHES_nonfold_REQD)
 
-/* Spare:                                       0x10 */
+/* Spare: Be sure to change ANYOF_FLAGS_ALL if this gets used  0x10 */
 
 /* If set, the node matches every code point NUM_ANYOF_CODE_POINTS and above.
  * Can be in an SSC */
@@ -553,7 +552,7 @@ struct regnode_ssc {
  * are cautioned about its shared nature */
 #define ANYOF_SHARED_d_MATCHES_ALL_NON_UTF8_NON_ASCII_non_d_WARN_SUPER 0x80
 
-#define ANYOF_FLAGS_ALL                (0xff)
+#define ANYOF_FLAGS_ALL                (0xff & ~0x10)
 
 #define ANYOF_LOCALE_FLAGS (ANYOFL_FOLD | ANYOF_MATCHES_POSIXL)
 
@@ -680,9 +679,9 @@ struct regnode_ssc {
 
 #define ANYOF_POSIXL_AND(source, dest) STMT_START { (dest)->classflags &= (source)->classflags ; } STMT_END
 
-#define ANYOF_BITMAP_ZERO(ret) Zero(((struct regnode_charclass*)(ret))->bitmap, ANYOF_BITMAP_SIZE, char)
-#define ANYOF_BITMAP(p)                (((struct regnode_charclass*)(p))->bitmap)
-#define ANYOF_BITMAP_BYTE(p, c)        (ANYOF_BITMAP(p)[(((U8)(c)) >> 3) & 31])
+#define ANYOF_BITMAP_ZERO(ret) Zero(((regnode_charclass*)(ret))->bitmap, ANYOF_BITMAP_SIZE, char)
+#define ANYOF_BITMAP(p)                ((regnode_charclass*)(p))->bitmap
+#define ANYOF_BITMAP_BYTE(p, c)        BITMAP_BYTE(ANYOF_BITMAP(p), c)
 #define ANYOF_BITMAP_SET(p, c) (ANYOF_BITMAP_BYTE(p, c) |=  ANYOF_BIT(c))
 #define ANYOF_BITMAP_CLEAR(p,c)        (ANYOF_BITMAP_BYTE(p, c) &= ~ANYOF_BIT(c))
 #define ANYOF_BITMAP_TEST(p, c)        cBOOL(ANYOF_BITMAP_BYTE(p, c) &   ANYOF_BIT(c))
@@ -692,7 +691,7 @@ struct regnode_ssc {
 #define ANYOF_BITMAP_CLEARALL(p)       \
        Zero (ANYOF_BITMAP(p), ANYOF_BITMAP_SIZE)
 
-#define ANYOF_SKIP             EXTRA_SIZE(struct regnode_charclass)
+#define ANYOF_SKIP             EXTRA_SIZE(regnode_charclass)
 #define ANYOF_POSIXL_SKIP      EXTRA_SIZE(regnode_charclass_posixl)
 
 /*
@@ -716,7 +715,7 @@ struct regnode_ssc {
 #define REG_CUTGROUP_SEEN                   0x00000100
 #define REG_RUN_ON_COMMENT_SEEN             0x00000200
 #define REG_UNFOLDED_MULTI_SEEN             0x00000400
-#define REG_GOSTART_SEEN                    0x00000800
+/* spare */
 #define REG_UNBOUNDED_QUANTIFIER_SEEN       0x00001000
 
 
@@ -908,7 +907,7 @@ typedef struct _reg_ac_data reg_ac_data;
    three different sets... */
 
 #define TRIE_BITMAP(p)         (((reg_trie_data *)(p))->bitmap)
-#define TRIE_BITMAP_BYTE(p, c) (TRIE_BITMAP(p)[(((U8)(c)) >> 3) & 31])
+#define TRIE_BITMAP_BYTE(p, c) BITMAP_BYTE(TRIE_BITMAP(p), c)
 #define TRIE_BITMAP_SET(p, c)  (TRIE_BITMAP_BYTE(p, c) |=  ANYOF_BIT((U8)c))
 #define TRIE_BITMAP_CLEAR(p,c) (TRIE_BITMAP_BYTE(p, c) &= ~ANYOF_BIT((U8)c))
 #define TRIE_BITMAP_TEST(p, c) (TRIE_BITMAP_BYTE(p, c) &   ANYOF_BIT((U8)c))
@@ -917,7 +916,7 @@ typedef struct _reg_ac_data reg_ac_data;
 #define IS_TRIE_AC(op) ((op)>=AHOCORASICK)
 
 
-#define BITMAP_BYTE(p, c)      (((U8*)p)[(((U8)(c)) >> 3) & 31])
+#define BITMAP_BYTE(p, c)      (( (U8*) p) [ ( ( (UV) (c)) >> 3) ] )
 #define BITMAP_TEST(p, c)      (BITMAP_BYTE(p, c) &   ANYOF_BIT((U8)c))
 
 /* these defines assume uniquecharcount is the correct variable, and state may be evaluated twice */
@@ -1055,7 +1054,7 @@ re.pm, especially to the documentation.
 /* get_sv() can return NULL during global destruction. */
 #define GET_RE_DEBUG_FLAGS DEBUG_r({ \
         SV * re_debug_flags_sv = NULL; \
-        re_debug_flags_sv = get_sv(RE_DEBUG_FLAGS, 1); \
+        re_debug_flags_sv = PL_curcop ? get_sv(RE_DEBUG_FLAGS, GV_ADD) : NULL; \
         if (re_debug_flags_sv) { \
             if (!SvIOK(re_debug_flags_sv)) \
                 sv_setuv(re_debug_flags_sv, RE_DEBUG_COMPILE_DUMP | RE_DEBUG_EXECUTE_MASK ); \
@@ -1069,22 +1068,25 @@ re.pm, especially to the documentation.
         PERL_UNUSED_VAR(re_debug_flags); GET_RE_DEBUG_FLAGS;
 
 #define RE_PV_COLOR_DECL(rpv,rlen,isuni,dsv,pv,l,m,c1,c2) \
-    const char * const rpv =                          \
-        pv_pretty((dsv), (pv), (l), (m), \
-            PL_colors[(c1)],PL_colors[(c2)], \
+    const char * const rpv =                                 \
+        pv_pretty((dsv), (pv), (l),                          \
+            (PL_dump_re_max_len) ? PL_dump_re_max_len : (m), \
+            PL_colors[(c1)],PL_colors[(c2)],                 \
             PERL_PV_ESCAPE_RE|PERL_PV_ESCAPE_NONASCII |((isuni) ? PERL_PV_ESCAPE_UNI : 0) );         \
     const int rlen = SvCUR(dsv)
 
-#define RE_SV_ESCAPE(rpv,isuni,dsv,sv,m) \
-    const char * const rpv =                          \
-        pv_pretty((dsv), (SvPV_nolen_const(sv)), (SvCUR(sv)), (m), \
-            PL_colors[(c1)],PL_colors[(c2)], \
+#define RE_SV_ESCAPE(rpv,isuni,dsv,sv,m)                        \
+    const char * const rpv =                                    \
+        pv_pretty((dsv), (SvPV_nolen_const(sv)), (SvCUR(sv)),   \
+            (PL_dump_re_max_len) ? PL_dump_re_max_len : (m),    \
+            PL_colors[(c1)],PL_colors[(c2)],                    \
             PERL_PV_ESCAPE_RE|PERL_PV_ESCAPE_NONASCII |((isuni) ? PERL_PV_ESCAPE_UNI : 0) )
 
 #define RE_PV_QUOTED_DECL(rpv,isuni,dsv,pv,l,m)                    \
     const char * const rpv =                                       \
-        pv_pretty((dsv), (pv), (l), (m), \
-            PL_colors[0], PL_colors[1], \
+        pv_pretty((dsv), (pv), (l),                                \
+            (PL_dump_re_max_len) ? PL_dump_re_max_len : (m),       \
+            PL_colors[0], PL_colors[1],                            \
             ( PERL_PV_PRETTY_QUOTE | PERL_PV_ESCAPE_RE | PERL_PV_ESCAPE_NONASCII | PERL_PV_PRETTY_ELLIPSES | \
               ((isuni) ? PERL_PV_ESCAPE_UNI : 0))                  \
         )
@@ -1106,6 +1108,7 @@ re.pm, especially to the documentation.
 typedef enum {
        TRADITIONAL_BOUND = _CC_WORDCHAR,
        GCB_BOUND,
+       LB_BOUND,
        SB_BOUND,
        WB_BOUND
 } bound_type;