ext/re2/re2.cc in re2-1.6.0 vs ext/re2/re2.cc in re2-1.7.0
- old
+ new
@@ -391,11 +391,11 @@
}
/*
* Returns the number of elements in the match array (including nils).
*
- * @return [Fixnum] the number of elements
+ * @return [Integer] the number of elements
* @example
* m = RE2::Regexp.new('(\d+)').match("bob 123")
* m.size #=> 2
* m.length #=> 2
*/
@@ -407,12 +407,12 @@
}
/*
* Returns the offset of the start of the nth element of the matchdata.
*
- * @param [Fixnum, String, Symbol] n the name or number of the match
- * @return [Fixnum] the offset of the start of the match
+ * @param [Integer, String, Symbol] n the name or number of the match
+ * @return [Integer] the offset of the start of the match
* @example
* m = RE2::Regexp.new('ob (\d+)').match("bob 123")
* m.begin(0) #=> 1
* m.begin(1) #=> 4
*/
@@ -437,12 +437,12 @@
}
/*
* Returns the offset of the character following the end of the nth element of the matchdata.
*
- * @param [Fixnum, String, Symbol] n the name or number of the match
- * @return [Fixnum] the offset of the character following the end of the match
+ * @param [Integer, String, Symbol] n the name or number of the match
+ * @return [Integer] the offset of the character following the end of the match
* @example
* m = RE2::Regexp.new('ob (\d+) b').match("bob 123 bob")
* m.end(0) #=> 9
* m.end(1) #=> 7
*/
@@ -582,21 +582,21 @@
* @return [Array<String, nil>, String, Boolean]
*
* @overload [](index)
* Access a particular match by index.
*
- * @param [Fixnum] index the index of the match to fetch
+ * @param [Integer] index the index of the match to fetch
* @return [String, nil] the specified match
* @example
* m = RE2::Regexp.new('(\d+)').match("bob 123")
* m[0] #=> "123"
*
* @overload [](start, length)
* Access a range of matches by starting index and length.
*
- * @param [Fixnum] start the index from which to start
- * @param [Fixnum] length the number of elements to fetch
+ * @param [Integer] start the index from which to start
+ * @param [Integer] length the number of elements to fetch
* @return [Array<String, nil>] the specified matches
* @example
* m = RE2::Regexp.new('(\d+)').match("bob 123")
* m[0, 1] #=> ["123"]
*
@@ -793,16 +793,13 @@
return capturing_groups;
}
/*
* Returns a new RE2 object with a compiled version of
- * +pattern+ stored inside. Equivalent to +RE2.new+.
+ * +pattern+ stored inside. Equivalent to +RE2::Regexp.new+.
*
- * @return [RE2::Regexp] an RE2::Regexp with the specified pattern and options
- * @param [String] pattern the pattern to compile
- * @param [Hash] options the options to compile a regexp with
- * @see RE2::Regexp.new
+ * @see RE2::Regexp#initialize
*
*/
static VALUE re2_re2(int argc, VALUE *argv, VALUE self) {
UNUSED(self);
return rb_class_new_instance(argc, argv, re2_cRegexp);
@@ -831,11 +828,11 @@
* @param [Hash] options the options with which to compile the pattern
* @option options [Boolean] :utf8 (true) text and pattern are UTF-8; otherwise Latin-1
* @option options [Boolean] :posix_syntax (false) restrict regexps to POSIX egrep syntax
* @option options [Boolean] :longest_match (false) search for longest match, not first match
* @option options [Boolean] :log_errors (true) log syntax and execution errors to ERROR
- * @option options [Fixnum] :max_mem approx. max memory footprint of RE2
+ * @option options [Integer] :max_mem approx. max memory footprint of RE2
* @option options [Boolean] :literal (false) interpret string as literal, not regexp
* @option options [Boolean] :never_nl (false) never match \n, even if it is in regexp
* @option options [Boolean] :case_sensitive (true) match is case-sensitive (regexp can override with (?i) unless in posix_syntax mode)
* @option options [Boolean] :perl_classes (false) allow Perl's \d \s \w \D \S \W when in posix_syntax mode
* @option options [Boolean] :word_boundary (false) allow \b \B (word boundary and not) when in posix_syntax mode
@@ -982,11 +979,11 @@
/*
* Returns the max_mem setting for the regular expression
* +re2+.
*
- * @return [Fixnum] the max_mem option
+ * @return [Integer] the max_mem option
* @example
* re2 = RE2::Regexp.new("woo?", :max_mem => 1024)
* re2.max_mem #=> 1024
*/
static VALUE re2_regexp_max_mem(VALUE self) {
@@ -1136,11 +1133,11 @@
/*
* Returns the program size, a very approximate measure
* of a regexp's "cost". Larger numbers are more expensive
* than smaller numbers.
*
- * @return [Fixnum] the regexp "cost"
+ * @return [Integer] the regexp "cost"
*/
static VALUE re2_regexp_program_size(VALUE self) {
re2_pattern *p;
Data_Get_Struct(self, re2_pattern, p);
return INT2FIX(p->pattern->ProgramSize());
@@ -1201,11 +1198,11 @@
/*
* Returns the number of capturing subpatterns, or -1 if the regexp
* wasn't valid on construction. The overall match ($0) does not
* count: if the regexp is "(a)(b)", returns 2.
*
- * @return [Fixnum] the number of capturing subpatterns
+ * @return [Integer] the number of capturing subpatterns
*/
static VALUE re2_regexp_number_of_capturing_groups(VALUE self) {
re2_pattern *p;
Data_Get_Struct(self, re2_pattern, p);
@@ -1271,11 +1268,11 @@
* @overload match(text, number_of_matches)
* See +match(text)+ but with a specific number of
* matches returned (padded with nils if necessary).
*
* @param [String] text the text to search
- * @param [Fixnum] number_of_matches the number of matches to return
+ * @param [Integer] number_of_matches the number of matches to return
* @return [RE2::MatchData] the matches
* @raise [ArgumentError] if given a negative number of matches
* @raise [NoMemoryError] if there was not enough memory to allocate the matches
* @example
* r = RE2::Regexp.new('w(o)(o)')
@@ -1397,11 +1394,11 @@
* @param [String, RE2::Regexp] pattern a regexp matching text to be replaced
* @param [String] rewrite the string to replace with
* @return [String] the resulting string
* @example
* RE2.Replace("hello there", "hello", "howdy") #=> "howdy there"
- * re2 = RE2.new("hel+o")
+ * re2 = RE2::Regexp.new("hel+o")
* RE2.Replace("hello there", re2, "yo") #=> "yo there"
*/
static VALUE re2_Replace(VALUE self, VALUE str, VALUE pattern,
VALUE rewrite) {
UNUSED(self);
@@ -1433,11 +1430,11 @@
* @param [String] str the string to modify
* @param [String, RE2::Regexp] pattern a regexp matching text to be replaced
* @param [String] rewrite the string to replace with
* @return [String] the resulting string
* @example
- * re2 = RE2.new("oo?")
+ * re2 = RE2::Regexp.new("oo?")
* RE2.GlobalReplace("whoops-doops", re2, "e") #=> "wheps-deps"
* RE2.GlobalReplace("hello there", "e", "i") #=> "hillo thiri"
*/
static VALUE re2_GlobalReplace(VALUE self, VALUE str, VALUE pattern,
VALUE rewrite) {
@@ -1520,11 +1517,11 @@
* @param [Hash] options the options with which to compile the pattern
* @option options [Boolean] :utf8 (true) text and pattern are UTF-8; otherwise Latin-1
* @option options [Boolean] :posix_syntax (false) restrict regexps to POSIX egrep syntax
* @option options [Boolean] :longest_match (false) search for longest match, not first match
* @option options [Boolean] :log_errors (true) log syntax and execution errors to ERROR
- * @option options [Fixnum] :max_mem approx. max memory footprint of RE2
+ * @option options [Integer] :max_mem approx. max memory footprint of RE2
* @option options [Boolean] :literal (false) interpret string as literal, not regexp
* @option options [Boolean] :never_nl (false) never match \n, even if it is in regexp
* @option options [Boolean] :case_sensitive (true) match is case-sensitive (regexp can override with (?i) unless in posix_syntax mode)
* @option options [Boolean] :perl_classes (false) allow Perl's \d \s \w \D \S \W when in posix_syntax mode
* @option options [Boolean] :word_boundary (false) allow \b \B (word boundary and not) when in posix_syntax mode
@@ -1887,11 +1884,6 @@
id_one_line = rb_intern("one_line");
id_unanchored = rb_intern("unanchored");
id_anchor_start = rb_intern("anchor_start");
id_anchor_both = rb_intern("anchor_both");
id_exception = rb_intern("exception");
-
- #if 0
- /* Fake so YARD generates the file. */
- rb_mKernel = rb_define_module("Kernel");
- #endif
}