diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f9d3b5a4e..e525d4e5d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,55 @@ 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 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. +- `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`. + +### 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"]`. +- `Prism.parse_file` and similar now accept anything responding to `to_path` (like `Pathname`) directly. + +### 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