This project is closed and read-only.
Actions
Backport #6403
closedself という名前のメソッド定義で SyntaxError
Backport #6403:
self という名前のメソッド定義で SyntaxError
Status:
Closed
Assignee:
-
Description
http://toro.2ch.net/test/read.cgi/tech/1328648447/925-931
で指摘されていたのですが、self という名前のメソッドの定義で
メソッド内部先頭にシンボルがある場合 SyntaxError になります。
また、セミコロンか改行をはさむと正常にパースされます。
def self; :foo; end #<= NG
def self;; :foo; end #<= OK
def self() :foo; end #<= OK
def self(); :foo; end #<= OK
def hoge; :foo; end #<= OK
def class; :foo; end #<= OK
parse.y の f_arglist に関する規則の部分で、
'(' f_args rparen の時には lex_state を変更しているのに
f_args term の時には $$ = $1; しかしていないあたりが
怪しいように思うのですがどうでしょうか。
Actions