regcomp.c: comment typo and rewording
authorKarl Williamson <public@khwilliamson.com>
Thu, 19 Dec 2013 05:57:55 +0000 (22:57 -0700)
committerKarl Williamson <public@khwilliamson.com>
Tue, 31 Dec 2013 15:27:22 +0000 (08:27 -0700)
regcomp.c

index 5b10edd..aa8da59 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -13165,7 +13165,7 @@ parseit:
                          * would cause things in <depends_list> to match
                          * inappropriately, except that any \p{}, including
                          * this one forces Unicode semantics, which means there
-                         * is <no depends_list> */
+                         * is no <depends_list> */
                         ANYOF_FLAGS(ret) |= ANYOF_NONBITMAP_NON_UTF8;
                     }
                     else {
@@ -13950,9 +13950,16 @@ parseit:
         return ret;
     }
 
-    /* If the character class contains only a single element, it may be
-     * optimizable into another node type which is smaller and runs faster.
-     * Check if this is the case for this class */
+    /* Here, we've gone through the entire class and dealt with multi-char
+     * folds.  We are now in a position that we can do some checks to see if we
+     * can optimize this ANYOF node into a simpler one, even in Pass 1.
+     * Currently we only do two checks:
+     * 1) is in the unlikely event that the user has specified both, eg. \w and
+     *    \W under /l, then the class matches everything.  (This optimization
+     *    is done only to make the optimizer code run later work.)
+     * 2) if the character class contains only a single element (including a
+     *    single range), we see if there is an equivalent node for it.
+     * Other checks are possible */
     if (! ret_invlist   /* Can't optimize if returning the constructed
                            inversion list */
         && (UNLIKELY(posixl_matches_all) || element_count == 1))