| Age | Commit message (Collapse) | Author |
|
|
|
Redo of https://github.com/ruby/prism/pull/3669 with more tests
https://github.com/ruby/prism/commit/48b403ea79
|
|
The lexer did not jump to the `heredoc_end`, causing the heredoc end delimiter
to be parsed twice.
Normally the heredocs get flushed when a newline is encountered. But because
the newline is part of the string delimiter, that codepath is not taken.
Fixes [Bug #21758]
https://github.com/ruby/prism/commit/7440eb4b11
|
|
If we are about to delete a call operator write argument, it needs
to be removed from the list of block exits as well.
https://github.com/ruby/prism/commit/ebc91c2e39
|
|
https://github.com/ruby/prism/commit/e3e2b1ed04
|
|
When a pattern match is using a string as a hash pattern key and is
using it incorrectly, we were previously assuming it was a symbol.
In the case of an error, that's not the case. So we need to add a
missing node in this case.
https://github.com/ruby/prism/commit/f0b06d6269
|
|
https://github.com/ruby/prism/commit/fef2c20777
|
|
They were being parsed as `p((p a, &block) => value)`.
When we get to this point, we must not just have parsed a command call, always consuming the `=>` is not correct.
Closes [Bug #21622]
https://github.com/ruby/prism/commit/796ab0edf4
|
|
When there are nested capture variables inside of a pattern match
that has an alternation pattern, it is a syntax error. Currently it
only adds a syntax error when it is at the top level of the pattern.
|
|
Fixes [Bug #21661]
https://github.com/ruby/prism/commit/475fa46a82
|
|
Fixes [#Bug 21660], followup to https://github.com/ruby/prism/pull/3674
https://github.com/ruby/prism/commit/fb445a49e5
Co-Authored-By: tomoya ishida <tomoyapenguin@gmail.com>
|
|
This one has been on my mind for a while now.
Currently, there are only tests against the latest syntax version.
This changes the snapshot structure as follows:
* Snapshots at their current location are tested against all syntax versions
* Snapshots inside a version folder like "3.3" are tested against all versions starting from that version
* Snapshots inside a version folder like "3.3-4.2" are tested against all versions in the given range.
This makes sure that as new syntax is added, older versions still work as expected.
I also added a few tests for now valid syntax that should be invalid in older versions (and the other way around as well)
These tests run really fast. So even though it does 3x the work for these, I am still able to run the whole test suite in just 11 seconds.
https://github.com/ruby/prism/commit/5191b1aa68
|
|
type. Since a endless method is started with `=`, there was ambiguity here. We have to simply reject these in all cases.
This adds a new error for the following reason:
* `def foo arg = nil` is interpreted as a normal method call with optional `arg` without matching `end`
* `def foo *arg = nil; end` is interpreted as a endless method call that has body `nil` with extraneous `end`
`def foo *arg = nil` is somewhere inbetween and I don't know how to otherwise indicate the error.
Now the second case above also shows the newly added error message.
Fixes [Bug #21623]
https://github.com/ruby/prism/commit/e1910d4492
|
|
arguments
https://bugs.ruby-lang.org/issues/21168#note-5
The added code samples align with `parse.y`, except for `foo(bar baz do end)` which `parse.y` currently rejects but shouldn't.
https://github.com/ruby/prism/commit/3a4e102d80
|
|
and also `1 and foo = bar baz`
This is a partial fix for https://github.com/ruby/prism/issues/3106
It still accepts `a = b c and 1`
https://github.com/ruby/prism/commit/7a13d3535b
|
|
This was a limitation of parse.y that prism intentionally replicated.
https://github.com/ruby/prism/commit/8fd12d594c
|
|
The same also applies to `break`/`next`.
https://bugs.ruby-lang.org/issues/21540
https://github.com/ruby/prism/commit/3a38b192e3
|
|
command calls
https://github.com/ruby/prism/commit/d9151b8a82
|
|
A command-call-like `not true` must be rejected after `&&` and `||`.
https://bugs.ruby-lang.org/issues/21337
https://github.com/ruby/prism/commit/0513cf22ad
|
|
Previously, endless method definitions in assignment contexts like
`x = def f = p 1` would fail to parse because command calls (method
calls without parentheses) were only accepted when the surrounding
binding power was less than `PM_BINDING_POWER_COMPOSITION`.
This fix specifically checks for assignment context and allows command
calls in those cases while maintaining the existing behavior for other
contexts. This ensures that:
- `x = def f = p 1` parses correctly (previously failed)
- `private def f = puts "Hello"` still produces the expected error
https://github.com/ruby/prism/commit/722af59ba3
|
|
match
Related:
* https://bugs.ruby-lang.org/issues/20765
* https://github.com/ruby/prism/issues/2915
https://github.com/ruby/prism/commit/de56fa4a34
|
|
When arithmetic expressions like `-1**2` are used in pattern matching contexts,
Ruby crashes with "Unexpected node type in pattern matching expression: PM_CALL_NODE".
This happens because the Prism parser creates `PM_CALL_NODE` for arithmetic operations,
but Ruby's pattern matching compiler doesn't handle call nodes.
This fix adds validation to reject `PM_CALL_NODE` in pattern contexts with a proper
syntax error.
https://github.com/ruby/prism/commit/365049a767
|
|
command calls
https://github.com/ruby/prism/commit/d9151b8a82
|
|
A command-call-like `not true` must be rejected after `&&` and `||`.
https://bugs.ruby-lang.org/issues/21337
https://github.com/ruby/prism/commit/0513cf22ad
|
|
[Bug #21197]
https://github.com/ruby/prism/commit/22be955ce9
Notes:
Merged: https://github.com/ruby/ruby/pull/12999
|
|
https://github.com/ruby/prism/commit/f734350499
|
|
Fixes [Bug #21145]
https://github.com/ruby/prism/commit/be2d845639
|
|
Fixes [Bug #21117]
https://github.com/ruby/prism/commit/19d4bab5a0
|
|
When recovering from a depth error that occurs at the end of the
file, we need to break out of parsing statements.
Fixes [Bug #21114]
https://github.com/ruby/prism/commit/a32e268787
|
|
Fixes: https://bugs.ruby-lang.org/issues/20785
https://github.com/ruby/prism/commit/192960ce5d
|
|
inside array"
https://github.com/ruby/prism/commit/51e7c84124
|
|
`a => [-2**b]` should be SyntaxError
Fixes: https://github.com/ruby/prism/issues/3381
https://github.com/ruby/prism/commit/ae8e83b389
|
|
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/21010
https://github.com/ruby/prism/commit/43c16a89ef
|
|
Fix https://bugs.ruby-lang.org/issues/20977
Notes:
Merged: https://github.com/ruby/ruby/pull/12424
|
|
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#3112
https://github.com/ruby/prism/commit/754cf8eddc
Notes:
Merged: https://github.com/ruby/ruby/pull/12358
|
|
Actually close [Bug #20952]
Notes:
Merged: https://github.com/ruby/ruby/pull/12343
|
|
Fixes [Bug #20952]
Notes:
Merged: https://github.com/ruby/ruby/pull/12342
|
|
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/3291
https://github.com/ruby/prism/commit/d4fc441838
|
|
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/20918
https://github.com/ruby/prism/commit/60bc43de8e
|
|
required
Partially fixes: #3171
https://github.com/ruby/prism/commit/d0d9699c27
|
|
match required
Partially fixes: https://github.com/ruby/prism/issues/3171
https://github.com/ruby/prism/commit/5c33fa5a1a
|
|
Fixes: https://github.com/ruby/prism/issues/3109
https://github.com/ruby/prism/commit/9ed989c30d
|
|
https://github.com/ruby/prism/commit/70c1cd480f
|
|
https://github.com/ruby/prism/commit/232a02acef
|
|
https://github.com/ruby/prism/commit/3a0b1c6110
|
|
https://github.com/ruby/prism/commit/dbd5c929d6
|
|
https://github.com/ruby/prism/commit/023e894b74
|
|
https://github.com/ruby/prism/commit/80cd335222
|
|
https://github.com/ruby/prism/commit/5dd36b979e
|
|
https://github.com/ruby/prism/commit/aee2de91a3
|