<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/prism/ruby, branch v3_4_9</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Bump Prism to v1.5.2</title>
<updated>2025-12-08T23:30:35+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-12-08T22:56:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d282e76fb6c9f56ac44b3abfc8a3fc9f10edd6f0'/>
<id>d282e76fb6c9f56ac44b3abfc8a3fc9f10edd6f0</id>
<content type='text'>
[Backport #21187]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Backport #21187]
</pre>
</div>
</content>
</entry>
<entry>
<title>Bump Prism version to 1.5.0</title>
<updated>2025-09-12T21:30:16+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-09-12T20:09:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=52b3f006cb31672c45b26f6a44a609fd1b8e2ee5'/>
<id>52b3f006cb31672c45b26f6a44a609fd1b8e2ee5</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Relocation</title>
<updated>2024-10-16T15:56:01+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-10-15T12:37:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=550ae745f6ad400c2de381ed21ed65ae6f574c6d'/>
<id>550ae745f6ad400c2de381ed21ed65ae6f574c6d</id>
<content type='text'>
https://github.com/ruby/prism/commit/5ea6042408
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/5ea6042408
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Prism::StringQuery</title>
<updated>2024-10-11T19:34:57+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-10-11T18:43:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5f62522d5b8bd162ddf657680b8532eadeaae21f'/>
<id>5f62522d5b8bd162ddf657680b8532eadeaae21f</id>
<content type='text'>
Introduce StringQuery to provide methods to access some metadata
about the Ruby lexer.

https://github.com/ruby/prism/commit/d3f55b67b9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introduce StringQuery to provide methods to access some metadata
about the Ruby lexer.

https://github.com/ruby/prism/commit/d3f55b67b9
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Prism::CodeUnitsCache</title>
<updated>2024-10-10T18:02:27+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-10-09T18:40:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7a198af7cdb437c5245ac3ab70cb66cef2002d06'/>
<id>7a198af7cdb437c5245ac3ab70cb66cef2002d06</id>
<content type='text'>
Calculating code unit offsets for a source can be very expensive,
especially when the source is large. This commit introduces a new
class that wraps the source and desired encoding into a cache that
reuses pre-computed offsets. It performs quite a bit better.

There are still some problems with this approach, namely character
boundaries and the fact that the cache is unbounded, but both of
these may be addressed in subsequent commits.

https://github.com/ruby/prism/commit/2e3e1a4d4d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Calculating code unit offsets for a source can be very expensive,
especially when the source is large. This commit introduces a new
class that wraps the source and desired encoding into a cache that
reuses pre-computed offsets. It performs quite a bit better.

There are still some problems with this approach, namely character
boundaries and the fact that the cache is unbounded, but both of
these may be addressed in subsequent commits.

https://github.com/ruby/prism/commit/2e3e1a4d4d
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Attempt to assume binary is UTF-8</title>
<updated>2024-10-09T15:42:23+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2024-10-09T14:34:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e39e582594feaeb40722b2921e8feb562d94269b'/>
<id>e39e582594feaeb40722b2921e8feb562d94269b</id>
<content type='text'>
https://github.com/ruby/prism/commit/343197e4ff
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/343197e4ff
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Avoid breaking code units offset on binary encoding</title>
<updated>2024-10-09T14:07:10+00:00</updated>
<author>
<name>Vinicius Stock</name>
<email>vinicius.stock@shopify.com</email>
</author>
<published>2024-10-08T14:47:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e50754fcfaeb80bef93f043c13895ce386ddb18c'/>
<id>e50754fcfaeb80bef93f043c13895ce386ddb18c</id>
<content type='text'>
https://github.com/ruby/prism/commit/25a4cf6794

Co-authored-by: Kevin Newton &lt;kddnewton@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/25a4cf6794

Co-authored-by: Kevin Newton &lt;kddnewton@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix `kDO_LAMBDA` token incompatibility for `Prism::Translation::Parser::Lexer`</title>
<updated>2024-09-20T17:17:21+00:00</updated>
<author>
<name>Koichi ITO</name>
<email>koic.ito@gmail.com</email>
</author>
<published>2024-09-10T03:22:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=75ed086348da66e4cfe9488ae9ece5462dd2aef9'/>
<id>75ed086348da66e4cfe9488ae9ece5462dd2aef9</id>
<content type='text'>
## Summary

This PR fixes `kDO_LAMBDA` token incompatibility between Parser gem and `Prism::Translation::Parser` for lambda `do` block.

### Parser gem (Expected)

Returns `kDO_LAMBDA` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; do end"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:kDO_LAMBDA, ["do", #&lt;Parser::Source::Range example.rb 3...5&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 6...9&gt;]]]
```

### `Prism::Translation::Parser` (Actual)

Previously, the parser returned `kDO` token when parsing the following:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:kDO, ["do", #&lt;Parser::Source::Range example.rb 3...5&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 6...9&gt;]]]
```

After the update, the parser now returns `kDO_LAMBDA` token for the same input:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:kDO_LAMBDA, ["do", #&lt;Parser::Source::Range example.rb 3...5&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 6...9&gt;]]]
```

## Additional Information

Unfortunately, this kind of edge case doesn't work as expected; `kDO` is returned instead of `kDO_LAMBDA`.
However, since `kDO` is already being returned in this case, there is no change in behavior.

### Parser gem

Returns `tLAMBDA` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; (foo = -&gt; (bar) {}) do end"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.3.5 (2024-09-03 revision https://github.com/ruby/prism/commit/ef084cc8f4) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 4...7&gt;]], [:tEQL, ["=", #&lt;Parser::Source::Range example.rb 8...9&gt;]],
[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 10...12&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 13...14&gt;]],
[:tIDENTIFIER, ["bar", #&lt;Parser::Source::Range example.rb 14...17&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 17...18&gt;]],
[:tLAMBEG, ["{", #&lt;Parser::Source::Range example.rb 19...20&gt;]], [:tRCURLY, ["}", #&lt;Parser::Source::Range example.rb 20...21&gt;]],
[:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 21...22&gt;]], [:kDO_LAMBDA, ["do", #&lt;Parser::Source::Range example.rb 23...25&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 26...29&gt;]]]
```

### `Prism::Translation::Parser`

Returns `kDO` token:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; (foo = -&gt; (bar) {}) do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.3.5 (2024-09-03 revision https://github.com/ruby/prism/commit/ef084cc8f4) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 4...7&gt;]], [:tEQL, ["=", #&lt;Parser::Source::Range example.rb 8...9&gt;]],
[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 10...12&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 13...14&gt;]],
[:tIDENTIFIER, ["bar", #&lt;Parser::Source::Range example.rb 14...17&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 17...18&gt;]],
[:tLAMBEG, ["{", #&lt;Parser::Source::Range example.rb 19...20&gt;]], [:tRCURLY, ["}", #&lt;Parser::Source::Range example.rb 20...21&gt;]],
[:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 21...22&gt;]], [:kDO, ["do", #&lt;Parser::Source::Range example.rb 23...25&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 26...29&gt;]]]
```

As the intention is not to address such special cases at this point, a comment has been left indicating that this case still returns `kDO`.
In other words, `kDO_LAMBDA` will now be returned except for edge cases after this PR.

https://github.com/ruby/prism/commit/2ee480654c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
## Summary

This PR fixes `kDO_LAMBDA` token incompatibility between Parser gem and `Prism::Translation::Parser` for lambda `do` block.

### Parser gem (Expected)

Returns `kDO_LAMBDA` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; do end"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:kDO_LAMBDA, ["do", #&lt;Parser::Source::Range example.rb 3...5&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 6...9&gt;]]]
```

### `Prism::Translation::Parser` (Actual)

Previously, the parser returned `kDO` token when parsing the following:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:kDO, ["do", #&lt;Parser::Source::Range example.rb 3...5&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 6...9&gt;]]]
```

After the update, the parser now returns `kDO_LAMBDA` token for the same input:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:kDO_LAMBDA, ["do", #&lt;Parser::Source::Range example.rb 3...5&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 6...9&gt;]]]
```

## Additional Information

Unfortunately, this kind of edge case doesn't work as expected; `kDO` is returned instead of `kDO_LAMBDA`.
However, since `kDO` is already being returned in this case, there is no change in behavior.

### Parser gem

Returns `tLAMBDA` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; (foo = -&gt; (bar) {}) do end"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.3.5 (2024-09-03 revision https://github.com/ruby/prism/commit/ef084cc8f4) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 4...7&gt;]], [:tEQL, ["=", #&lt;Parser::Source::Range example.rb 8...9&gt;]],
[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 10...12&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 13...14&gt;]],
[:tIDENTIFIER, ["bar", #&lt;Parser::Source::Range example.rb 14...17&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 17...18&gt;]],
[:tLAMBEG, ["{", #&lt;Parser::Source::Range example.rb 19...20&gt;]], [:tRCURLY, ["}", #&lt;Parser::Source::Range example.rb 20...21&gt;]],
[:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 21...22&gt;]], [:kDO_LAMBDA, ["do", #&lt;Parser::Source::Range example.rb 23...25&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 26...29&gt;]]]
```

### `Prism::Translation::Parser`

Returns `kDO` token:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "-&gt; (foo = -&gt; (bar) {}) do end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.3.5 (2024-09-03 revision https://github.com/ruby/prism/commit/ef084cc8f4) [x86_64-darwin23]
[[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 0...2&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 4...7&gt;]], [:tEQL, ["=", #&lt;Parser::Source::Range example.rb 8...9&gt;]],
[:tLAMBDA, ["-&gt;", #&lt;Parser::Source::Range example.rb 10...12&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 13...14&gt;]],
[:tIDENTIFIER, ["bar", #&lt;Parser::Source::Range example.rb 14...17&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 17...18&gt;]],
[:tLAMBEG, ["{", #&lt;Parser::Source::Range example.rb 19...20&gt;]], [:tRCURLY, ["}", #&lt;Parser::Source::Range example.rb 20...21&gt;]],
[:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 21...22&gt;]], [:kDO, ["do", #&lt;Parser::Source::Range example.rb 23...25&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 26...29&gt;]]]
```

As the intention is not to address such special cases at this point, a comment has been left indicating that this case still returns `kDO`.
In other words, `kDO_LAMBDA` will now be returned except for edge cases after this PR.

https://github.com/ruby/prism/commit/2ee480654c
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix a token incompatibility for `Prism::Translation::Parser::Lexer`</title>
<updated>2024-09-09T19:01:30+00:00</updated>
<author>
<name>Koichi ITO</name>
<email>koic.ito@gmail.com</email>
</author>
<published>2024-09-08T09:25:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7a6533452807aa432f097db4e637e4c480645d6b'/>
<id>7a6533452807aa432f097db4e637e4c480645d6b</id>
<content type='text'>
This PR fixes a token incompatibility between Parser gem and `Prism::Translation::Parser` for double splat argument.

## Parser gem (Expected)

Returns `tDSTAR` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "def f(**foo) end"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:kDEF, ["def", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tIDENTIFIER, ["f", #&lt;Parser::Source::Range example.rb 4...5&gt;]],
[:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 5...6&gt;]], [:tDSTAR, ["**", #&lt;Parser::Source::Range example.rb 6...8&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 8...11&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 11...12&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 13...16&gt;]]]
```

## `Prism::Translation::Parser` (Actual)

Previously, the parser returned `tPOW` token when parsing the following:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "def f(**foo) end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:kDEF, ["def", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tIDENTIFIER, ["f", #&lt;Parser::Source::Range example.rb 4...5&gt;]],
[:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 5...6&gt;]], [:tPOW, ["**", #&lt;Parser::Source::Range example.rb 6...8&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 8...11&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 11...12&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 13...16&gt;]]]
```

After the update, the parser now returns `tDSTAR` token for the same input:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "def f(**foo) end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:kDEF, ["def", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tIDENTIFIER, ["f", #&lt;Parser::Source::Range example.rb 4...5&gt;]],
[:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 5...6&gt;]], [:tDSTAR, ["**", #&lt;Parser::Source::Range example.rb 6...8&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 8...11&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 11...12&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 13...16&gt;]]]
```

With this change, the following code could be removed from test/prism/ruby/parser_test.rb:

```diff
-          when :tPOW
-            actual_token[0] = expected_token[0] if expected_token[0] == :tDSTAR
```

`tPOW` is the token type for the behavior of `a ** b`, and its behavior remains unchanged:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "a ** b"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tIDENTIFIER, ["a", #&lt;Parser::Source::Range example.rb 0...1&gt;]], [:tPOW, ["**", #&lt;Parser::Source::Range example.rb 2...4&gt;]],
[:tIDENTIFIER, ["b", #&lt;Parser::Source::Range example.rb 5...6&gt;]]]
```

https://github.com/ruby/prism/commit/66bde35a44
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR fixes a token incompatibility between Parser gem and `Prism::Translation::Parser` for double splat argument.

## Parser gem (Expected)

Returns `tDSTAR` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "def f(**foo) end"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:kDEF, ["def", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tIDENTIFIER, ["f", #&lt;Parser::Source::Range example.rb 4...5&gt;]],
[:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 5...6&gt;]], [:tDSTAR, ["**", #&lt;Parser::Source::Range example.rb 6...8&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 8...11&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 11...12&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 13...16&gt;]]]
```

## `Prism::Translation::Parser` (Actual)

Previously, the parser returned `tPOW` token when parsing the following:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "def f(**foo) end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:kDEF, ["def", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tIDENTIFIER, ["f", #&lt;Parser::Source::Range example.rb 4...5&gt;]],
[:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 5...6&gt;]], [:tPOW, ["**", #&lt;Parser::Source::Range example.rb 6...8&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 8...11&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 11...12&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 13...16&gt;]]]
```

After the update, the parser now returns `tDSTAR` token for the same input:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "def f(**foo) end"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:kDEF, ["def", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tIDENTIFIER, ["f", #&lt;Parser::Source::Range example.rb 4...5&gt;]],
[:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 5...6&gt;]], [:tDSTAR, ["**", #&lt;Parser::Source::Range example.rb 6...8&gt;]],
[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 8...11&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 11...12&gt;]],
[:kEND, ["end", #&lt;Parser::Source::Range example.rb 13...16&gt;]]]
```

With this change, the following code could be removed from test/prism/ruby/parser_test.rb:

```diff
-          when :tPOW
-            actual_token[0] = expected_token[0] if expected_token[0] == :tDSTAR
```

`tPOW` is the token type for the behavior of `a ** b`, and its behavior remains unchanged:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "a ** b"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tIDENTIFIER, ["a", #&lt;Parser::Source::Range example.rb 0...1&gt;]], [:tPOW, ["**", #&lt;Parser::Source::Range example.rb 2...4&gt;]],
[:tIDENTIFIER, ["b", #&lt;Parser::Source::Range example.rb 5...6&gt;]]]
```

https://github.com/ruby/prism/commit/66bde35a44
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix a token incompatibility for `Prism::Translation::Parser::Lexer`</title>
<updated>2024-09-07T22:36:38+00:00</updated>
<author>
<name>Koichi ITO</name>
<email>koic.ito@gmail.com</email>
</author>
<published>2024-09-07T14:21:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=47742841246c637053dc8dad447c7e5e28182676'/>
<id>47742841246c637053dc8dad447c7e5e28182676</id>
<content type='text'>
This PR fixes a token incompatibility between Parser gem and `Prism::Translation::Parser` for left parenthesis.

## Parser gem (Expected)

Returns `tLPAREN2` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 \
-ve 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "foo(:bar)"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tSYMBOL, ["bar", #&lt;Parser::Source::Range example.rb 4...8&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 8...9&gt;]]]
```

## `Prism::Translation::Parser` (Actual)

Previously, the parser returned `tLPAREN` token when parsing the following:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "foo(:bar)"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tLPAREN, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tSYMBOL, ["bar", #&lt;Parser::Source::Range example.rb 4...8&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 8...9&gt;]]]
```

After the update, the parser now returns `tLPAREN2` token for the same input:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "foo(:bar)"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tSYMBOL, ["bar", #&lt;Parser::Source::Range example.rb 4...8&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 8...9&gt;]]]
```

The `PARENTHESIS_LEFT` token in Prism is classified as either `tLPAREN` or `tLPAREN2` in the Parser gem.
The tokens that were previously all classified as `tLPAREN` are now also classified to `tLPAREN2`.

With this change, the following code could be removed from `test/prism/ruby/parser_test.rb`:

```diff
-          when :tLPAREN
-            actual_token[0] = expected_token[0] if expected_token[0] == :tLPAREN2
```

https://github.com/ruby/prism/commit/04d6f3478d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR fixes a token incompatibility between Parser gem and `Prism::Translation::Parser` for left parenthesis.

## Parser gem (Expected)

Returns `tLPAREN2` token:

```console
$ bundle exec ruby -Ilib -rparser/ruby33 \
-ve 'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "foo(:bar)"; p Parser::Ruby33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tSYMBOL, ["bar", #&lt;Parser::Source::Range example.rb 4...8&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 8...9&gt;]]]
```

## `Prism::Translation::Parser` (Actual)

Previously, the parser returned `tLPAREN` token when parsing the following:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "foo(:bar)"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tLPAREN, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tSYMBOL, ["bar", #&lt;Parser::Source::Range example.rb 4...8&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 8...9&gt;]]]
```

After the update, the parser now returns `tLPAREN2` token for the same input:

```console
$ bundle exec ruby -Ilib -rprism -rprism/translation/parser33 -ve \
'buf = Parser::Source::Buffer.new("example.rb"); buf.source = "foo(:bar)"; p Prism::Translation::Parser33.new.tokenize(buf)[2]'
ruby 3.4.0dev (2024-09-01T11:00:13Z master https://github.com/ruby/prism/commit/eb144ef91e) [x86_64-darwin23]
[[:tIDENTIFIER, ["foo", #&lt;Parser::Source::Range example.rb 0...3&gt;]], [:tLPAREN2, ["(", #&lt;Parser::Source::Range example.rb 3...4&gt;]],
[:tSYMBOL, ["bar", #&lt;Parser::Source::Range example.rb 4...8&gt;]], [:tRPAREN, [")", #&lt;Parser::Source::Range example.rb 8...9&gt;]]]
```

The `PARENTHESIS_LEFT` token in Prism is classified as either `tLPAREN` or `tLPAREN2` in the Parser gem.
The tokens that were previously all classified as `tLPAREN` are now also classified to `tLPAREN2`.

With this change, the following code could be removed from `test/prism/ruby/parser_test.rb`:

```diff
-          when :tLPAREN
-            actual_token[0] = expected_token[0] if expected_token[0] == :tLPAREN2
```

https://github.com/ruby/prism/commit/04d6f3478d
</pre>
</div>
</content>
</entry>
</feed>
