This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcharclass.h: Add macro for finding pattern white space
authorKarl Williamson <public@khwilliamson.com>
Mon, 7 Jan 2013 15:50:56 +0000 (08:50 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 11 Jan 2013 18:50:36 +0000 (11:50 -0700)
This Unicode property will be used in future commits

regcharclass.h
regen/regcharclass.pl

index 1c0952c..b41fbbb 100644 (file)
     : ( ( ( ((U8*)s)[0] & 0xDF ) == 0x53 ) && ( ( ( ((U8*)s)[1] & 0xDF ) == 0x53 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x54 ) ) ) ? 2 : 0 )\
 : 0 )
 
     : ( ( ( ((U8*)s)[0] & 0xDF ) == 0x53 ) && ( ( ( ((U8*)s)[1] & 0xDF ) == 0x53 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x54 ) ) ) ? 2 : 0 )\
 : 0 )
 
+/*
+       PATWS: pattern white space
+
+       \p{PatWS}
+*/
+/*** GENERATED CODE ***/
+#define is_PATWS(s,is_utf8)                                                 \
+( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\
+: ( is_utf8 ) ?                                                             \
+    ( ( 0xC2 == ((U8*)s)[0] ) ?                                             \
+       ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 )                                 \
+    : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0x8E || ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\
+: ( 0x85 == ((U8*)s)[0] ) )
+
+/*** GENERATED CODE ***/
+#define is_PATWS_safe(s,e,is_utf8)                                          \
+( ((e)-(s) > 2) ?                                                           \
+    ( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\
+    : ( is_utf8 ) ?                                                         \
+       ( ( 0xC2 == ((U8*)s)[0] ) ?                                         \
+           ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 )                             \
+       : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0x8E || ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\
+    : ( 0x85 == ((U8*)s)[0] ) )                                             \
+: ((e)-(s) > 1) ?                                                           \
+    ( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\
+    : ( is_utf8 ) ?                                                         \
+       ( ( ( 0xC2 == ((U8*)s)[0] ) && ( 0x85 == ((U8*)s)[1] ) ) ? 2 : 0 )  \
+    : ( 0x85 == ((U8*)s)[0] ) )                                             \
+: ((e)-(s) > 0) ?                                                           \
+    ( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\
+    : ( !( is_utf8 ) ) ?                                                    \
+       ( 0x85 == ((U8*)s)[0] )                                             \
+    : 0 )                                                                   \
+: 0 )
+
+/*** GENERATED CODE ***/
+#define is_PATWS_cp(cp)                                                     \
+( ( 0x09 <= cp && cp <= 0x0D ) || ( 0x0D < cp &&                            \
+( 0x20 == cp || ( 0x20 < cp &&                                              \
+( 0x85 == cp || ( 0x85 < cp &&                                              \
+( 0x200E == cp || ( 0x200E < cp &&                                          \
+( 0x200F == cp || ( 0x200F < cp &&                                          \
+( 0x2028 == cp || 0x2029 == cp ) ) ) ) ) ) ) ) ) ) )
+
 
 #endif /* H_REGCHARCLASS */
 
 
 #endif /* H_REGCHARCLASS */
 
index 3863025..9c453e2 100755 (executable)
@@ -1488,3 +1488,7 @@ MULTI_CHAR_FOLD: multi-char strings that are folded to by a single character
 
 &regcharclass_multi_char_folds::multi_char_folds(0)
 # 0 => Latin1-only
 
 &regcharclass_multi_char_folds::multi_char_folds(0)
 # 0 => Latin1-only
+
+PATWS: pattern white space
+=> generic cp : fast safe
+\p{PatWS}