Bug #6347

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

Added by Koichi Sasada about 3 years ago. Updated about 3 years ago.

[ruby-dev:45563]
Status:Closed
Priority:Normal
Assignee:Yukihiro Matsumoto
ruby -v:ruby 2.0.0dev (2012-04-23 trunk 35432) [i386-mswin32_100] Backport:

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
^

Associated revisions

Revision 35457
Added by Nobuyoshi Nakada about 3 years ago

  • parse.y (parser_yylex): EXPR_BEG by keywords is a start point of commands. [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.

Revision 35457
Added by Nobuyoshi Nakada about 3 years ago

  • parse.y (parser_yylex): EXPR_BEG by keywords is a start point of commands. [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.

History

#1 Updated by Yusuke Endoh about 3 years ago

  • Status changed from Open to Assigned
  • Assignee set to Usaku NAKAMURA

#2 Updated by Usaku NAKAMURA about 3 years ago

  • Assignee changed from Usaku NAKAMURA to 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

#3 Updated by Nobuyoshi Nakada about 3 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. [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.

Also available in: Atom PDF