Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 62 lines (47 sloc) 1.527 kB
4dbc956 more regexp work
Laurent Sansonetti authored
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);
80cdbfa added String#match and String#=~
Laurent Sansonetti authored
17
4dbc956 more regexp work
Laurent Sansonetti authored
18 VALUE regexp_eqq(VALUE rcv, SEL sel, VALUE str);
80cdbfa added String#match and String#=~
Laurent Sansonetti authored
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);
29af078 added support for regexps marshal'ing
Laurent Sansonetti authored
24 VALUE rb_regexp_source(VALUE re);
25
a86d5f2 always use ucs2 mode, added shared regexp matchers for #gsub, #scan a…
Laurent Sansonetti authored
26 VALUE rb_reg_matcher_new(VALUE re, VALUE str);
27 void rb_reg_matcher_destroy(VALUE matcher);
28 int rb_reg_matcher_search(VALUE re, VALUE matcher, int pos, bool reverse);
29
30 static inline int
31 rb_reg_search(VALUE re, VALUE str, int pos, bool reverse)
32 {
33 VALUE matcher = rb_reg_matcher_new(re, str);
34 const int res = rb_reg_matcher_search(re, matcher, pos, reverse);
35 rb_reg_matcher_destroy(matcher);
36 return res;
37 }
38
29af078 added support for regexps marshal'ing
Laurent Sansonetti authored
39 int rb_reg_options_to_mri(int opt);
40 int rb_reg_options_from_mri(int mri_opt);
1775a38 more string/regexp work
Laurent Sansonetti authored
41
f045214 regexps are now AOT compilable
Laurent Sansonetti authored
42 void regexp_get_uchars(VALUE re, const UChar **chars_p, long *chars_len_p);
43
7ebd7c2 add String#scan
Laurent Sansonetti authored
44 typedef struct rb_match_result {
45 unsigned int beg;
46 unsigned int end;
47 } rb_match_result_t;
48
49 rb_match_result_t *rb_reg_match_results(VALUE match, int *count);
50
1775a38 more string/regexp work
Laurent Sansonetti authored
51 static inline int
52 rb_reg_adjust_startpos(VALUE re, VALUE str, int pos, bool reverse)
53 {
54 return reverse ? -pos : rb_str_chars_len(str) - pos;
55 }
4dbc956 more regexp work
Laurent Sansonetti authored
56
57 #if defined(__cplusplus)
58 } // extern "C"
59 #endif
60
61 #endif // __RE_H_
Something went wrong with that request. Please try again.