[#2748] Proposal: New Bignum — "Evan Webb" <evan@...>
During some experiments with ruby cryptography, I found some problems with
11 messages
2004/04/06
[#2749] Re: Proposal: New Bignum
— matz@... (Yukihiro Matsumoto)
2004/04/06
Hi,
[#2764] RDoc :enddoc: — Tanaka Akira <akr@...17n.org>
I found that RDoc document some method after :enddoc:. Is it
7 messages
2004/04/10
[#2788] Problems building ext/io/wait.c in 1.8 branch — Gavin Sinclair <gsinclair@...>
I can't get io/wait installed. The main problem is that it doesn't
6 messages
2004/04/17
[#2799] Re: Problems building ext/io/wait.c in 1.8 branch
— Gavin Sinclair <gsinclair@...>
2004/04/21
On Saturday, April 17, 2004, 4:42:14 PM, Gavin wrote:
[#2800] Re: Problems building ext/io/wait.c in 1.8 branch
— ts <decoux@...>
2004/04/21
>>>>> "G" == Gavin Sinclair <gsinclair@soyabean.com.au> writes:
[#2801] Re: Problems building ext/io/wait.c in 1.8 branch
— Gavin Sinclair <gsinclair@...>
2004/04/21
On Thursday, April 22, 2004, 1:21:29 AM, ts wrote:
[#2805] Bug 1318 — Steven Jenkins <steven.jenkins@...>
Any comments on
9 messages
2004/04/23
[#2814] Tempfile strangeness in 1.9.0 — Steven Jenkins <steven.jenkins@...>
I didn't open a bug for this because it's from the CVS head, but it
5 messages
2004/04/24
[yaml] exponentials and double quotes in Range (Re: [syck] YAML.dump("a".."z"))
From:
nobu.nokada@...
Date:
2004-04-27 02:55:24 UTC
List:
ruby-core #2824
Hi,
At Thu, 29 Jan 2004 08:32:57 +0900,
nobu.nokada@softhome.net wrote in [ruby-core:02311]:
> However, is this intended?
>
> $ ./ruby -ryaml -e 'p ("0".."1").to_yaml'
> "--- !ruby/range 0..1"
> $ ./ruby -ryaml -e 'p YAML.load(("0".."1").to_yaml)'
> 0..1
> $ ./ruby -ryaml -e 'p YAML.load(("0".."1").to_yaml).begin.class'
> Fixnum
This seems fixed now, but other issues.
$ ./ruby -ryaml -e 'y 1.0e+20..2.0e+20'
--- !ruby/range '1.0e+20..2.0e+20'
$ ./ruby -ryaml -e 'p YAML.load((1.0e+20..2.0e+20).to_yaml)'
/home/nobu/src/ruby/HEAD/lib/yaml/rubytypes.rb:372: Invalid Range: "1.0e+20..2.0e+20" (YAML::Error)
from /home/nobu/src/ruby/HEAD/lib/yaml/rubytypes.rb:364:in `call'
from /home/nobu/src/ruby/HEAD/lib/yaml.rb:39:in `transfer'
from /home/nobu/src/ruby/HEAD/lib/yaml.rb:39:in `load'
from /home/nobu/src/ruby/HEAD/lib/yaml.rb:39:in `load'
from -e:1
$ ./ruby -ryaml -e 'y "\"".."."'
--- !ruby/range '"\"".."."'
$ ./ruby -ryaml -e 'p YAML.load(("\""..".").to_yaml)'
/home/nobu/src/ruby/HEAD/lib/yaml/rubytypes.rb:372: Invalid Range: "\"\\\"\"..\".\"" (YAML::Error)
from /home/nobu/src/ruby/HEAD/lib/yaml/rubytypes.rb:364:in `call'
from /home/nobu/src/ruby/HEAD/lib/yaml.rb:39:in `transfer'
from /home/nobu/src/ruby/HEAD/lib/yaml.rb:39:in `load'
from /home/nobu/src/ruby/HEAD/lib/yaml.rb:39:in `load'
from -e:1
$ ./ruby -ryaml -e "y ('\''..'.')"
--- !ruby/range '"'".."."'
$ ./ruby -ryaml -e "p YAML.load(('\''..'.').to_yaml)"
/home/nobu/src/ruby/HEAD/lib/yaml.rb:39:in `load': parse error on line 0, col 23: `--- !ruby/range '"'".."."'' (ArgumentError)
from /home/nobu/src/ruby/HEAD/lib/yaml.rb:39:in `load'
from -e:1
Above 2 are simle, but the last seems to need fix in syck.
Index: lib/yaml/rubytypes.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/yaml/rubytypes.rb,v
retrieving revision 1.20
diff -U2 -p -d -r1.20 rubytypes.rb
--- lib/yaml/rubytypes.rb 26 Apr 2004 23:24:46 -0000 1.20
+++ lib/yaml/rubytypes.rb 27 Apr 2004 02:28:42 -0000
@@ -363,6 +363,6 @@ end
YAML.add_ruby_type( 'range' ) { |type, val|
- inr = '(\w+|[+-]*\d+(?:\.\d+)?|"(?:[^\\"]|\\.)*")'
- if String === val and val =~ /^#{inr}(\.{2,3})#{inr}$/
+ inr = %r'(\w+|[+-]?\d+(?:\.\d+)?(?:e[+-]\d+)?|"(?:[^\\"]|\\.)*")'
+ if String === val and val =~ /^#{inr}(\.{2,3})#{inr}$/o
r1, rdots, r2 = $1, $2, $3
Range.new( YAML.load( "--- #{r1}" ), YAML.load( "--- #{r2}" ), rdots.length == 3 )
Index: test/yaml/test_yaml.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/test/yaml/test_yaml.rb,v
retrieving revision 1.12
diff -U2 -p -d -r1.12 test_yaml.rb
--- test/yaml/test_yaml.rb 16 Feb 2004 14:41:49 -0000 1.12
+++ test/yaml/test_yaml.rb 27 Apr 2004 02:34:11 -0000
@@ -381,5 +381,5 @@ EOY
[ "Mark McGwire's year was crippled by a knee injury.\n" ], <<EOY
- >
- Mark McGwire's
+ Mark McGwire\'s
year was crippled
by a knee injury.
@@ -910,5 +910,5 @@ literal: |
not start with one.
-is equal to: "The \\ \' \\" characters may \\
+is equal to: "The \\ ' \\" characters may \\
be\\nfreely used. Leading white\\n space \\
is significant.\\n\\nLine breaks are \\
@@ -1032,5 +1032,5 @@ EOY
# Test Ruby regular expressions
assert_to_yaml(
- { 'simple' => /a.b/, 'complex' => /\A"((?:[^"]|\")+)"/,
+ { 'simple' => /a.b/, 'complex' => %r'\A"((?:[^"]|\")+)"',
'case-insensitive' => /George McFly/i }, <<EOY
case-insensitive: !ruby/regexp "/George McFly/i"
@@ -1211,4 +1211,6 @@ EOY
t = 0..1
assert_equal( t, YAML.load( YAML.dump( t ) ) )
+ t = 1.0e20 .. 2.0e20
+ assert_equal( t, YAML.load( YAML.dump( t ) ) )
t = "0".."1"
assert_equal( t, YAML.load( YAML.dump( t ) ) )
@@ -1218,4 +1220,8 @@ EOY
assert_equal( t, YAML.load( YAML.dump( t ) ) )
t = ".rb"...".pl"
+ assert_equal( t, YAML.load( YAML.dump( t ) ) )
+ t = '"'..."."
+ assert_equal( t, YAML.load( YAML.dump( t ) ) )
+ t = "'"..."."
assert_equal( t, YAML.load( YAML.dump( t ) ) )
end
--
Nobu Nakada