summaryrefslogtreecommitdiff
path: root/regcomp.h
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-11-25 19:40:12 -0700
committerKarl Williamson <public@khwilliamson.com>2013-12-31 08:27:20 -0700
commitae98608918f0b92985b47a5ac2987ebd9797be4c (patch)
tree040697220e48491e0e5999b96116a2c0b69a0e40 /regcomp.h
parenteff8b7dc9a14f3aa38ddb85d01d614da4c6d8957 (diff)
downloadperl-ae98608918f0b92985b47a5ac2987ebd9797be4c.tar.gz
Convert regnode to a flag for [...]
Prior to this commit, there were 3 types of ANYOF nodes; now there are two: regular, and one for the synthetic start class (ssc). This commit converted the third type dealing with warning about matching \p{} against non-Unicode code points, into using the spare flag bit for ANYOF nodes. This allows this bit to apply to ssc ANYOF nodes, whereas previously it couldn't. There is a bug in which the warning isn't raised if the match is rejected by the optimizer, because of this inability. This bug will be fixed in a later commit. Another option would have been to create a new node-type which was an ANYOF_SSC_WARN_SUPER node. But this adds extra complications to things; and we have a spare bit that we might as well use. The comments give better possibilities for freeing up 2 bits should they be needed.
Diffstat (limited to 'regcomp.h')
-rw-r--r--regcomp.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/regcomp.h b/regcomp.h
index fb24579403..d87865fcd6 100644
--- a/regcomp.h
+++ b/regcomp.h
@@ -314,8 +314,8 @@ struct regnode_ssc {
* ANYOF_NONBITMAP_NON_UTF8 bit is also set. */
#define ANYOF_NONBITMAP(node) (ARG(node) != ANYOF_NONBITMAP_EMPTY)
-/* Flags for node->flags of ANYOF. These are in short supply, but there is one
- * currently available. If more than this are needed, the ANYOF_LOCALE and
+/* Flags for node->flags of ANYOF. These are in short supply, with none
+ * currently available. If more are needed, the ANYOF_LOCALE and
* ANYOF_POSIXL bits could be shared, making a space penalty for all locale
* nodes. Also, the ABOVE_LATIN1_ALL bit could be freed up by resorting to
* creating a swash containing everything above 255. This introduces a
@@ -351,7 +351,9 @@ struct regnode_ssc {
#define ANYOF_CLASS ANYOF_POSIXL
#define ANYOF_LARGE ANYOF_POSIXL
-/* Unused: 0x10. When using, be sure to change ANYOF_FLAGS_ALL below */
+/* Should we raise a warning if matching against an above-Unicode code point?
+ * */
+#define ANYOF_WARN_SUPER 0x10
/* Can match something outside the bitmap that isn't in utf8 */
#define ANYOF_NONBITMAP_NON_UTF8 0x20
@@ -364,7 +366,7 @@ struct regnode_ssc {
* in utf8. */
#define ANYOF_NON_UTF8_LATIN1_ALL 0x80
-#define ANYOF_FLAGS_ALL (0xff & ~0x10)
+#define ANYOF_FLAGS_ALL (0xff)
#define ANYOF_LOCALE_FLAGS (ANYOF_LOCALE \
|ANYOF_LOC_FOLD \