From: nobu.nakada@... Date: 2002-06-19T19:18:24+09:00 Subject: [ruby-dev:17525] Re: __END__ in literal なかだです。 At Wed, 19 Jun 2002 16:35:09 +0900, Nobuyoshi-Nakada wrote: > > こういう方法を想定してました。 > > なるほど。じゃあ、とくに障碍はないですね。 うーむ、ボケボケ。<<''が残ってるのに。 とりあえず空(空白のみ)の#{}を除去するようにしてみました。つーか、 #{}の行番号は常にリテラルの開始行から始まってると見なされてるよ うな。 p < "\n2\n2\n" #{__LINE__} #{__LINE__} EOF Index: eval.c =================================================================== RCS file: /cvs/ruby/src/ruby/eval.c,v retrieving revision 1.302 diff -u -2 -p -r1.302 eval.c --- eval.c 2002/06/13 03:55:44 1.302 +++ eval.c 2002/06/19 08:34:25 @@ -3079,5 +3079,5 @@ rb_eval(self, n) result = ruby_errinfo; ruby_errinfo = Qnil; - ruby_sourceline = nd_line(node); + ruby_sourceline = nd_line(list->nd_head); ruby_in_eval++; list->nd_head = compile(list->nd_head->nd_lit, Index: parse.y =================================================================== RCS file: /cvs/ruby/src/ruby/parse.y,v retrieving revision 1.188 diff -u -2 -p -r1.188 parse.y --- parse.y 2002/06/18 15:53:57 1.188 +++ parse.y 2002/06/19 08:25:19 @@ -4085,4 +4084,5 @@ str_extend(list, term, paren) int brace_nest = 0; int paren_nest = 0; + int start; c = nextc(); @@ -4090,5 +4091,11 @@ str_extend(list, term, paren) case '$': case '@': + break; case '{': + do { + if ((c = nextc()) == '}') return list; + } while (ISSPACE(c)); + pushback(c); + c = '{'; break; default: @@ -4098,4 +4105,5 @@ str_extend(list, term, paren) } + start = ruby_sourceline; ss = rb_str_new(tok(), toklen()); if (list == 0) { @@ -4274,4 +4282,5 @@ str_extend(list, term, paren) tokfix(); node = NEW_EVSTR(tok(),toklen()); + nd_set_line(node, start); list_append(list, node); newtok(); -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦