Prism shoudld throw a syntax error for endless methods when the method
name uses brackets. Previously it would not. This matches the behavior
of parse.y.
Fixes https://bugs.ruby-lang.org/issues/2101043c16a89ef
Prism was already disallowing arguments after block args, but in
parse.y, any comma after a block arg is a syntax error. This moves the
error handling into `PM_TOKEN_UAMPERSAND` where we can check if the
current type is `PM_TOKEN_COMMA`then raise an error. I've also updated
the tests to include the examplesfrom ruby/prism#3112.
Fixes: ruby/prism#3112754cf8eddc
Raise an exception when the same numbered param is used inside a child
block. For example, the following code should be a syntax error:
```ruby
-> { _1 + -> { _1 } }
```
Fixes https://github.com/ruby/prism/pull/3291d4fc441838
If we hit an EOF token, and the character before the EOF is a newline,
we should make EOF token start at the previous newline. That way any
errors reported will occur on that line.
For example "foo(\n" should report an error on line 1 even though the
EOF technically occurs on line 2.
[Bug #20918]
https://bugs.ruby-lang.org/issues/2091860bc43de8e
When we encounter an invalid unicode escape within a regular
expression, we now pass that error on to Onigmo as if it didn't
exist in the parser (which matches the upstream parser's behavior).
We do this because there are tests that specify that you are
allowed to have invalid Unicode escapes if they are within the
context of a regular expression comment for a regular expression
in extended mode. That looks like:
/# \u /x
Note that this _only_ applies to Unicode escapes (as opposed to
applying to hex or meta/control escapes as well). Importantly it
also only applies if the regular expression is terminated. An
unterminated regular expression will still get error handling done
in the parser. That would look like:
/# \u
that would result in the same error handling we have today.
fb98034806