From 38721f8c2bf1a1e331d340d0a2b7a4792ca7140f Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Thu, 10 Sep 2026 13:57:45 +0200 Subject: [PATCH 1/3] Fill changelog with current changes Might need to add more if stuff gets changed --- CHANGELOG.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f9d3b5a4e..b755ec50a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,54 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +Highlights of this release: +- Significantly improved parsing performance by up to 40%. +- The prism gem now ships precompiled platform-specific variants to rubygems.org. +- Significant changes to the exposed C API. + +### Breaking Changes +- Optional locations like `StringNode#closing_loc` in `'foo` that were empty for syntax-invalid code will now be `nil` instead. +- Any place that you would have encountered a `MissingNode`, `ErrorRecoveryNode` will now be present. `ErrorRecoveryNode` wraps unexpected nodes, so when walking syntax-invalid code you will now only need to handle this one specific node type. +- Require arguments for `Prism::Source.for`. The second and third positional parameters are no longer optional. +- `Prism.lex` now returns an array of tokens instead of an array of `[token, internal_parse_state]`. Previous access like `token[0]` or `token.first` to extract the actual token will continue to work. +- The following tokens are changed: `PARENTHESIS_LEFT` was split up into `PARENTHESIS_LEFT` and `PARENTHESIS_LEFT_GROUPING`. `BRACE_LEFT` was split up into `BRACE_LEFT`, `BRACE_LEFT_ARGUMENT`, and `BRACE_LEFT_HASH`. `BACKTICK` was split up into `BACKTICK` and `XSTRING_BACKTICK`. `NEWLINE` was split up into `NEWLINE` and `NEWLINE_TERMINATOR`. + +### Added +- Support for parsing Ruby 4.1 syntax. +- `version: "nearest"` is now supported. It behaves similarly to `version: "current"` but will not raise when the version is unsupported, instead falling back to the nearest syntax version prism currently supports. +- `raise_error` was added as a valid option. Prism will raise a `SyntaxError` when given syntax-invalid code. When `true` is given, prism decides the formatting (`tty?`, `NO_COLOR`, etc.). If you need a specific style, `:plain`, `:style`, and `:color` are also supported values. +- Added `Prism::ParseResult#continuable` to check if the parsed source can become valid by appending more code. +- `Prism.find` takes a `Method`, `UnboundMethod`, `Proc`, or `Thread::Backtrace::Location` and returns the associated prism AST node. +- `ForwardingSuperNode` now has `keyword_loc`. +- Allow pattern matching with prism nodes to match on location slices, like `node in Prism::StringNode[content: "foo"]`. + +### Removed +- Removed `Prism::Pack`. + +### Changed +- Thoroughly implement void value expression check for Ruby 4.1. +- Add support for `&nil` to declare that a method accepts no block for Ruby 4.1. +- Allow trailing commas in method signatures like `def foo(a,); end` for Ruby 4.1. +- Reject `END { break }` and `END { next }` for Ruby 4.1. +- `a /b/` no longer warns about ambiguous `/` for Ruby 4.1. +- Many improvements to the docs (fixing Markdown on docs.ruby-lang.org, grouping related methods, showing fewer useless methods, etc.). +- The following node fields were renamed for consistency: `InNode#{in,then}_loc` -> `InNode#{in,then}_keyword_loc`, `MatchPredicateNode#operator_loc` -> `MatchPredicateNode#keyword_loc`, `UnlessNode#keyword_loc` -> `UnlessNode#unless_keyword_loc`, `UntilNode#{keyword,closing}_loc` -> `UntilNode#{until,end}_keyword_loc`, `WhenNode#keyword_loc` -> `WhenNode#when_keyword_loc`, `WhileNode#{keyword,closing}_loc` -> `WhileNode#{while,end}_keyword_loc`. Previous names are aliased and will continue to work. + +### Fixed +- Many fixes to edge-case syntax to more closely align with `parse.y`. +- Many compatibility fixes to the ripper translator, in particular in regards to the emitted events. +- Handful of compatibility fixes for the parser translator. +- Fix lexing for unterminated strings/heredocs etc. +- Preserve line-continuation only in dedent heredocs. +- Fix error message for block/lambda with `...` argument. +- Handful of fixes for syntax-invalid code that triggers `ASAN` and similar. +- Fix `Source#offsets` with `freeze: true`. +- Fix UTF-8 code units to match the number of bytes in the code unit offsets. +- Don't replicate unary method bug in the parser translator. +- Fix `Prism.parse_comments` locations for the FFI backend. +- `Prism.parse_stream` no longer assumes that the given io is implemented correctly. +- Fix `Comment#trailing` for syntax-invalid edgecase. + ## [1.9.0] - 2026-01-27 ### Added From 84877e3c778dd6d468ca2421012ae4d31373a88e Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Fri, 11 Sep 2026 11:31:46 +0200 Subject: [PATCH 2/3] Update CHANGELOG.md Co-authored-by: Benoit Daloze --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b755ec50a1..56f3fd3e56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ Highlights of this release: ### Breaking Changes - Optional locations like `StringNode#closing_loc` in `'foo` that were empty for syntax-invalid code will now be `nil` instead. -- Any place that you would have encountered a `MissingNode`, `ErrorRecoveryNode` will now be present. `ErrorRecoveryNode` wraps unexpected nodes, so when walking syntax-invalid code you will now only need to handle this one specific node type. +- `MissingNode` has been replaced by `ErrorRecoveryNode`. `ErrorRecoveryNode` wraps unexpected nodes, so when walking syntax-invalid code you will now only need to handle this one specific node type. - Require arguments for `Prism::Source.for`. The second and third positional parameters are no longer optional. - `Prism.lex` now returns an array of tokens instead of an array of `[token, internal_parse_state]`. Previous access like `token[0]` or `token.first` to extract the actual token will continue to work. - The following tokens are changed: `PARENTHESIS_LEFT` was split up into `PARENTHESIS_LEFT` and `PARENTHESIS_LEFT_GROUPING`. `BRACE_LEFT` was split up into `BRACE_LEFT`, `BRACE_LEFT_ARGUMENT`, and `BRACE_LEFT_HASH`. `BACKTICK` was split up into `BACKTICK` and `XSTRING_BACKTICK`. `NEWLINE` was split up into `NEWLINE` and `NEWLINE_TERMINATOR`. From fb8a90f33cea5a4e7d4541455e13b0b8643b6389 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Sun, 13 Sep 2026 11:51:04 +0200 Subject: [PATCH 3/3] One more change --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 56f3fd3e56..e525d4e5d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a Highlights of this release: - Significantly improved parsing performance by up to 40%. - The prism gem now ships precompiled platform-specific variants to rubygems.org. -- Significant changes to the exposed C API. +- Significant changes to the exposed C API and language bindings. ### Breaking Changes - Optional locations like `StringNode#closing_loc` in `'foo` that were empty for syntax-invalid code will now be `nil` instead. @@ -26,6 +26,7 @@ Highlights of this release: - `Prism.find` takes a `Method`, `UnboundMethod`, `Proc`, or `Thread::Backtrace::Location` and returns the associated prism AST node. - `ForwardingSuperNode` now has `keyword_loc`. - Allow pattern matching with prism nodes to match on location slices, like `node in Prism::StringNode[content: "foo"]`. +- `Prism.parse_file` and similar now accept anything responding to `to_path` (like `Pathname`) directly. ### Removed - Removed `Prism::Pack`.