Project

General

Profile

Actions

Bug #6347

closed

Syntax error on calling method with symbol without space and parens in else clause

Added by ko1 (Koichi Sasada) almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 2.0.0dev (2012-04-23 trunk 35432) [i386-mswin32_100]
Backport:
[ruby-dev:45563]

Description

 ささだです.

 次のようにすると syntax error になるんですが,これはこういうもんでしょうか.

if 1==2
else
p:foo
end

#=>

ruby 2.0.0dev (2012-04-23 trunk 35432) [i386-mswin32_100]
test.rb:3: syntax error, unexpected tLABEL
p:foo
^

Updated by mame (Yusuke Endoh) almost 12 years ago

  • Status changed from Open to Assigned
  • Assignee set to usa (Usaku NAKAMURA)

Updated by usa (Usaku NAKAMURA) almost 12 years ago

  • Assignee changed from usa (Usaku NAKAMURA) to matz (Yukihiro Matsumoto)

バグであることが確実な気がするもの。(1.8ではp(:foo)と解釈されるもの)

if true then
p:foo
end

if false
else
p:foo
end

begin
p:foo
end

begin
ensure
p:foo
end

"#{p:foo}"

たぶんバグじゃないかなーと思うもの。(1.8では文法エラーになるが、スペースを入れれば通るもの)

class Foo < p:foo; end

class << p:foo; end

たぶん放置してもいいと思うもの。(元々引数リストをくくる括弧がないと通らないもの)

x = nil, p:foo

true && p:foo

*p:foo

Actions #3

Updated by nobu (Nobuyoshi Nakada) almost 12 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r35457.
Koichi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • parse.y (parser_yylex): EXPR_BEG by keywords is a start point of
    commands. [ruby-dev:45563][Bug #6347]
  • parse.y (superclass): ditto for superclass.
  • parse.y (parser_parse_string, parser_here_document): ditto for
    string interpolation.
  • parse.y (parser_yylex): ditto for singleton class.
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0