parser
parser copied to clipboard
Incompatibility in syntax errors regarding "void value expression"
There is an incompatibility in syntax errors for "void value expression" between Parser gem and Ruby.
Expected
a 1,break,1 has been a syntax error since at least Ruby 2.0:
$ ruby -vce 'a 1,break,1'
ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-darwin13.0.2]
-e:1: void value expression
a 1,break,1
^
The same goes for Ruby 3.3:
$ ruby -vce 'a 1,break,1'
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin22]
-e:1: void value expression
a 1,break,1
-e:1: Invalid break
a 1,break,1
-e: compile error (SyntaxError)
Actual
Although the Parser gem is able to parse it, this is likely an unexpected behavior:
$ ruby-parse --33 -e 'a 1,break,1'
(send nil :a
(int 1)
(break)
(int 1))
The same goes for return, next, and redo.