summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-21 15:13:23 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-21 15:13:23 +0000
commit58ef7c20880642c88d06b351f8bbaaa291898e58 (patch)
tree0ed5f63dd297a8bcc2dc5fa5e35b3e84a19a6ca2 /regex.c
parent108cf940d8d617dcabb5e5b17e6315b023ecc301 (diff)
* regex.c (re_compile_pattern): fix previous change.
* instruby.rb, ext/extmk.rb, ext/tk/lib/tk.rb, lib/benchmark.rb, lib/cgi.rb, lib/debug.rb, lib/getoptlong.rb, lib/jcode.rb, lib/optparse.rb, lib/time.rb, lib/date/format.rb, lib/irb/ruby-lex.rb: escape `[', `]', `-' in chracter class in regexp to avoid warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 7ae16cf..c81c140 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;
}