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]]]]]]]
Actions
Like0
Like0Like0