Revision
3644
Author
lsansonetti@apple.com
Date
2010-02-26 19:13:34 -0800 (Fri, 26 Feb 2010)

Log Message

use UREGEX_MULTILINE by default and UREGEX_DOTALL in case /m is passed, to follow MRI's weird behavior

Modified Paths

Diff

Modified: MacRuby/branches/icu/re.cpp (3643 => 3644)


--- MacRuby/branches/icu/re.cpp	2010-02-27 03:12:52 UTC (rev 3643)
+++ MacRuby/branches/icu/re.cpp	2010-02-27 03:13:34 UTC (rev 3644)
@@ -28,6 +28,11 @@
 
 #define RREGEXP(o) ((rb_regexp_t *)o)
 
+#define REGEXP_OPT_DEFAULT	(UREGEX_MULTILINE)
+#define REGEXP_OPT_IGNORECASE 	(UREGEX_CASE_INSENSITIVE)
+#define REGEXP_OPT_EXTENDED 	(UREGEX_COMMENTS)
+#define REGEXP_OPT_MULTILINE	(UREGEX_DOTALL)
+
 typedef struct rb_match {
     struct RBasic basic;
     rb_regexp_t *regexp;
@@ -148,6 +153,8 @@
 static bool
 init_from_string(rb_regexp_t *regexp, VALUE str, int option, VALUE *excp)
 {
+    option |= REGEXP_OPT_DEFAULT;
+
     UnicodeString *unistr = str_to_unistr(str);
     assert(unistr != NULL);
 
@@ -193,10 +200,6 @@
     return (VALUE)regexp;
 }
 
-#define REGEXP_OPT_IGNORECASE 	(UREGEX_CASE_INSENSITIVE)
-#define REGEXP_OPT_EXTENDED 	(UREGEX_COMMENTS)
-#define REGEXP_OPT_MULTILINE	(UREGEX_MULTILINE | UREGEX_DOTALL)
-
 bool
 rb_char_to_icu_option(int c, int *option)
 {