summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/regex.c b/regex.c
index 7ae16cf121..c81c140acc 100644
--- a/regex.c
+++ b/regex.c
@@ -185,7 +185,7 @@ static int current_mbctype = MBCTYPE_ASCII;
#ifdef RUBY
#include "util.h"
-# re_warning(x) rb_warn(x)
+# define re_warning(x) rb_warn(x)
#endif
#ifndef re_warning
@@ -1489,6 +1489,8 @@ re_compile_pattern(pattern, size, bufp)
if (c == '-')
re_warning("character class has `-' without escape");
+ if (c == '[' && *p != ':')
+ re_warning("character class has `[' without escape");
/* \ escapes characters when inside [...]. */
if (c == '\\') {
@@ -1695,8 +1697,6 @@ re_compile_pattern(pattern, size, bufp)
}
}
else if (had_mbchar == 0 && (!current_mbctype || !had_num_literal)) {
- if (c == '[')
- re_warning("character class has `[' without escape");
SET_LIST_BIT(c);
had_num_literal = 0;
}