[#5524] Division weirdness in 1.9 — "Florian Frank" <flori@...>
Hi,
[#5536] bug in variable assignment — Mauricio Fern疣dez <mfp@...>
Hi,
On Mon, Aug 08, 2005 at 11:36:22AM +0900, nobuyoshi nakada wrote:
hi,
Hi,
[#5552] Exceptions in threads all get converted to a TypeError — Paul van Tilburg <paul@...>
Hey all,
[#5563] Non-overridable and non-redefinable methods — Eric Mahurin <eric_mahurin@...>
Lately, I've been thinking about the future of ruby
On 8/19/05, Eric Mahurin <eric_mahurin@yahoo.com> wrote:
--- Austin Ziegler <halostatue@gmail.com> wrote:
Just wanted to add a few things.
On 8/19/05, TRANS <transfire@gmail.com> wrote:
Hi --
--- "David A. Black" <dblack@wobblini.net> wrote:
On 8/20/05, Eric Mahurin <eric_mahurin@yahoo.com> wrote:
On 8/20/05, TRANS <transfire@gmail.com> wrote:
On 8/19/05, Eric Mahurin <eric_mahurin@yahoo.com> wrote:
--- Austin Ziegler <halostatue@gmail.com> wrote:
On 20 Aug 2005, at 02:05, Eric Mahurin wrote:
Eric Hodel wrote:
Eric Mahurin wrote:
Hi,
--- SASADA Koichi <ko1@atdot.net> wrote:
Hi,
--- SASADA Koichi <ko1@atdot.net> wrote:
[#5609] Pathname#walk for traversing path nodes (patch) — ES <ruby-ml@...>
Here is a small addition to Pathname against 1.9, probably suited
Evan Webb wrote:
In article <43094510.6090406@magical-cat.org>,
[#5651] File.extname edge case bug? — Daniel Berger <Daniel.Berger@...>
Hi all,
[#5662] Postgrey — Shugo Maeda <shugo@...>
Hi,
[#5676] uri test failures. (Re: [ruby-cvs] ruby/lib, ruby/lib/uri: Lovely RDOC patches from mathew (metaATpoboxDOTcom) on URI/* and getoptlong.rb) — Tanaka Akira <akr@...17n.org>
In article <20050824050801.5B4E0C671F@lithium.ruby-lang.org>,
[#5680] Problem with mkmf and spaces in directory names? — noreply@...
Bugs item #2308, was opened at 2005-08-25 13:42
[#5685] Wilderness Project — "Charles E. Thornton" <ruby-core@...>
OK - I see where ELTS_SHARED is used to implement COPY-ON-WRITE
[PATCH] parsing ->(){} expressions in 1.9
$ ./ruby -ve "->(){ {} }"
ruby 1.9.0 (2005-08-15) [i686-linux]
-e:1: syntax error
->(){ {} }
^
This works for me:
Index: parse.y
===================================================================
RCS file: /src/ruby/parse.y,v
retrieving revision 1.403
diff -p -u -r1.403 parse.y
--- parse.y 12 Aug 2005 08:13:27 -0000 1.403
+++ parse.y 15 Aug 2005 22:40:06 -0000
@@ -95,6 +95,10 @@ union tmpyystype {
unsigned long id;
int num;
struct RVarmap *vars;
+ struct {
+ int num;
+ struct RVarmap *vars;
+ } linfo;
};
struct local_vars {
@@ -447,6 +451,10 @@ static void ripper_compile_error _((stru
ID id;
int num;
struct RVarmap *vars;
+ struct {
+ int num;
+ struct RVarmap *vars;
+ } linfo;
}
/*%%%*/
@@ -3178,10 +3186,10 @@ bv_decl : tIDENTIFIER
;
lambda : {
- $<num>$ = lpar_beg;
+ $<linfo>$.num = lpar_beg;
lpar_beg = ++paren_nest;
/*%%%*/
- $<vars>$ = dyna_push();
+ $<linfo>$.vars = dyna_push();
/*%
%*/
}
@@ -3194,7 +3202,8 @@ lambda : {
/*%%%*/
$$ = $2;
$$->nd_body = block_append($$->nd_body, $4);
- dyna_pop($<vars>1);
+ dyna_pop($<linfo>1.vars);
+ lpar_beg = $<linfo>1.num;
/*%
$$ = dispatch2(lambda, $2, $4);
%*/
@@ -6485,6 +6494,8 @@ parser_yylex(parser)
case '{':
if (lpar_beg && lpar_beg == paren_nest) {
lex_state = EXPR_BEG;
+ lpar_beg = 0;
+ --paren_nest;
return tLAMBEG;
}
if (IS_ARG() || lex_state == EXPR_END || lex_state == EXPR_END2)
@@ -6805,6 +6816,8 @@ parser_yylex(parser)
}
if (kw->id[0] == kDO) {
if (lpar_beg && lpar_beg == paren_nest) {
+ lpar_beg = 0;
+ --paren_nest;
return kDO_LAMBDA;
}
if (COND_P()) return kDO_COND;
$ ./ruby -e "->(){ {} }"
$ cat syn.rb
require 'test/unit'
class TestLambdaSyntax < Test::Unit::TestCase
def test_syntax
l = ->(a = ->(b = 1){b}){ a.call }
assert_equal(1, l.call)
l = ->(a = ->(b = ->(c = ->(){2}){ c.call }){b.call}){ a.call }
assert_equal(2, l.call)
l = ->(a = ->(b = ->(c = ->(){3}){ (->(){c}.call.call) }){b.call}){ a.call }
assert_equal(3, l.call)
l=->(a=->(b=->(c=->(){3}){(->(){c}.call.call)}){b.call}){a.call}
assert_equal(3, l.call)
l = -> a = 1 { a }
assert_equal(1, l.call)
l = -> a = 1, b = 2 { [a, b] }
assert_equal([1,2], l.call)
l = -> a = -> c = 1 {c}, b = 2 { [a.call, b] }
assert_equal([1,2], l.call)
end
end
$ ./ruby syn.rb
Loaded suite syn
Started
.
Finished in 0.001503 seconds.
1 tests, 7 assertions, 0 failures, 0 errors
--
Mauricio Fernandez