Permalink
Browse files

more regexp work

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/branches/icu@3576 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent 6707044 commit 4dbc95621832e81e0ad704e2ad1d2d8a554f5f2d @lrz lrz committed Feb 19, 2010
Showing with 568 additions and 132 deletions.
  1. +2 −1 dispatcher.cpp
  2. +0 −1 include/ruby/intern.h
  3. +4 −7 parse.y
  4. +539 −123 re.cpp
  5. +23 −0 re.h
View
@@ -16,6 +16,7 @@
#include "dtrace.h"
#include "array.h"
#include "hash.h"
+#include "re.h"
#include <execinfo.h>
#include <dlfcn.h>
@@ -1264,7 +1265,7 @@ rb_vm_fast_eqq(struct mcache *cache, VALUE self, VALUE other)
return rb_str_equal(self, other);
case T_REGEXP:
- return rb_reg_eqq(self, selEqq, other);
+ return regexp_eqq(self, selEqq, other);
case T_SYMBOL:
return (self == other ? Qtrue : Qfalse);
View
@@ -519,7 +519,6 @@ VALUE rb_reg_new_str(VALUE, int);
VALUE rb_reg_new(const char *, long, int);
VALUE rb_reg_match(VALUE, VALUE);
int rb_reg_options(VALUE);
-VALUE rb_reg_eqq(VALUE, SEL, VALUE);
void rb_set_kcode(const char*);
const char* rb_get_kcode(void);
/* ruby.c */
View
11 parse.y
@@ -23,6 +23,7 @@
#include "ruby/encoding.h"
#include "encoding.h"
#include "id.h"
+#include "re.h"
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
@@ -5626,23 +5627,19 @@ parser_tokadd_escape(struct parser_params *parser, rb_encoding **encp)
return 0;
}
-extern int rb_char_to_option_kcode(int c, int *option, int *kcode);
-
static int
parser_regx_options(struct parser_params *parser)
{
- int kcode = 0;
int options = 0;
- int c, opt, kc;
+ int c, opt;
newtok();
while (c = nextc(), ISALPHA(c)) {
if (c == 'o') {
options |= RE_OPTION_ONCE;
}
- else if (rb_char_to_option_kcode(c, &opt, &kc)) {
+ else if (rb_char_to_icu_option(c, &opt)) {
options |= opt;
- if (kc >= 0) kcode = c;
}
else {
tokadd(c);
@@ -5654,7 +5651,7 @@ parser_regx_options(struct parser_params *parser)
compile_error(PARSER_ARG "unknown regexp option%s - %s",
toklen() > 1 ? "s" : "", tok());
}
- return options | RE_OPTION_ENCODING(kcode);
+ return options;
}
static void
Oops, something went wrong.

0 comments on commit 4dbc956

Please sign in to comment.