Skip to content
This repository
Newer
Older
100644 64 lines (49 sloc) 1.679 kb
4dbc9562 »
2010-02-19 more regexp work
1 /*
2 * MacRuby Regular Expressions.
3 *
4 * This file is covered by the Ruby license. See COPYING for more details.
5 *
6 * Copyright (C) 2010, Apple Inc. All rights reserved.
7 */
8
9 #ifndef __RE_H_
10 #define __RE_H_
11
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15
16 bool rb_char_to_icu_option(int c, int *option);
80cdbfa1 »
2010-02-20 added String#match and String#=~
17
4dbc9562 »
2010-02-19 more regexp work
18 VALUE regexp_eqq(VALUE rcv, SEL sel, VALUE str);
80cdbfa1 »
2010-02-20 added String#match and String#=~
19 VALUE regexp_match(VALUE rcv, SEL sel, VALUE str);
20 VALUE regexp_match2(VALUE rcv, SEL sel, int argc, VALUE *argv);
21
22 VALUE rb_reg_quote(VALUE pat);
23 VALUE rb_reg_regcomp(VALUE str);
29af0788 »
2010-03-18 added support for regexps marshal'ing
24 VALUE rb_regexp_source(VALUE re);
25
a86d5f26 »
2010-03-25 always use ucs2 mode, added shared regexp matchers for #gsub, #scan a…
26 VALUE rb_reg_matcher_new(VALUE re, VALUE str);
27 void rb_reg_matcher_destroy(VALUE matcher);
c27f1f90 »
2010-11-30 will support the \G of Regexp. fixed the #1012.
28 int rb_reg_matcher_search_first(VALUE re, VALUE matcher, int pos, bool reverse);
29 int rb_reg_matcher_search_next(VALUE re, VALUE matcher, int pos, bool reverse);
30 #define rb_reg_matcher_search rb_reg_matcher_search_next
a86d5f26 »
2010-03-25 always use ucs2 mode, added shared regexp matchers for #gsub, #scan a…
31
32 static inline int
33 rb_reg_search(VALUE re, VALUE str, int pos, bool reverse)
34 {
35 VALUE matcher = rb_reg_matcher_new(re, str);
c27f1f90 »
2010-11-30 will support the \G of Regexp. fixed the #1012.
36 const int res = rb_reg_matcher_search_first(re, matcher, pos, reverse);
a86d5f26 »
2010-03-25 always use ucs2 mode, added shared regexp matchers for #gsub, #scan a…
37 rb_reg_matcher_destroy(matcher);
38 return res;
39 }
40
29af0788 »
2010-03-18 added support for regexps marshal'ing
41 int rb_reg_options_to_mri(int opt);
42 int rb_reg_options_from_mri(int mri_opt);
1775a385 »
2010-02-20 more string/regexp work
43
acc82543 »
2010-08-20 rewrote the regexp layer in pure C to avoid binary incompatibility is…
44 void regexp_get_uchars(VALUE re, const UChar **chars_p, int32_t *chars_len_p);
f045214f »
2010-02-25 regexps are now AOT compilable
45
7ebd7c2b »
2010-02-20 add String#scan
46 typedef struct rb_match_result {
47 unsigned int beg;
48 unsigned int end;
49 } rb_match_result_t;
50
51 rb_match_result_t *rb_reg_match_results(VALUE match, int *count);
52
1775a385 »
2010-02-20 more string/regexp work
53 static inline int
54 rb_reg_adjust_startpos(VALUE re, VALUE str, int pos, bool reverse)
55 {
56 return reverse ? -pos : rb_str_chars_len(str) - pos;
57 }
4dbc9562 »
2010-02-19 more regexp work
58
59 #if defined(__cplusplus)
60 } // extern "C"
61 #endif
62
63 #endif // __RE_H_
Something went wrong with that request. Please try again.