<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/prism/lex_test.rb, branch master</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] Respect `encoding` option in `Prism.lex` and friends</title>
<updated>2026-05-08T20:12:59+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2026-05-08T19:04:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=dc90c26a103ad62df73464cc1896edbcc90bd0c7'/>
<id>dc90c26a103ad62df73464cc1896edbcc90bd0c7</id>
<content type='text'>
utf-8 is the default for source files but can be overwritten via options

https://github.com/ruby/prism/commit/355f451528
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
utf-8 is the default for source files but can be overwritten via options

https://github.com/ruby/prism/commit/355f451528
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix lexing for unterminated strings/heredocs etc.</title>
<updated>2026-02-13T16:38:48+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2026-02-13T09:49:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=bf1ac3f4af16edb613b6795a4af253e9d551bd2c'/>
<id>bf1ac3f4af16edb613b6795a4af253e9d551bd2c</id>
<content type='text'>
When we hit EOF and still have lex modes left, it means some content was unterminated.
Heredocs specifically have logic that needs to happen when the body finished lexing.
If we don't reset the mode back to how it was before, it will not continue lexing at the correct place.

Followup to https://github.com/ruby/prism/pull/3918.
We can't call into `parser_lex` since it resets token locations.

https://github.com/ruby/prism/commit/27c24fdc0d
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we hit EOF and still have lex modes left, it means some content was unterminated.
Heredocs specifically have logic that needs to happen when the body finished lexing.
If we don't reset the mode back to how it was before, it will not continue lexing at the correct place.

Followup to https://github.com/ruby/prism/pull/3918.
We can't call into `parser_lex` since it resets token locations.

https://github.com/ruby/prism/commit/27c24fdc0d
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Revert "Fix lexing for unterminated strings/heredocs etc."</title>
<updated>2026-02-12T15:53:47+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2026-02-12T15:40:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fd9dd36dfc38fd818dba0558bacb7c2df9bcdb79'/>
<id>fd9dd36dfc38fd818dba0558bacb7c2df9bcdb79</id>
<content type='text'>
This reverts commit https://github.com/ruby/prism/commit/8f35e8ef255b.

https://github.com/ruby/prism/commit/ed48f6dbfb
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit https://github.com/ruby/prism/commit/8f35e8ef255b.

https://github.com/ruby/prism/commit/ed48f6dbfb
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Fix lexing for unterminated strings/heredocs etc.</title>
<updated>2026-02-12T14:51:03+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2026-02-11T12:03:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ed113c556bb2bba97fa57f81f01400ccaf24473a'/>
<id>ed113c556bb2bba97fa57f81f01400ccaf24473a</id>
<content type='text'>
When we hit EOF and still have lex modes left, it means some content was unterminated.
Heredocs specifically have logic that needs to happen when the body finished lexing.
If we don't reset the mode back to how it was before, it will not continue lexing at the correct place.

https://github.com/ruby/prism/commit/8f35e8ef25
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we hit EOF and still have lex modes left, it means some content was unterminated.
Heredocs specifically have logic that needs to happen when the body finished lexing.
If we don't reset the mode back to how it was before, it will not continue lexing at the correct place.

https://github.com/ruby/prism/commit/8f35e8ef25
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Remove `Prism.lex_ripper`</title>
<updated>2026-01-27T14:43:51+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2026-01-26T16:28:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5d769228c1055524205437860beb1fc2de2d11a0'/>
<id>5d769228c1055524205437860beb1fc2de2d11a0</id>
<content type='text'>
Since `on_sp` is emitted, it doesn't do a whole lot anymore.

This leaves one incompatibility for code like `"x#$%"`

Ripper confuses this for bare interpolation with a global, but `$%` is not a valid global name. Still,
it emits two string tokens in such a case. It doesn't make sense for prism to work around this bug,
so the affected files are added as excludes.

Since the only usage of this method makes sense for testing in prism itself,
the method is removed instead of deprecated.

https://github.com/ruby/prism/commit/31be379f98
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since `on_sp` is emitted, it doesn't do a whole lot anymore.

This leaves one incompatibility for code like `"x#$%"`

Ripper confuses this for bare interpolation with a global, but `$%` is not a valid global name. Still,
it emits two string tokens in such a case. It doesn't make sense for prism to work around this bug,
so the affected files are added as excludes.

Since the only usage of this method makes sense for testing in prism itself,
the method is removed instead of deprecated.

https://github.com/ruby/prism/commit/31be379f98
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Remove duplicate lex tests</title>
<updated>2026-01-19T07:46:48+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2026-01-19T07:32:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3c9ca23ba4957ce3efc6f1235b78922304f0feae'/>
<id>3c9ca23ba4957ce3efc6f1235b78922304f0feae</id>
<content type='text'>
`RipperTest` already does this (added in https://github.com/ruby/prism/pull/3849)
Since it doesn't use the token classes, it also lists out all the excludes instead of just claiming some are passing.

https://github.com/ruby/prism/commit/e86a28263c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`RipperTest` already does this (added in https://github.com/ruby/prism/pull/3849)
Since it doesn't use the token classes, it also lists out all the excludes instead of just claiming some are passing.

https://github.com/ruby/prism/commit/e86a28263c
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Clean up test excludes</title>
<updated>2025-12-02T16:20:43+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-12-02T13:41:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=17bcd71e4218994bfb6c2d398fa784ccd74d2f2c'/>
<id>17bcd71e4218994bfb6c2d398fa784ccd74d2f2c</id>
<content type='text'>
Mostly not having to list version-specific excludes when testing against ripper/parse.y

Also don't test new syntax additions against the parser gems. The version support
for them may (or may not) be expanded but we shouldn't bother while the ruby version
hasn't even released yet.
(ruby_parser translation is not versioned, so let as is for now)

I also removed excludes that have since been implemented by parse.y

https://github.com/ruby/prism/commit/e5a0221c37
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Mostly not having to list version-specific excludes when testing against ripper/parse.y

Also don't test new syntax additions against the parser gems. The version support
for them may (or may not) be expanded but we shouldn't bother while the ruby version
hasn't even released yet.
(ruby_parser translation is not versioned, so let as is for now)

I also removed excludes that have since been implemented by parse.y

https://github.com/ruby/prism/commit/e5a0221c37
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Rename Ruby 3.5 to Ruby 4.0</title>
<updated>2025-11-08T00:22:17+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-11-07T12:14:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7037d8f89e71a13547d031d76747e45cfe930c9f'/>
<id>7037d8f89e71a13547d031d76747e45cfe930c9f</id>
<content type='text'>
See https://github.com/ruby/ruby/commit/6d81969b475262aba251e99b518181bdf7c5a523

It leaves the old variant around. RuboCop for examples accesses `Prism::Translation::Parser35`
to test against ruby-head. For now I left these simply as an alias

https://github.com/ruby/prism/commit/d0a823f045
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
See https://github.com/ruby/ruby/commit/6d81969b475262aba251e99b518181bdf7c5a523

It leaves the old variant around. RuboCop for examples accesses `Prism::Translation::Parser35`
to test against ruby-head. For now I left these simply as an alias

https://github.com/ruby/prism/commit/d0a823f045
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Make error and snapshot tests multi-version aware</title>
<updated>2025-10-22T14:50:11+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-10-17T14:19:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6047eada20d39bbe80976c31277ec7916118f78a'/>
<id>6047eada20d39bbe80976c31277ec7916118f78a</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>[ruby/prism] Reject argument command call taking a block with more trailing arguments</title>
<updated>2025-09-19T16:55:01+00:00</updated>
<author>
<name>Earlopain</name>
<email>14981592+Earlopain@users.noreply.github.com</email>
</author>
<published>2025-09-17T17:06:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=71067aa54c9fd819313dd2d35cb5b32803a65ad4'/>
<id>71067aa54c9fd819313dd2d35cb5b32803a65ad4</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
</feed>
