Actions
Bug #20055
closedRipper seems to skip some checks like `void value expression` and `duplicated variable name`
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0dev (2023-12-08T07:01:01Z master f2c84c4884) [x86_64-linux]
Description
These are syntax error
return + return # void value expression
1 in [a, a] # duplicated variable name
1 + (1 => [a, a]) # both
But Ripper.sexp returns S-expression, not nil
Ripper.sexp 'return + return'
# =>
[:program, [[:return, [:args_add_block, [[:unary, :+@, [:return0]]], false]]]]
Ripper.sexp '1 in [a, a]'
# =>
[:program, [[:case, [:@int, "1", [1, 0]], [:in, [:aryptn, nil, [[:var_field, [:@ident, "a", [1, 6]]], [:var_field, [:@ident, "a", [1, 9]]]], nil, nil], nil, nil]]]]
Ripper.sexp '1 + (1 => [a, a]) # both'
# =>
[:program, [[:binary, [:@int, "1", [1, 0]], :+, [:paren, [[:case, [:@int, "1", [1, 5]], [:in, [:aryptn, nil, [[:var_field, [:@ident, "a", [1, 11]]], [:var_field, [:@ident, "a", [1, 14]]]], nil, nil], nil, nil]]]]]]]
Updated by nobu (Nobuyoshi Nakada) about 1 year ago
- Related to Bug #16008: Ripper hshptn node drops information added
Updated by yui-knk (Kaneko Yuichiro) 10 months ago
- Status changed from Open to Closed
This is solved by https://bugs.ruby-lang.org/issues/20257 (https://github.com/ruby/ruby/pull/9923).
Actions
Like0
Like0Like0