From 58ef7c20880642c88d06b351f8bbaaa291898e58 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 21 Mar 2003 15:13:23 +0000 Subject: * 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 --- regex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'regex.c') 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; } -- cgit v1.2.3