Commit graph

32 commits

Author SHA1 Message Date
Haldun Bayhantopcu
67c5690a6d [ruby/prism] Check literals for receiver
56441b08e7
2024-02-01 16:48:09 +00:00
Kevin Newton
ba06a8259a [ruby/prism] Better error messages for unexpected tokens in prefix
a35b8e45ee
2024-01-30 16:10:08 +00:00
Kevin Newton
e337c9478a [ruby/prism] Error follow-up
Split up the diagnostic levels so that error and warning levels
aren't mixed. Also fix up deconstruct_keys implementation.

bd3eeb308d

Co-authored-by: Benoit Daloze <eregontp@gmail.com>
2024-01-27 18:46:16 +00:00
Benoit Daloze
de135bc247 [ruby/prism] Add level to warnings and errors to categorize them
* Fixes https://github.com/ruby/prism/issues/2082

7a74576357
2024-01-26 21:34:34 +00:00
Takashi Kokubun
603f2ca730 [ruby/prism] Parse it default parameter
a0c5361b9f
2024-01-17 17:47:33 +00:00
TSUYUSATO Kitsune
0ee625ceae [ruby/prism] Fix to check multiple block arguments for forwarding arg
Fix https://github.com/ruby/prism/pull/2111

21ca243d0a
2024-01-02 19:08:15 +00:00
Hiroshi SHIBATA
fa251d60aa Revert "Revert all of commits after Prism 0.19.0 release"
This reverts commit d242e8416e.
2023-12-25 21:12:49 +09:00
Hiroshi SHIBATA
d242e8416e
Revert all of commits after Prism 0.19.0 release
We should bundle released version of Prism for Ruby 3.3.0
2023-12-16 11:08:51 +08:00
Kevin Newton
fe9b42f024 [ruby/prism] Invalid pinned locals in pattern matching
3a67b37a56
2023-12-15 15:03:49 +00:00
TSUYUSATO Kitsune
16830a4783 [ruby/prism] Add an error for in keyword in arguments
Fix https://github.com/ruby/prism/pull/2026

c4b41cd477
2023-12-15 13:25:54 +00:00
Kevin Newton
b7e89d4b17 [ruby/prism] Fix hash pattern rest
43c4232cfc
2023-12-14 02:43:32 +00:00
Alex Koval
04eb1b6f26 [ruby/prism] fix: escape newline
a28b427dcc
2023-12-10 03:06:36 +00:00
Kevin Newton
892b5f10d5 [ruby/prism] More closely match CRuby error messages
1ed07a0c6d
2023-12-08 14:34:34 +00:00
Haldun Bayhantopcu
ce094e8556 [ruby/prism] Emit error for constant assignments in defs
864b06f90e
2023-12-06 22:15:16 +00:00
Kevin Newton
82f18baa21 [ruby/prism] Provide flags for changing encodings
e838eaff6f
2023-12-06 14:23:38 -05:00
Lily Lyons
1227b6d912 [ruby/prism] Refactor pm_diagnostic_t and pm_comment_t to use pm_location_t
115b6a2fc6
2023-12-04 14:33:44 +00:00
TSUYUSATO Kitsune
a908cef53f [ruby/prism] Reject class/module defs in method params/rescue/ensure/else
Fix https://github.com/ruby/prism/pull/1936

232e77a003
2023-11-29 02:03:06 +00:00
Kevin Newton
0704f40787
Add in missing error 2023-11-28 12:35:11 -05:00
Kevin Newton
0164da68c1 [ruby/prism] Use un-capitalized error messages
I don't prefer this style, but it appears that a plurality of syntax
error messages between with un-capitalized messages in CRuby, so
we'll go with that for consistency, for now.

b02df68954
2023-11-28 02:53:44 +00:00
TSUYUSATO Kitsune
76f9abced7 [ruby/prism] Reject statements at non-statement posisions
Fix https://github.com/ruby/prism/pull/1547

cdb643aeab
2023-11-22 14:53:27 +00:00
Haldun Bayhantopcu
8966d06b96 [ruby/prism] Warning for ENDs in methods
(https://github.com/ruby/prism/pull/1899)

1b41c2d56c
2023-11-21 16:36:12 +00:00
Kevin Newton
5299b4a362 [ruby/prism] Build the ability to format errors
(https://github.com/ruby/prism/pull/1796)

Previously, we only supported error messages that were constant
strings. This works for the most part, but there are some times
where we want to include some part of the source in the error
message to make it better.

For example, instead of "Token is reserved" it's better to write
"_1 is reserved".

To do this, we now support allocating error messages at runtime
that are built around format strings.

7e6aa17deb
2023-11-21 02:43:18 +00:00
Kevin Newton
9fa524dd41 [ruby/prism] Split up CaseNode and CaseMatchNode
(https://github.com/ruby/prism/pull/1801)

4c1391ea56
2023-11-21 02:38:07 +00:00
Hiroya Fujinami
caa9ae7804 [ruby/prism] Fix parsing ... in arguments
(https://github.com/ruby/prism/pull/1882)

* Fix parsing `...` in arguments

Fix https://github.com/ruby/prism/pull/1830
Fix https://github.com/ruby/prism/pull/1831

* Rename the constant name to PM_ERR_ARGUMENT_FORWARDING_UNBOUND

https://github.com/ruby/prism/pull/1882#discussion_r1398461156

519653aec2
2023-11-20 15:52:44 +00:00
TSUYUSATO Kitsune
52a0f1d14b [ruby/prism] Add "Unexpected void value expression" error
88b7b8e1fc
2023-11-14 14:34:47 +00:00
Kevin Newton
1de05631b5 [ruby/prism] Documentation for diagnostics and regexp
16e0579044
2023-11-01 13:10:29 -04:00
Kevin Newton
2a6f7cd925 [ruby/prism] Index{Operator,And,Or}WriteNode
Right now, our Call{Operator,And,Or}WriteNode nodes represent two
different concepts:

```ruby
foo.bar += 1
foo[bar] += 1
```

These two statements are different in what they can support. The
former can never have arguments (or an opening_loc or closing_loc).
The former can also never have a block. Also, the former is a
variable method name.

The latter is always going to be []/[]=, it can have any number of
arguments including blocks (`foo[&bar] ||= 1`), and will always
have an opening_loc and closing_loc.

Furthermore, these statements end of having to take different paths
through the various compilers because with the latter you have to
consider the arguments and the block, whereas the former can
perform some additional peephole optimizations since there are
fewer values on the stack.

For these reasons, I'm introducing Index{Operator,And,Or}WriteNode.
These nodes never have a read_name or write_name on them because
they are always []/[]=. They also support blocks, which the previous
write nodes didn't. As a benefit of introducing these nodes, I've
removed the opening_loc, closing_loc, and arguments from the older
write nodes because they will always be null.

For the serialized format, both of these nodes end up being
smaller, and for in-memory we're storing fewer things in general,
so we have savings all around.

I don't love that we are introducing another node that is a call
node since we generally want consumers to only have to handle a
single call, but these nodes are so specific that they would have
to be handled separately anyway since in fact call 2 methods.

70155db9cd
2023-10-18 14:23:26 +00:00
Kevin Newton
1ae8c62483 [ruby/prism] Load magic comments in java
5d189ce33e
2023-10-16 15:40:19 -07:00
Haldun Bayhantopcu
7799fe90da [ruby/prism] Check for a semicolon or a newline after the inheritance operator
0326ba6775
2023-09-28 13:31:22 +00:00
Haldun Bayhantopcu
0084bac47a [ruby/prism] Fix assertion failure for fwd params after rest
f86bff6dd7
2023-09-28 13:24:57 +00:00
Kevin Newton
4f73a7c2f7 Sync to prism rename commits 2023-09-27 13:57:38 -04:00
Kevin Newton
8ab56869a6 Rename YARP filepaths to prism filepaths 2023-09-27 13:57:38 -04:00
Renamed from yarp/diagnostic.c (Browse further)