20 Commits
Author SHA1 Message Date
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
Earlopain 7037d8f89e [ruby/prism] Rename Ruby 3.5 to Ruby 4.0
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
2025-11-08 00:22:17 +00:00
Kevin Newton 68f45a6da7 [ruby/prism] Do not rely on RUBY_VERSION being consistent
https://github.com/ruby/prism/commit/34428946db
2025-10-16 14:38:14 +00:00
Kevin Newton cea3307fe6 [ruby/prism] Do not stub Ruby version
https://github.com/ruby/prism/commit/44c4306247
2025-10-16 14:10:39 +00:00
Earlopain f5d3b6e626 [ruby/prism] Add support for Prism.parse(foo, version: "current")
The docs currently say to use `Prism.parse(foo, version: RUBY_VERSION)` for this.
By specifying "current" instead, we can have prism raise a more specifc error.

Note: Does not use `ruby_version` from `ruby/version.h` because writing a test for that is not really possible.
`RUBY_VERSION` is nicely stubbable for both the c-ext and FFI backend.

https://github.com/ruby/prism/commit/9c5cd205cf
2025-10-16 12:34:14 +00:00
Kevin Newton 51d3d6ac8c [ruby/prism] Support forwarding flags on scopes
When parent scopes around an eval are forwarding parameters (like
*, **, &, or ...) we need to know that information when we are in
the parser. As such, we need to support passing that information
into the scopes option. In order to do this, unfortunately we need
a bunch of changes.

The scopes option was previously an array of array of strings.
These corresponded to the names of the locals in the parent scopes.
We still support this, but now additionally support passing in a
Prism::Scope instance at each index in the array. This Prism::Scope
class holds both the names of the locals as well as an array of
forwarding parameter names (symbols corresponding to the forwarding
parameters). There is convenience function on the Prism module that
creates a Prism::Scope object using Prism.scope.

In JavaScript, we now additionally support an object much the same
as the Ruby side. In Java, we now have a ParsingOptions.Scope class
that holds that information. In the dump APIs, these objects in all
3 languages will add an additional byte for the forwarding flags in
the middle of the scopes serialization.

All of this is in service of properly parsing the following code:

```ruby
def foo(*) = eval("bar(*)")
```

https://github.com/ruby/prism/commit/21abb6b7c4
2025-01-14 20:31:38 +00:00
Kevin Newton 713f31872a [ruby/prism] Freeze AST option
To make it so that you can pass `freeze: true` to Prism parse
methods and get back a deeply-frozen AST that is Ractor-
shareable.

https://github.com/ruby/prism/commit/8e6a93b2d2
2025-01-14 15:32:39 +00:00
Kevin Newton b79152fd22 [ruby/prism] Support 3.5 for version option
https://github.com/ruby/prism/commit/6b6aa05bfb
2025-01-11 19:09:05 -05:00
Andrew Konchin 8d359644e7 [ruby/prism] Set contains_keywords flag for implicit gets($/, chomp: true) method call to handle -l CLI option
https://github.com/ruby/prism/commit/717e41c87d
2024-10-07 15:52:22 +00:00
Kevin Newton 414a848cc6 [ruby/prism] Accept version shorthand like 3.4
https://github.com/ruby/prism/commit/098f1c4607
2024-09-24 13:21:36 +00:00
Kevin Newton f515a1ab4b [ruby/prism] Introduce partial_script option
https://github.com/ruby/prism/commit/b28877fa4f
2024-09-20 15:42:12 +00:00
Kevin Newton ddbd644001 [ruby/prism] Stat file first to check directory
https://github.com/ruby/prism/commit/4ed7de537b
2024-09-13 19:30:57 +00:00
Kevin Newton 9afc6a981d [PRISM] Only parse shebang on main script
Fixes [Bug #20730]
2024-09-13 12:51:53 -04:00
Kevin Newton 05e02783a5 [PRISM] Ignore test_parse_directory if error is nil 2024-09-12 15:07:04 -04:00
Kevin Newton 38ba15beed [ruby/prism] Check errno for parsing directory
https://github.com/ruby/prism/commit/d68ea29d04
2024-09-12 13:43:04 -04:00
Kevin Newton d4d6f1de83 [ruby/prism] UTF-8 characters in file name
https://github.com/ruby/prism/commit/487f0ffe78
2024-09-11 19:17:12 +00:00
Kevin Newton 886fc69b1c [ruby/prism] Parse tempfile
https://github.com/ruby/prism/commit/31154a389a
2024-09-11 15:39:22 +00:00
Kevin Newton 5cb6954baa [ruby/prism] Fix up lex result constants
https://github.com/ruby/prism/commit/084baca463
2024-08-15 16:50:00 +00:00
Kevin Newton e77e4aa608 [ruby/prism] Have parse_stream handle NUL bytes
https://github.com/ruby/prism/commit/4a41d298c8
2024-07-17 19:44:32 +00:00
Kevin Newton 72452f4387 [ruby/prism] Tests overhaul
https://github.com/ruby/prism/commit/6f886be0a4
2024-05-30 15:18:20 -04:00