summaryrefslogtreecommitdiff
path: root/ext/strscan
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-18 18:06:14 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-18 18:06:14 +0000
commitb06f1fb429688bbfd02aba58288143c2de1c777f (patch)
treed675fbdadb923abd77bd8945452697dd412c5f08 /ext/strscan
parente55e640a6f1a710bf1e344d462cc94316d5ecb39 (diff)
* ext/strscan/strscan.c: StringScanner#restsize is obsolete; use #rest_size instead.
* ext/strscan/strscan.c: StringScanner#matchedsize is obsolete; use #matched_size instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/strscan')
-rw-r--r--ext/strscan/strscan.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index 8997cbf..e33f610 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -935,6 +935,18 @@ strscan_matched_size(self)
}
/*
+ * Equivalent to #matched_size.
+ * This method is obsolete; use #matched_size instead.
+ */
+static VALUE
+strscan_matchedsize(self)
+ VALUE self;
+{
+ rb_warning("StringScanner#matchedsize is obsolete; use #matched_size instead");
+ return strscan_matched_size(self);
+}
+
+/*
* call-seq: [](n)
*
* Return the n-th subgroup in the most recent match.
@@ -1013,7 +1025,7 @@ strscan_post_match(self)
/*
* Returns the "rest" of the string (i.e. everything after the scan pointer).
- * If there is no more data, it returns <tt>""</tt>.
+ * If there is no more data (eos? = true), it returns <tt>""</tt>.
*/
static VALUE
strscan_rest(self)
@@ -1047,6 +1059,18 @@ strscan_rest_size(self)
return INT2FIX(i);
}
+/*
+ * <tt>s.restsize</tt> is equivalent to <tt>s.rest_size</tt>.
+ * This method is obsolete; use #rest_size instead.
+ */
+static VALUE
+strscan_restsize(self)
+ VALUE self;
+{
+ rb_warning("StringScanner#restsize is obsolete; use #rest_size instead");
+ return strscan_rest_size(self);
+}
+
#define INSPECT_LENGTH 5
#define BUFSIZE 256
@@ -1304,14 +1328,14 @@ Init_strscan()
rb_define_method(StringScanner, "matched?", strscan_matched_p, 0);
rb_define_method(StringScanner, "matched", strscan_matched, 0);
rb_define_method(StringScanner, "matched_size", strscan_matched_size, 0);
- rb_define_method(StringScanner, "matchedsize", strscan_matched_size, 0);
+ rb_define_method(StringScanner, "matchedsize", strscan_matchedsize, 0);
rb_define_method(StringScanner, "[]", strscan_aref, 1);
rb_define_method(StringScanner, "pre_match", strscan_pre_match, 0);
rb_define_method(StringScanner, "post_match", strscan_post_match, 0);
rb_define_method(StringScanner, "rest", strscan_rest, 0);
rb_define_method(StringScanner, "rest_size", strscan_rest_size, 0);
- rb_define_method(StringScanner, "restsize", strscan_rest_size, 0);
+ rb_define_method(StringScanner, "restsize", strscan_restsize, 0);
rb_define_method(StringScanner, "inspect", strscan_inspect, 0);
}