summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COPYING.ja6
-rw-r--r--ChangeLog12
-rw-r--r--ext/bigdecimal/lib/bigdecimal/newton.rb2
-rw-r--r--parse.y14
-rw-r--r--string.c23
5 files changed, 47 insertions, 10 deletions
diff --git a/COPYING.ja b/COPYING.ja
index 933cc7cb9a..aa2a163848 100644
--- a/COPYING.ja
+++ b/COPYING.ja
@@ -1,6 +1,6 @@
-$BK\%W%m%0%i%`$O%U%j!<%=%U%H%&%'%"$G$9!%(BGPL(the GNU General
-Public License)$B$^$?$O0J2<$K<($9>r7o$GK\%W%m%0%i%`$r:FG[I[$G(B
-$B$-$^$9!%(BGPL$B$K$D$$$F$O(BGPL$B%U%!%$%k$r;2>H$7$F2<$5$$!%(B
+$BK\%W%m%0%i%`$O%U%j!<%=%U%H%&%'%"$G$9!%(BGPL (the GNU General
+Public License)$B%P!<%8%g%s(B2$B$^$?$O0J2<$K<($9>r7o$GK\%W%m%0%i%`(B
+$B$r:FG[I[$G$-$^$9!%(BGPL$B$K$D$$$F$O(BGPL$B%U%!%$%k$r;2>H$7$F2<$5$$!%(B
1. $BJ#@=$O@)8B$J$/<+M3$G$9!%(B
diff --git a/ChangeLog b/ChangeLog
index c02ce0fe2e..830b787f56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Sat Jun 10 18:02:40 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * ext/bigdecimal/lib/bigdecimal/newton.rb (Newton::nlsolve): typo
+ fixed: raize -> raise. [ruby-talk:196608]
+
+Sat Jun 10 17:49:53 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (rb_str_ord): new method.
+
+ * parse.y (rbracket): allow optional newline before closing
+ brackets.
+
Sat Jun 10 15:12:29 2006 NAKAMURA Usaku <usa@ruby-lang.org>
* eval.c (rb_f_method_name, rb_f_callee_name): new functions.
diff --git a/ext/bigdecimal/lib/bigdecimal/newton.rb b/ext/bigdecimal/lib/bigdecimal/newton.rb
index f88fabe5dc..f1a55da789 100644
--- a/ext/bigdecimal/lib/bigdecimal/newton.rb
+++ b/ext/bigdecimal/lib/bigdecimal/newton.rb
@@ -60,7 +60,7 @@ module Newton
begin
fact *= p5
if fact < minfact then
- raize "Failed to reduce function values."
+ raise "Failed to reduce function values."
end
for i in 0...n do
x[i] = xs[i] - dx[i]*fact
diff --git a/parse.y b/parse.y
index a5bb44da6c..1eb11da136 100644
--- a/parse.y
+++ b/parse.y
@@ -620,7 +620,6 @@ program : {
/*%
lex_state = EXPR_BEG;
class_nest = !parser->toplevel_p;
- $$ = Qnil;
%*/
}
compstmt
@@ -915,7 +914,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
$$ = dispatch3(opassign, $1, $2, $3);
%*/
}
- | primary_value '[' opt_call_args ']' tOP_ASGN command_call
+ | primary_value '[' opt_call_args rbracket tOP_ASGN command_call
{
/*%%%*/
NODE *args = $3;
@@ -1384,7 +1383,7 @@ mlhs_node : variable
$$ = $1;
%*/
}
- | primary_value '[' opt_call_args ']'
+ | primary_value '[' opt_call_args rbracket
{
/*%%%*/
$$ = aryset($1, $3);
@@ -1458,7 +1457,7 @@ lhs : variable
$$ = dispatch1(var_field, $1);
%*/
}
- | primary_value '[' opt_call_args ']'
+ | primary_value '[' opt_call_args rbracket
{
/*%%%*/
$$ = aryset($1, $3);
@@ -1704,7 +1703,7 @@ arg : lhs '=' arg
$$ = dispatch3(opassign, $1, $2, $3);
%*/
}
- | primary_value '[' opt_call_args ']' tOP_ASGN arg
+ | primary_value '[' opt_call_args rbracket tOP_ASGN arg
{
/*%%%*/
NODE *args;
@@ -3303,7 +3302,7 @@ method_call : operation paren_args
$$ = method_optarg($$, $4);
%*/
}
- | primary_value '[' opt_call_args ']'
+ | primary_value '[' opt_call_args rbracket
{
/*%%%*/
if ($1 && nd_type($1) == NODE_SELF)
@@ -4331,6 +4330,9 @@ opt_nl : /* none */
rparen : opt_nl ')'
;
+rbracket : opt_nl ']'
+ ;
+
trailer : /* none */
| '\n'
| ','
diff --git a/string.c b/string.c
index 871fd9a70d..2792e367d8 100644
--- a/string.c
+++ b/string.c
@@ -4041,6 +4041,28 @@ rb_str_intern(VALUE s)
/*
* call-seq:
+ * str.ord => integer
+ *
+ * Return the <code>Integer</code> ordinal of a one-character string.
+ *
+ * "a".ord #=> 97
+ */
+
+VALUE
+rb_str_ord(VALUE s)
+{
+ int c;
+
+ if (RSTRING(s)->len != 1) {
+ rb_raise(rb_eTypeError,
+ "expacted a characer, but string of size %d given",
+ RSTRING(s)->len);
+ }
+ c = RSTRING(s)->ptr[0];
+ return INT2NUM(c);
+}
+/*
+ * call-seq:
* str.sum(n=16) => integer
*
* Returns a basic <em>n</em>-bit checksum of the characters in <i>str</i>,
@@ -4309,6 +4331,7 @@ Init_String(void)
rb_define_method(rb_cString, "crypt", rb_str_crypt, 1);
rb_define_method(rb_cString, "intern", rb_str_intern, 0);
rb_define_method(rb_cString, "to_sym", rb_str_intern, 0);
+ rb_define_method(rb_cString, "ord", rb_str_ord, 0);
rb_define_method(rb_cString, "include?", rb_str_include, 1);