1169 Commits
Author SHA1 Message Date
Takashi Kokubun d8cd2c2e89 [ruby/prism] Bump the remaining version references to v1.8.2
(https://github.com/ruby/prism/pull/4301)

https://github.com/ruby/prism/commit/6870939137
2026-10-22 06:10:37 +00:00
Takashi Kokubun db71375c5d [ruby/prism] Bump to v1.8.2
(https://github.com/ruby/prism/pull/4300)

https://github.com/ruby/prism/commit/d819a226af
2026-10-22 06:10:37 +00:00
Kevin Newton 62752fb9e3 [ruby/prism] Fix assume warning
That attribute is C++23, not C23

https://github.com/ruby/prism/commit/656e8f72a4
2026-10-22 06:10:37 +00:00
Kevin Newton ec4c25ab9d [ruby/prism] Assume for the GCC bounds checks
https://github.com/ruby/prism/commit/fe4054ddf2
2026-10-22 06:10:36 +00:00
Kevin Newton 0cd151f4b6 [ruby/prism] Reverse-sync from upstream
https://github.com/ruby/prism/commit/e8da28b4cb
2026-10-22 06:10:36 +00:00
Earlopain 479bab3e03 [ruby/prism] Remove a warning from discarded-qualifiers
I've been seeing this for a while now:
```
../../../../ext/prism/../../src/memchr.c: In function ‘pm_memchr’:
../../../../ext/prism/../../src/memchr.c:35:16: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   35 |         return memchr(memory, character, number);
      |                ^~~~~~
```

https://github.com/ruby/prism/commit/a3b1f10dbc
(cherry picked from commit ce398d7545)
2026-10-21 22:08:54 -07:00
Takashi Kokubun 3fd1181a9d Bump Prism to v1.8.1 2026-03-16 15:46:12 -07:00
Takashi Kokubun 6b47e3f82c [ruby/prism] Fix not binding power in endless methods [Backport #21097]
Change rescue modifier binding power from PM_BINDING_POWER_COMPOSITION
to PM_BINDING_POWER_MATCH + 1, so that `x = a rescue b in c` is parsed
as `(x = (a rescue b)) in c` and `def f = a rescue b in c` is parsed
as `(def f = (a rescue b)) in c`.

https://github.com/ruby/prism/commit/7e797f59ae
2026-03-16 12:24:01 -07:00
Kevin Newton b5a768b666 [ruby/prism] Fix in handling
in is a unique keyword because it can be the start of a clause or
an infix keyword. We need to be explicitly sure that even though in
_could_ close an expression context (the body of another in clause)
that we are not also parsing an inline in. The exception is the
case of a command call, which can never be the LHS of an expression,
and so we must immediately exit.

[Bug #21925]
[Bug #21674]

https://github.com/ruby/prism/commit/20374ced51
2026-03-06 09:02:23 -08:00
Earlopain e7d2828fb6 [ruby/prism] Fix error message for block/lambda with ... argument
They currently complain that the parent method is not forwarding.
But the actual problem is that these types of arguments simply don't
accept `...`

Fixes [Bug #21927]

https://github.com/ruby/prism/commit/0aa2363331
2026-03-06 09:02:23 -08:00
Earlopain 83c261f30b [ruby/prism] Correctly handle and? and similar on ruby 4.0
It gets confused for syntax introduced in https://bugs.ruby-lang.org/issues/20925
But it actually should be a plain method call.
`!`/`?` are not valid as part of an identifier, methods
however allow them as the last character.

Fixes [Bug #21946]

https://github.com/ruby/prism/commit/5d80bc5e1a
2026-03-06 09:02:23 -08:00
Takashi Kokubun a10f7fac1f Sync Prism to 1.8.0 2026-01-12 17:59:55 -08:00
Kevin Newton 5c0c0dd873 [ruby/prism] Bump to v1.7.0
https://github.com/ruby/prism/commit/21c499d6e4
2025-12-18 19:58:53 -05:00
Earlopain e2c886dd66 [ruby/prism] Reject p(p a, &block => value) and similar
Redo of https://github.com/ruby/prism/pull/3669 with more tests

https://github.com/ruby/prism/commit/48b403ea79
2025-12-18 19:58:53 -05:00
Earlopain 76248400b7 [ruby/prism] Add Ruby 4.1 as a version specifier
https://github.com/ruby/prism/commit/138db9ccc4
2025-12-18 19:58:53 -05:00
Kevin Newton ac946e076c [ruby/prism] Unreference before destroying in call node in pattern
https://github.com/ruby/prism/commit/609c80c91e
2025-12-15 13:43:53 +00:00
Kevin Newton eceab2f44c [ruby/prism] Escape error location is incorrect for some regex
When you have a regular expression that has a named capture that
has an escape sequence in the named capture, and that escape
sequence is a unicode escape sequence with an invalid surrogate
pair, the error was attached to the owned string as opposed to a
location on the shared source.

https://github.com/ruby/prism/commit/793a7a6a0a
2025-12-15 11:38:29 +00:00
Kevin Newton 529b49144e [ruby/prism] Only set location end when it is larger
https://github.com/ruby/prism/commit/65595d6c2c
2025-12-14 17:14:16 +00:00
Kevin Newton ca08351546 [ruby/prism] Unreference the block node before destroying it
https://github.com/ruby/prism/commit/fc150b1588
2025-12-14 17:14:02 +00:00
Steven Johnstone 0561eb9425 [ruby/prism] Prevent an infinite loop parsing a capture name
Fixes https://github.com/ruby/prism/pull/3729.

https://github.com/ruby/prism/commit/6e5347803c
2025-12-13 14:29:47 +00:00
Kevin Newton 59314911a1 [ruby/prism] Nested heredoc with newline terminator
When you have a heredoc interpolated into another heredoc where
the inner heredoc is terminated by a newline, you need to avoid
adding the newline character a second time.

https://github.com/ruby/prism/commit/8eeb5f358b
2025-12-09 02:43:51 +00:00
Kevin Newton 268cbb29c7 [ruby/prism] Fully handle unreferencing a block exit
If a block exit has a further block exit in its subtree, we need to
keep recursing.

https://github.com/ruby/prism/commit/855d81a4a8
2025-12-09 02:43:33 +00:00
Kevin Newton cbf39c3be5 [ruby/prism] Fix up call target node when invalid
When there is an invalid syntax tree, we need to make sure to fill
in the required call operator location.

https://github.com/ruby/prism/commit/937313d7f0
2025-12-09 02:43:24 +00:00
Kevin Newton 71354a9879 [ruby/prism] Fix hash pattern location when missing nodes
https://github.com/ruby/prism/commit/0ad30561e2
2025-12-09 02:43:05 +00:00
Nobuyoshi Nakada 4080abecd6 Ignore distclean failures
Just clean the directory if it exists and is empty.
2025-12-07 21:18:00 +09:00
Steven Johnstone 0346206d3e [ruby/prism] Avoid out-of-bounds reads
Fixes https://github.com/ruby/prism/pull/3790.

https://github.com/ruby/prism/commit/173ccb84ad
2025-12-06 11:11:40 +00:00
Kevin Newton 786f673938 [ruby/prism] Correct constant pool bucket type logic
When replacing an owned constant by a different type (constant or
shared) replace with the correct type instead of defaulting to
shared.

https://github.com/ruby/prism/commit/fbe9b131a1
2025-12-05 20:35:31 +00:00
Steven Johnstone be12e19856 [ruby/prism] Avoid undefined int overflow behaviour
Fixes https://github.com/ruby/prism/pull/3786.

https://github.com/ruby/prism/commit/b72b664675
2025-12-05 20:21:28 +00:00
Steven Johnstone 834adc358a [ruby/prism] Avoid out-of-bounds reads
Fixes https://github.com/ruby/prism/pull/3784.

https://github.com/ruby/prism/commit/3fe862534b
2025-12-05 20:20:18 +00:00
Earlopain 465a86c341 [ruby/prism] Fix %Q with newline delimiter and heredoc interpolation
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
2025-12-04 14:50:46 +00:00
Earlopain d5c7cf0a1a [ruby/prism] Fix wrong error message for lower percent i arrays
Not so sure how to trigger it but this is definitly more correct.

https://github.com/ruby/prism/commit/1bc8ec5e5d
2025-12-03 18:24:14 +00:00
Earlopain ed31a0caa8 [ruby/prism] Correctly handle line continuations in %w/i% interrupted by heredocs
See https://bugs.ruby-lang.org/issues/21756. Ripper fails to parse this,
but prism actually also doesn't handle it correctly.

When heredocs are used, even in lowercase percent arays there can be
multiple `STRING_CONTENT` tokens. We need to concat them.

Luckily we don't need to handle as many cases as in uppercase arrays where interpolation is allowed.

https://github.com/ruby/prism/commit/211677000e
2025-12-03 18:24:14 +00:00
Benoit Daloze d7dffcdbee [ruby/prism] Follow repo move from oracle/truffleruby to truffleruby/truffleruby
https://github.com/ruby/prism/commit/c8e1b11120
2025-12-03 16:34:51 +00:00
Kevin Newton e0746cc443 [ruby/prism] Consolidate macro definitions
https://github.com/ruby/prism/commit/cc0ca08757
2025-12-02 22:14:51 +00:00
Kevin Newton a1ea824b85 [ruby/prism] Remove PM_OPTIONAL_LOCATION_NOT_PROVIDED_VALUE macro
https://github.com/ruby/prism/commit/1988615ce1
2025-12-02 22:14:51 +00:00
Kevin Newton a55040cac5 [ruby/prism] Further specialize PM_NODE_INIT
https://github.com/ruby/prism/commit/7ab6d9df47
2025-12-02 22:14:51 +00:00
Kevin Newton 56ee55b162 [ruby/prism] Introduce PM_NODE_FLAGS macro
https://github.com/ruby/prism/commit/a20afe1674
2025-12-02 22:14:51 +00:00
Kevin Newton 68617fb62b [ruby/prism] Specialize PM_NODE_INIT to reduce calls to location
https://github.com/ruby/prism/commit/3e0b5c9eb7
2025-12-02 22:14:50 +00:00
Kevin Newton 8d2f73d70a [ruby/prism] Introduce PM_NODE_UPCAST macro for readability
https://github.com/ruby/prism/commit/7eb169513a
2025-12-02 22:14:50 +00:00
Kevin Newton 8dc5822b00 [ruby/prism] PM_NODE_INIT
Hide the initialization of the base node inside the node
initializer lists by a macro. As such, consistently enforce flags
are set properly.

https://github.com/ruby/prism/commit/c7b3d66d84
2025-12-01 14:46:36 +00:00
Kevin Newton 4c56001d27 [ruby/prism] Fix up newlines in newline-delimited-literals
When you have a %-literal that is delimited by newlines, and you
are also interpolating a heredoc into that literal, then both
concepts will attempt to add the same newline to the newline list.

https://github.com/ruby/prism/commit/c831abb888
2025-12-01 02:35:13 +00:00
Kevin Newton bcdad7f286 [ruby/prism] Properly remove references
https://github.com/ruby/prism/commit/17b246fd6a
2025-12-01 01:44:25 +00:00
Kevin Newton 3bd9583a52 [ruby/prism] Update unicode tables to match that of CRuby
The unicode version has been updated upstream, which means new
codepoints mapped to alpha/alnum/isupper flags. We need to update
our tables to match.

I'm purposefully not adding a version check here, since that is
such a large amount of code. It's possible that we could include
different tables depending on a macro (like UNICODE_VERSION) or
something to that effect, but it's such a minimal impact on the
running of the actual parser that I don't think it's necessary.

https://github.com/ruby/prism/commit/78925fe5b6
2025-11-30 04:24:06 +00:00
Kevin Newton c4b5fa419e [ruby/prism] Ensure implicit parameter nodes are destroyed.
When we are about to destroy a node because of a syntax error, we
need to check if it is potentially containing an implicit
parameter in its subtree.

https://github.com/ruby/prism/commit/1531433e02
2025-11-30 02:08:52 +00:00
Kevin Newton b1314f159e [ruby/prism] Fully destroy call operator write arguments
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
2025-11-30 02:08:41 +00:00
Kevin Newton e3bc1852b3 [ruby/prism] Revert "Fix invalid Ruby code example in ClassNode comment"
https://github.com/ruby/prism/commit/b960079559
2025-11-29 21:00:53 +00:00
Kevin NewtonandSteven Johnstone 748dc9ac8d [ruby/prism] Fix out-of-bounds read in parser_lex_magic_comment
https://github.com/ruby/prism/commit/e24e701f3a

Co-authored-by: Steven Johnstone <steven.james.johnstone@gmail.com>
2025-11-29 19:48:37 +00:00
Kevin Newton 7c2eb946e0 [ruby/prism] Fix label interpolated string
https://github.com/ruby/prism/commit/e3e2b1ed04
2025-11-29 19:48:30 +00:00
Kevin NewtonandSteven Johnstone f0f2a45f2d [ruby/prism] Fix out-of-bounds read after utf-8 BOM
https://github.com/ruby/prism/commit/198080c106

Co-authored-by: Steven Johnstone <steven.james.johnstone@gmail.com>
2025-11-29 19:48:08 +00:00
Kevin Newton f2a6cb2dc8 [ruby/prism] Handle invalid string pattern key
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
2025-11-29 19:47:45 +00:00