<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/lib/prism/translation/parser, branch v4.0.2</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>[ruby/prism] Add equal_loc to call nodes</title>
<updated>2025-10-30T13:06:09+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2025-10-26T20:16:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8e7d427a721ab715361c577fdea94fdebece6c6d'/>
<id>8e7d427a721ab715361c577fdea94fdebece6c6d</id>
<content type='text'>
In the case of attribute writes, there are use cases where you want
to know the location of the = sign. (Internally we actually need
this for translation to the writequark AST.)

https://github.com/ruby/prism/commit/bfc798a7ec
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the case of attribute writes, there are use cases where you want
to know the location of the = sign. (Internally we actually need
this for translation to the writequark AST.)

https://github.com/ruby/prism/commit/bfc798a7ec
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Reject some cases with `return` and command calls</title>
<updated>2025-09-11T15:55:55+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-08-29T20:35:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f17405b69cb8b66feed289d9f857c38ce70bfe26'/>
<id>f17405b69cb8b66feed289d9f857c38ce70bfe26</id>
<content type='text'>
The same also applies to `break`/`next`.

https://bugs.ruby-lang.org/issues/21540

https://github.com/ruby/prism/commit/3a38b192e3
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The same also applies to `break`/`next`.

https://bugs.ruby-lang.org/issues/21540

https://github.com/ruby/prism/commit/3a38b192e3
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Be more defensive in the parser translator lexer</title>
<updated>2025-08-14T15:42:33+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-08-14T15:05:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a04555c8ab109355d00275d28d867fce06805c55'/>
<id>a04555c8ab109355d00275d28d867fce06805c55</id>
<content type='text'>
Generally I have been good about safely accessing the tokens but failed
to properly guard against no tokens in places
where it could theoretically happen through invalid syntax.

I added a test case for one occurance, other changes are theoretical only.

https://github.com/ruby/prism/commit/4a3866af19
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Generally I have been good about safely accessing the tokens but failed
to properly guard against no tokens in places
where it could theoretically happen through invalid syntax.

I added a test case for one occurance, other changes are theoretical only.

https://github.com/ruby/prism/commit/4a3866af19
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix parser translator with trailing backslash in `%W` /`%I` array</title>
<updated>2025-06-30T12:32:31+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-06-12T12:12:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3071c5d04cb4369ee8118ece30fb2887205f6c61'/>
<id>3071c5d04cb4369ee8118ece30fb2887205f6c61</id>
<content type='text'>
https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html#label-25w+and+-25W-3A+String-Array+Literals
&gt; %W allow escape sequences described in Escape Sequences. However the continuation line &lt;newline&gt; is not usable because it is interpreted as the escaped newline described above.

https://github.com/ruby/prism/commit/f5c7460ad5
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html#label-25w+and+-25W-3A+String-Array+Literals
&gt; %W allow escape sequences described in Escape Sequences. However the continuation line &lt;newline&gt; is not usable because it is interpreted as the escaped newline described above.

https://github.com/ruby/prism/commit/f5c7460ad5
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix parser translator during string escaping with invalid utf-8</title>
<updated>2025-06-11T18:07:43+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-06-11T13:28:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=970813d98285b8f59fe5e4d3c815cc044926cb1b'/>
<id>970813d98285b8f59fe5e4d3c815cc044926cb1b</id>
<content type='text'>
Instead, prefer `scan_byte` over `get_byte` since that already returns the byte as an integer, sidestepping conversion issues.

Fixes https://github.com/ruby/prism/issues/3582

https://github.com/ruby/prism/commit/7f3008b2b5
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead, prefer `scan_byte` over `get_byte` since that already returns the byte as an integer, sidestepping conversion issues.

Fixes https://github.com/ruby/prism/issues/3582

https://github.com/ruby/prism/commit/7f3008b2b5
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] [DOC] Specify markdown mode to RDoc</title>
<updated>2025-05-29T04:45:58+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-05-28T10:25:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=991cf2dd4d611d5a8b275dfb3ec83c4d25799629'/>
<id>991cf2dd4d611d5a8b275dfb3ec83c4d25799629</id>
<content type='text'>
https://github.com/ruby/prism/commit/12af4e144e
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/ruby/prism/commit/12af4e144e
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix parsing rescued exception via indexed assignment</title>
<updated>2025-04-12T17:43:57+00:00</updated>
<author>
<name>viralpraxis</name>
<email>iaroslav2k@gmail.com</email>
</author>
<published>2025-04-10T08:56:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=543dd77cc39d16a45693d35af670995f7e66ce36'/>
<id>543dd77cc39d16a45693d35af670995f7e66ce36</id>
<content type='text'>
Given this code

```ruby
begin
  raise '42'
rescue =&gt; A[]
end
```

Prism fails with this backtrace

```
Error: test_unparser/corpus/literal/rescue.txt(Prism::ParserTest): NoMethodError: undefined method `arguments' for nil
prism/lib/prism/translation/parser/compiler.rb:1055:in `visit_index_target_node'
prism/lib/prism/node.rb:9636:in `accept'
prism/lib/prism/compiler.rb:30:in `visit'
prism/lib/prism/translation/parser/compiler.rb:218:in `visit_begin_node'
```

Seems like

```diff
-            visit_all(node.arguments.arguments),
+            visit_all(node.arguments&amp;.arguments || []),
```

fixes the problem.

https://github.com/ruby/prism/commit/76d01aeb6c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Given this code

```ruby
begin
  raise '42'
rescue =&gt; A[]
end
```

Prism fails with this backtrace

```
Error: test_unparser/corpus/literal/rescue.txt(Prism::ParserTest): NoMethodError: undefined method `arguments' for nil
prism/lib/prism/translation/parser/compiler.rb:1055:in `visit_index_target_node'
prism/lib/prism/node.rb:9636:in `accept'
prism/lib/prism/compiler.rb:30:in `visit'
prism/lib/prism/translation/parser/compiler.rb:218:in `visit_begin_node'
```

Seems like

```diff
-            visit_all(node.arguments.arguments),
+            visit_all(node.arguments&amp;.arguments || []),
```

fixes the problem.

https://github.com/ruby/prism/commit/76d01aeb6c
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix parser translator when splatting in pattern matching pin</title>
<updated>2025-04-02T20:51:54+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-03-30T11:28:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=334c261cc9ee125c4c4bfc65dec2e571af8944a2'/>
<id>334c261cc9ee125c4c4bfc65dec2e571af8944a2</id>
<content type='text'>
Because it ends up treating it as a local variable, and `a.x`
is not a valid local variable name.

I'm not big on pattern matching, but conceptually it makes sense to me
to treat anything inside ^() to not be
pattern matching syntax?

https://github.com/ruby/prism/commit/80dbd85c45
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Because it ends up treating it as a local variable, and `a.x`
is not a valid local variable name.

I'm not big on pattern matching, but conceptually it makes sense to me
to treat anything inside ^() to not be
pattern matching syntax?

https://github.com/ruby/prism/commit/80dbd85c45
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix parser translator when pinning hash with string keys</title>
<updated>2025-03-30T17:24:05+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-03-30T10:48:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d7e46543b5fc34487dbc2c784412af015dbe67f4'/>
<id>d7e46543b5fc34487dbc2c784412af015dbe67f4</id>
<content type='text'>
`StringNode` and `SymbolNode` don't have the same shape
(`content` vs `value`) and that wasn't handled.

I believe the logic for the common case can be reused.
I simply left the special handling for implicit nodes in pattern matching
and fall through otherwise.

NOTE: patterns.txt is not actually tested at the moment,
because it contains syntax that `parser` mistakenly rejects.
But I checked manually that this doesn't introduce other failures.
https://github.com/whitequark/parser/pull/1060

https://github.com/ruby/prism/commit/55adfaa895
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`StringNode` and `SymbolNode` don't have the same shape
(`content` vs `value`) and that wasn't handled.

I believe the logic for the common case can be reused.
I simply left the special handling for implicit nodes in pattern matching
and fall through otherwise.

NOTE: patterns.txt is not actually tested at the moment,
because it contains syntax that `parser` mistakenly rejects.
But I checked manually that this doesn't introduce other failures.
https://github.com/whitequark/parser/pull/1060

https://github.com/ruby/prism/commit/55adfaa895
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Accept a newline after the defined? keyword</title>
<updated>2025-03-30T17:22:41+00:00</updated>
<author>
<name>Kevin Newton</name>
<email>kddnewton@gmail.com</email>
</author>
<published>2025-03-22T17:17:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=052794bfe1970e90f4f4f9e37fc362dd27903a8d'/>
<id>052794bfe1970e90f4f4f9e37fc362dd27903a8d</id>
<content type='text'>
[Bug #21197]

https://github.com/ruby/prism/commit/22be955ce9
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #21197]

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