This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #79914] documentation bug in perldoc perlvar $|
[perl5.git] / regcomp.h
index 3ab984b..6dc05f5 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -319,14 +319,24 @@ struct regnode_charclass_class {
 #define ANYOF_INVERT           0x04
 
 /* CLASS is never set unless LOCALE is too: has runtime \d, \w, [:posix:], ... */
-#define ANYOF_CLASS            0x08
+#define ANYOF_CLASS     0x08
 #define ANYOF_LARGE      ANYOF_CLASS    /* Same; name retained for back compat */
 
-/* EOS used for regstclass only */
-#define ANYOF_EOS              0x10    /* Can match an empty string too */
+/* Can match something outside the bitmap that is expressible only in utf8 */
+#define ANYOF_UTF8             0x10
+
+/* Can match something outside the bitmap that isn't in utf8 */
+#define ANYOF_NONBITMAP_NON_UTF8 0x20
+
+/* Set if the bitmap doesn't fully represent what this node can match */
+#define ANYOF_NONBITMAP                (ANYOF_UTF8|ANYOF_NONBITMAP_NON_UTF8)
+#define ANYOF_UNICODE          ANYOF_NONBITMAP /* old name, for back compat */
 
-#define ANYOF_UNICODE          0x20    /* Matches >= one thing past 0xff */
-#define ANYOF_UNICODE_ALL      0x40    /* Matches 0x100 - infinity */
+/* Matches every code point 0x100 and above*/
+#define ANYOF_UNICODE_ALL      0x40
+
+/* EOS used for regstclass only */
+#define ANYOF_EOS              0x80    /* Can match an empty string too */
 
 #define ANYOF_FLAGS_ALL                0xff
 
@@ -396,6 +406,12 @@ struct regnode_charclass_class {
 #define ANYOF_CLASS_CLEAR(p, c)        (ANYOF_CLASS_BYTE(p, c) &= ~ANYOF_BIT(c))
 #define ANYOF_CLASS_TEST(p, c) (ANYOF_CLASS_BYTE(p, c) &   ANYOF_BIT(c))
 
+/* Quicker way to see if there are actually any tests.  This is because
+ * currently the set of tests can be empty even when the class bitmap is
+ * allocated */
+#define ANYOF_CLASS_TEST_ANY_SET(p)    /* assumes sizeof(p) = 4 */       \
+       memNE (((struct regnode_charclass_class*)(p))->classflags, "0000", ANYOF_CLASS_SIZE)
+
 #define ANYOF_CLASS_ZERO(ret)  Zero(((struct regnode_charclass_class*)(ret))->classflags, ANYOF_CLASSBITMAP_SIZE, char)
 #define ANYOF_BITMAP_ZERO(ret) Zero(((struct regnode_charclass*)(ret))->bitmap, ANYOF_BITMAP_SIZE, char)
 
@@ -410,7 +426,7 @@ struct regnode_charclass_class {
 #define ANYOF_BITMAP_CLEARALL(p)       \
        Zero (ANYOF_BITMAP(p), ANYOF_BITMAP_SIZE)
 /* Check that all 256 bits are all set.  Used in S_cl_is_anything()  */
-#define ANYOF_BITMAP_TESTALLSET(p)     \
+#define ANYOF_BITMAP_TESTALLSET(p)     /* Assumes sizeof(p) == 32 */     \
        memEQ (ANYOF_BITMAP(p), "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377", ANYOF_BITMAP_SIZE)
 
 #define ANYOF_SKIP             ((ANYOF_SIZE - 1)/sizeof(regnode))