diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-02-08 09:19:27 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-02-08 09:19:27 +0000 |
commit | ed520cf6e96dcae2b7900127e325fcea1f4abc26 (patch) | |
tree | 89c098f2e02099588c8b4f74fbb8e37c15045d49 /re.c | |
parent | b576f57aa02c4983eeb081f625c45b9445c50538 (diff) |
* parse.y (parse_quotedwords): %w should allow parenthesis escape.
* parse.y (parse_qstring): %q should allow terminator escape.
* re.c (rb_reg_options): new method to give an option values.
* parse.y (cond0): disable special treating of integer literal in
conditional unless option -e is supplied. changes current
behavior. experimental.
* parse.y (cond0): give warning for string/integer literals and
dot operators in conditionals unless option -e is supplied.
* re.c (rb_reg_equal): all option flags should be same to be equal.
* error.c (Init_Exception): make Interrupt a subclass of
SignalException.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -364,6 +364,14 @@ rb_reg_casefold_p(re) } static VALUE +rb_reg_options_m(re) + VALUE re; +{ + rb_reg_check(re); + return INT2NUM(RREGEXP(re)->ptr->options); +} + +static VALUE rb_reg_kcode_m(re) VALUE re; { @@ -915,8 +923,7 @@ rb_reg_equal(re1, re2) if (min > RREGEXP(re2)->len) min = RREGEXP(re2)->len; if (memcmp(RREGEXP(re1)->str, RREGEXP(re2)->str, min) == 0 && rb_reg_cur_kcode(re1) == rb_reg_cur_kcode(re2) && - !((RREGEXP(re1)->ptr->options & RE_OPTION_IGNORECASE) ^ - (RREGEXP(re2)->ptr->options & RE_OPTION_IGNORECASE))) { + RREGEXP(re1)->ptr->options == RREGEXP(re2)->ptr->options) { return Qtrue; } return Qfalse; @@ -1379,6 +1386,7 @@ Init_Regexp() rb_define_method(rb_cRegexp, "inspect", rb_reg_inspect, 0); rb_define_method(rb_cRegexp, "source", rb_reg_source, 0); rb_define_method(rb_cRegexp, "casefold?", rb_reg_casefold_p, 0); + rb_define_method(rb_cRegexp, "options", rb_reg_options_m, 0); rb_define_method(rb_cRegexp, "kcode", rb_reg_kcode_m, 0); rb_define_const(rb_cRegexp, "IGNORECASE", INT2FIX(RE_OPTION_IGNORECASE)); |