Project

General

Profile

Actions

Bug #19281

closed

SyntaxError if first argument of command call has semicolon inside parenthesis

Added by tompng (tomoya ishida) over 1 year ago. Updated 9 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:111499]

Description

These are syntax error

p (1;2),(3),(4)
p (;),(),()
a.b (1;2),(3),(4)
a.b (;),(),()

I expect it to be syntax ok because the code below is syntax ok.

p (1),(2;3),(4;5)
p (),(;),(;)
a.b (1),(2;3),(4;5)
a.b (),(;),(;)

It will be easy to traverse sexp if the sexp of first argument is same as others

Ripper.sexp "p (),(),()"
# =>
[:program,
 [[:command,
   [:@ident, "p", [1, 0]],
   [:args_add_block,
    [[:paren, false], # [:paren, [[:void_stmt]]]
     [:paren, [[:void_stmt]]],
     [:paren, [[:void_stmt]]]],
    false]]]]
Ripper.sexp "p (1),(2),(3)"
# =>
[:program,
 [[:command,
   [:@ident, "p", [1, 0]],
   [:args_add_block,
    [[:paren, [:@int, "1", [1, 3]]], # [:paren, [[:@int, "1", [1, 3]]]]
     [:paren, [[:@int, "2", [1, 7]]]],
     [:paren, [[:@int, "3", [1, 11]]]]],
    false]]]]

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #6674: 1.9 parser regression: not ()Closedshugo (Shugo Maeda)06/30/2012Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0