Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
[Unreleased]
1.9.0 - 2026-01-27
Added
-
Lots of work on the
Rippertranslation layer to make it more compatible and efficient. -
Add
Prism::Node#breadth_first_search_all/Prism::Node#find_allfor finding all nodes matching a condition.
Changed
-
Fixed location of opening tokens when invalid syntax is parsed.
-
Fix RBI for parsing options.
1.8.0 - 2026-01-12
Added
-
Optimize ruby visitor.
-
Report unterminated construct errors at opening token.
Changed
-
Correctly expose ripper state.
-
Use one file for versioned parser classes.
-
Fix denominator of rational float literal.
-
Decouple ripper translator from ripper library.
-
Sync
Prism::Translation::ParserCurrentwith Ruby 4.0.
1.7.0 - 2025-12-18
Added
-
Support
4.1as a version option. -
Add
equal_loctoCallNode. -
Add
len()/is_empty()toConstantListandNodeListin the Rust API.
Changed
-
Rename version
3.5to version4.0. -
Fix compiling the gem from source on Windows.
-
Fix parsing of unary method calls like
42.~@. -
Reject
def f a, (b) = 1. -
Reject endless method as a block parameter default.
-
Reject variable capture in alternative pattern.
-
Many fixes in regards to memory safety, found through fuzzing.
-
Many fixes to better handle invalid syntax, also found through fuzzing.
-
Fix the ruby version used by the
rippertranslator. -
Fix ruby_parser translation comment processing.
1.6.0 - 2025-10-16
Added
-
Add support for passing
"current"as the version option toPrism.*APIs.
Changed
-
Remove a compiler warning for a missing unsigned cast for a shift value.
1.5.2 - 2025-10-09
Changed
-
Fix character literal forced encoding when a unicode escape sequence is used.
-
Reject
1 if foo = bar baz. -
Clear static literal flag on interpolated strings.
-
Reject optional argument/endless method definition ambiguity.
1.5.1 - 2025-09-13
Changed
-
Revert of a bug introduced with static literal flags on interpolated strings.
1.5.0 - 2025-09-12
Added
-
Add
Integer::to_u32_digitsfor the Rust API. -
Add
pm_comment_type_tfield for the Rust API. -
Support leading logical operators for CRuby 3.5+.
Changed
-
Mark
Prismas ractor-safe. -
Enforce a minimum version for the parser translation layer.
-
Many fixes to the parser translation layer.
-
Accept a newline after the
defined?keyword. -
Reject
true && not true. -
Make
it = itassign nil to match parse.y behavior [Bug #21139]. -
Some fixes to the ruby parser translation layer.
-
Ensure call nodes have the correct ending location.
-
Reject
foo && return bar.
1.4.0 - 2025-03-18
Added
-
Support
3.5as a version option. -
Many, many compatibility fixes for the parser translation layer.
-
Handle escapes in named capture names.
-
The
freezeoption is added to the variousPrism::APIs to deeply freeze the AST. -
Properly support
itfor the parser and ruby_parser translation layers. -
Track the
thenkeyword onrescuenodes. -
Add a
multiple_statements?flag to parentheses nodes to support desireddefined?behavior.
Changed
-
The strings used in the AST are now frozen.
-
Fixed handling escaped characters after control sequences in character literals.
-
Fix reading off the end of an unterminated global variable.
-
Raise a syntax error for defining
[]=with endless method syntax. -
Increase value of
PRISM_DEPTH_MAXIMUMto10000. -
Freeze
Prism::VERSION. -
Fix up rescue modifier precedence.
1.3.0 - 2024-12-21
Added
-
Introduce
Prism::StringQuery. -
Introduce
Prism::Relocation. -
Track
dokeyword forWhileNodeandUntilNode. -
Change the way the gem is built to rely on
mkmfinstead ofmake. -
Lots more documentation on node fields.
Changed
-
Properly add an error for
def @foo; end. -
Properly add an error for
foo(**, *). -
Fix up regression in string parsing in
RubyParsertranslation. -
Reject invalid dot method call after match expression.
-
Reject invalid operator after match expression.
-
Fix up %-literals delimited by newlines.
-
Properly add an error for
-> { _1; -> { _1 } }. -
Reject blocks and keywords in index writes.
1.2.0 - 2024-10-10
Added
-
Introduce
Prism::CodeUnitsCache.
Changed
-
Properly handle lexing global variables that begin with
$-. -
Properly reject invalid multi writes within parentheses.
-
Fix unary
*binding power. -
Setcontains_keywordsflag for implicitgetscalls when-pis used. -
Properly reject invalid non-associative operator patterns.
-
Do not warn about unused variables declared on negative lines.
1.1.0 - 2024-10-02
Added
-
Explicitly type each child node field in the Ruby API.
-
Add the
main_scriptoption to the parse APIs, which controls whether or not shebangs are considered. -
Add the
partial_scriptoptions to the parse APIs, which controls whether or not jumps that would otherwise be considered invalid are allowed. This is useful for parsing things likeERBsources, where you know it will be evaluated in a different context. Note that this functionality is replacing the previous idiom of passing in a list of scopes to indicate anevalcontext, because that behavior has changed upstream inruby/ruby. -
Add
ArgumentsNode#contains_multiple_splats?. -
Add
ArgumentsNode#contains_forwarding?. -
Accept all valid Ruby versions for the
versionoption on parse APIs. -
Accept version shorthands like
"3.3"and"3.4"for theversionoption on parse APIs. -
Support a max depth to protect against malicious payloads without hitting the stack limit.
Changed
-
Fix some token incompatibilities in the
parsertranslation. -
Fix up parsing tempfiles on Windows.
-
Fix up handling UTF-8 characters in file paths on Windows.
-
Do not warn for a
\rat the end of a shebang on Windows. -
Properly handle erroring for parsing a directory on Windows.
-
When a numbered reference is out of range, warn instead of raise.
-
Allow returns in default parameter values.
-
Reject many more invalid syntax patterns.
1.0.0 - 2024-08-28
Added
-
Add
Node#breadth_first_search. -
Add
Node#node_id. -
Add
ArgumentsNode#contains_splat?. -
Passing the special value
falsefor theencodingoption tellsPrismto ignore magic encoding comments. -
Expose flags on every node type (allows checking static literal and newline).
-
Implement mismatched indentation warning.
-
Add C API for receiving a callback when parsing shebangs with additional flags.
Changed
-
BREAKING: Some fields are renamed that had illogical names. The previous names all now emit deprecation warnings.
-
CaseMatchNode#consequentwas renamed toCaseMatchNode#else_clause -
CaseNode#consequentwas renamed toCaseNode#else_clause -
IfNode#consequentwas renamed toIfNode#subsequent -
RescueNode#consequentwas renamed toRescueNode#subsequent -
UnlessNode#consequentwas renamed toUnlessNode#else_clause -
Block exits are now allowed in loop predicates (e.g.,
while _ && break do end). -
Multi-writes are now disallowed when not at the statement level.
-
Ensure that range operators are non-associative.
-
(JavaScript) Correctly deserialize encoded strings.
-
Properly support parsing regular expressions in extended mode.
-
Use gmake on FreeBSD.
-
Parsing streams now handles NUL bytes in the middle of the stream.
-
Properly detect invalid returns.
0.30.0 - 2024-06-07
Added
-
More correctly raise mixed encoding errors.
-
Implement ambiguous binary operator warning.
-
Fix up regexp escapes with control and meta characters.
-
Fix up support for the
itimplicit local variable. -
Heredoc identifiers now properly disallow CLRF.
-
Errors added for void value expressions in begin clauses.
-
Many updates to more closely match the
parsergem in parser translation. -
Many errors added for invalid regular expressions.
Changed
-
Handle parser translation missing the
parsergem. -
Handle ruby_parser translation missing the ruby_parser gem.
-
Various error messages have been updated to more closely match CRuby.
-
RationalNodenow has anumeratoranddenominatorfield instead of anumericfield. For the Ruby API we provide aRationalNode#numericmethod for backwards-compatibility.
0.29.0 - 2024-05-10
Added
-
Added
Prism::CallNode#full_message_loc, which gives the location including the=if there is one. -
A warning for when
# shareable_constant_valueis not used on its own line. -
An error for invalid implicit local variable writes.
-
Implicit hash patterns in array patterns are disallowed.
-
We now validate that Unicode escape sequences are not surrogates.
Changed
-
All fields named
operatorhave been renamed tobinary_operatorfor*OperatorWriteNodenodes. This is to make it easier to provide C++ support. In the Ruby API, the old fields are aliased to the new fields with a deprecation warning. -
Many updated error messages to more closely match CRuby.
-
We ensure keyword parameters do not end in
!or?. -
Fixed some escaping in string literals with control sequences and hex escapes.
-
Fix a bug with RBS types when used outside the
ruby/prismcodebase.
0.28.0 - 2024-05-03
Added
-
Nested hashes will now warn for duplicated keys, as in:
{ foo: 1, **{ foo: 2 } }. -
Prism::ReturnNodenow has a flag on it to indicate if it is redundant. -
Prism::Location#slice_linesandPrism::Node#slice_linesare now provided to slice the source code of a node including the content before the node on the same line that it starts on and the content after the node on the same line that it ends on. -
Symbols with invalid byte sequences now give errors.
-
You can now pass
"3.3.1"to theversion:parameter on allPrism.*APIs. -
Prism::Source#lines,Prism::Location#source_lines,Prism::Node#source_lines, andPrism::Node#script_linesare now provided, which will all return the source code of the source as an array of strings. -
Prism::ASCIISourceis now provided, which is a subclass ofPrism::Sourcebut specialized to increase performance when the source is entirely ASCII. -
Prismnow provides errors when parsing Ruby 3.4+ syntax for index expressions with keywords or blocks. -
Prismnow provides an error when**nilis used after other keyword parameters. -
Prismnow provides errors when safe navigation is used in call target expressions, e.g.,foo&.bar, = 1. -
Prism::Node#tunnelis now provided, which returns an array of nodes starting at the current node that contain a given line and column.
Changed
-
All translation layers now assume an eval context, which means they will not return errors for invalid jumps like
yield. -
Prism::Node#inspectnow uses a queue instead of recursion to avoid stack overflows. -
Prismnow more closely mirrors CRuby interpolation semantics, which means you could potentially have a static literal string that directly interpolates another static literal string. -
The shipped RBI sorbet types no longer use generics.
-
Prism::ConstantPathNode#childandPrism::ConstantTargetNode#childare now deprecated, replaced by two new fields on these nodes:nameandname_loc.
0.27.0 - 2024-04-23
Added
-
Implemented
===for each of the nodes, which will check if equality but ignore the specific ranges of locations.
Changed
-
Fix translation of
ItParametersNodefor parser translation. -
Fix translation of
dstrfor ruby_parser translation. -
Do not allow omitted hash values whose keys end with
!or?. -
Split up
Prism::ParseResultintoPrism::Resultwith subclassesPrism::ParseResult,Prism::LexResult,Prism::ParseLexResult, andPrism::LexCompat::Result. -
Change reflection classes to have only a single
IntegerFieldclass and renameDoubleFieldtoFloatField. -
Fall back to default
ARandCCin Makefile. -
Use GC-able symbols for the syntax tree to avoid adding to the global symbol table.
-
Fix a bug with karatsuba_multiply that would result in a stack overflow.
-
Fix parser translation when looking for tokens with
srange_find.
0.26.0 - 2024-04-18
Added
-
Add
Prism::Node::fields, which returns a list ofPrism::Reflection::Fieldobjects representing the fields of the node class. This is useful in metaprogramming contexts. -
Prism::Location#chop, for removing the last byte from a location. -
The void statement warning is now implemented.
-
The unreachable statement warning is now implemented.
-
A syntax error has been added for block arguments on yields, e.g.,
yield(&foo).
Changed
-
Better fidelity to
parserwhen translating heredocs with interpolation. -
Fixed
RBIandRBStypes forPrism::parse_*signatures. -
Remove some incorrect warnings about unused local variables.
-
More closely match CRuby error messages for global variables.
-
Fix an issue with
parsertranslation when line continuations are found in string literals.
0.25.0 - 2024-04-05
Added
-
Prism::Translation::Ripperis now able to mirror all of theRipperAPIs. -
Prism::Location#leading_commentsandPrism::Location#trailing_commentsis added. -
Prism::Comment#sliceis added. -
Warn for writing literal values in conditional predicates.
-
Check for
_POSIX_MAPPED_FILESbefore usingmmap. -
Prism::ItParametersNodeis added, to support-> { it }. -
Parse integer and float literal values onto the tree.
-
Warn on duplicated hash keys and duplicated when clauses.
-
Ship much improved
RBIandRBStypes. -
Support for the
-p,-n,-a, and-lcommand line switches. -
Warn on integer literals in flip-flops.
-
Support BSD make.
-
Support custom allocation functions through the
PRISM_XALLOCATORdefine. -
Warn for certain keywrods at the end of the line.
-
Provide
pm_visit_node, a C visitor API. -
Prism::parse_streamis added, which works for any RubyIOobject. -
Provide flags for regular expression literals for their derived encoding.
-
Provide flags for whether or not an interpolated string literal is frozen.
-
Add
Prism::StringNode.mutable?for when a string is explicitly mutable, to support delineating chilled strings. -
Warn for incorrect character literal syntax.
-
Warn for chained comparison operators.
-
Warn for
**interpreted as an argument prefix. -
Warn for
&interpreted as an argument prefix. -
Prism::ShareableConstantNodeadded to support ractors. -
Warn for frozen string literals found after tokens.
-
Support
PRISM_BUILD_MINIMALto provide only the minimal necessary functionality to reduce the binary size. -
Handle CLRF inside heredocs, strings, and regular expressions.
-
Mark inner strings in interpolated strings as frozen.
-
Support the
-xcommand line switch. -
Error messages now much more closely mirror CRuby.
-
Provide syntax errors for invalid block exits (
break,next,retry, andyield). -
Warn on unused local variables.
-
Do not syntax error on default parameter values that only write to the parameter.
Changed
-
Many improvements to the compatibility with the
whitequark/parsertranslation. -
Accept newlines before pattern terminators
)or]. -
Prism::Node#start_offsetandPrism::Node#end_offsetare now much more efficient. -
Read files using
freadinstead ofmmapwhen we’re going to keep around the source through the Ruby API. -
Fix
Sexp#line_maxsetting in theseattlerb/ruby_parsertranslation layer. -
Allow spaces before the encoding comment.
0.24.0 - 2024-02-15
Added
-
More support for
Prism::Translation::Ripperis added. -
Support multiple versions for
Prism::Translation::Parser. -
Improved memory usage in the FFI backend.
-
Very large speed and memory improvements for creating the Ruby AST.
Changed
-
Fix location for empty symbol in hash key.
-
Fix parsing a rescue modifier on the value of an assignment when the LHS is a method call with arguments and no parentheses.
0.23.0 - 2024-02-14
Added
-
More support for
Prism::RipperCompatis added. -
A significantly faster offset cache for
Prism::Translation::Parseris added for files with multibyte characters. -
Prism::Translation::RubyParseris added. -
Prism::ConstantPathTarget#full_nameis added. -
version: "3.4.0"is added as an option that is an alias forversion: "latest". -
Four new APIs are added to
Prism::Location: -
Invalid multibyte characters are now validated within strings, lists, and heredocs.
Changed
-
When defining
def !@, thename_locwas previously only pointing to!, but now includes the@. Thenameis the same. -
Prism::RipperCompathas been moved toPrism::Translation::Ripper. -
Many of the error messages that prism produces have been changed to match the error messages that CRuby produces.
0.22.0 - 2024-02-07
Added
-
More support for
Prism::RipperCompatis added. -
Support for Ruby 2.7 has been added, and the minimum Ruby requirement has been lowered to 2.7.
Changed
-
The error for an invalid source encoding has a new
:argumentlevel to indicate it raises an argument error. -
BeginNodenodes that are used when a class, singleton class, module, method definition, or block have an inlinerescue/ensure/elsenow have their opening locations set to the beginning of the respective keyword. -
Improved error messages for invalid characters.
-
Prism.parse_fileand similar APIs will raise more appropriate errors when the file does not exist or cannot be mapped. -
Correctly handle the
recoverparameter forPrism::Translation::Parser.
0.21.0 - 2024-02-05
Added
-
Add the
pm_constant_pool_findAPI for finding a constant.
Changed
-
Fixes for
Prism::Translation::Parser. -
Ensure all errors flow through
parser.diagnostics.process. -
Fix the find pattern node.
-
Fix block forwarding with
NumberedParametersNode. -
Ensure we can parse strings with invalid bytes for the encoding.
-
Fix hash pairs in pattern matching.
-
Properly reject operator writes on operator calls, e.g.,
a.+ -= b. -
Fix multi-byte escapes.
-
Handle missing body in
beginwithin the receiver of a method call.
0.20.0 - 2024-02-01
Added
-
Stringliteral hash keys are now marked as frozen as static literal. -
IndexTargetNodenow always has theATTRIBUTE_WRITEflag. -
Call*Nodenodes now have anIGNORE_VISIBILITYflag. -
We now support the
itdefault parameter. -
Errors and warnings now have levels associated with them.
-
Symbols now have correct encoding flags.
-
We have now merged
parser-prismin, which provides translation to thewhitequark/parserAST. -
We now emit errors for invalid method definition receivers.
Changed
-
We now emit errors on invalid pinned local variables.
-
When passed scopes, it is now assumed that the innermost scope is the current binding.
-
We now provide better error recovery for non terminated heredocs.
-
Fix for
RationalNode#valuefor non-decimal integers. -
Unary symbols
!@and~@now unescape to!and~, respectively. -
frozen_string_literal: falsenow works properly.
Removed
-
We’ve removed the
locals_body_indexfield. -
We’ve removed the
verboseoption on the various parse APIs. Warnings are now always emitted with their associated level so that consumers can decide how to handle them.
0.19.0 - 2023-12-14
Added
-
ArrayNodenow has acontains_splat?flag if it has a splatted element in it. -
All of the remaining encodings have been implemented.
-
Allow forwarding
&in a method that has a...parameter. -
Many statements that are found in non-statement positions are being properly rejected now.
-
Void values are now properly checked.
-
Referencing a parameter in its own default value is now properly rejected.
-
DATA/__END__is now parsed as its own field on parse result (data_loc) as opposed to as a comment. -
Blank
*now properly forwards into arrays. -
ImplicitRestNodeis introduced to represent the implicit rest of a destructure. -
We now support negative start lines.
-
StringNode#heredoc?,InterpolatedStringNode#heredoc?,XStringNode#heredoc?, andInterpolatedXStringNode#heredoc?are introduced. -
NumberedParametersNodeis introduced to represent the implicit set of parameters when numbered parameters are used. -
Prism::parse_success?andPrism::parse_failure?are introduced to bypass reifying the AST. -
We now emit a warning for constant assignments in method definitions.
-
We now provide flags on strings and xstrings to indicate the correct encoding.
-
The hash pattern
restfield now more accurately parses**and**nil. -
The equality operators are now properly parsed as non-associative.
Changed
-
BREAKING: Many fields have changed positions within their nodes. This impacts the C API and the Ruby API if you are manually creating nodes through the initializer.
-
BREAKING: Almost all of the error messages have been updated to begin with lowercase characters to match ruby/spec.
-
Unterminated strings with only plain content are now always
StringNodeas opposed toInterpolatedStringNode -
BREAKING: Call node has been split up when it is in the target position into
CallTargetNodeandIndexTargetNode.
0.18.0 - 2023-11-21
Added
-
The
ParametersNode#signaturemethod is added, which returns the same thing asMethod#parameters. -
Visitor functionality has been added to the JavaScript API.
-
The
Node#to_dotAPI has been added to convert syntax trees to Graphviz digraphs. -
IfNodeandUnlessNodenow have athen_keyword_locfield. -
Many more encodings are now supported.
-
Some new
LocationAPIs have been added for dealing with characters instead of bytes, which are:start_character_offset,end_character_offset,start_character_column, andend_character_column. -
A warning has been added for when
END {}is used within a method. -
ConstantPathNode#full_name{,_parts}will now raise an error if the receiver of the constant path is not itself a constant. -
The
inkeyword and the=>operator now respect non-associativity. -
The
..and...operators now properly respect non-associativity.
Changed
-
Previously
...in blocks was accepted, but it is now properly rejected. -
BREAKING:
librubyparser.*has been renamed tolibprism.*in the C API. -
We now properly reject floats with exponent and rational suffixes.
-
We now properly reject void value expressions.
-
BREAKING: The
--disable-staticoption has been removed from the C extension. -
The rescue modifier keyword is now properly parsed in terms of precedence.
-
We now properly reject defining a numbered parameter method.
-
BREAKING:
MatchWriteNodenow has a list oftargets, which are local variable target nodes. This is instead oflocalswhich was a constant list. This is to support writing to local variables outside the current scope. It has the added benefit of providing location information for the local variable targets. -
BREAKING:
CaseNodehas been split intoCaseNodeandCaseMatchNode, the latter is used forcase ... inexpressions. -
BREAKING:
StringConcatNodehas been removed in favor of usingInterpolatedStringNodeas a list.
0.17.1 - 2023-11-03
Changed
-
Do not use constant nesting in RBI files.
0.17.0 - 2023-11-03
Added
-
We now properly support forwarding arguments into arrays, like
def foo(*) = [*]. -
We now have much better documentation for the C and Ruby APIs.
-
We now properly provide an error message when attempting to assign to numbered parameters from within regular expression named capture groups, as in
/(?<_1>)/ =~ "".
Changed
-
BREAKING:
KeywordParameterNodeis split intoOptionalKeywordParameterNodeandRequiredKeywordParameterNode.RequiredKeywordParameterNodehas novaluefield. -
BREAKING: Most of the
Prism::APIs now accept a bunch of keyword options. The options we now support are:filepath,encoding,line,frozen_string_literal,verbose, andscopes. See the pull request for more details. -
BREAKING: Comments are now split into three different classes instead of a single class, and the
typefield has been removed. They are:InlineComment,EmbDocComment, andDATAComment.
0.16.0 - 2023-10-30
Added
-
InterpolatedMatchLastLineNode#optionsandMatchLastLineNode#optionsare added, which are the same methods as are exposed onInterpolatedRegularExpressionNodeandRegularExpressionNode. -
The project can now be compiled with
wasi-sdkto expose a WebAssembly interface. -
ArgumentsNode#keyword_splat?is added to indicate if the arguments node has a keyword splat. -
The C API
pm_prettyprinthas a much improved output which lines up closely withNode#inspect. -
Prismnow ships withRBSandRBItype signatures (in the/sigand/rbidirectories, respectively). -
Prism::parse_commentsandPrism::parse_file_commentsAPIs are added to extract only the comments from the source code.
Changed
-
BREAKING:
Multi{Target,Write}Node#targetsis split up now intolefts,rest, andrights. This is to avoid having to scan the list in the case that there are splat nodes. -
Some bugs are fixed on
Multi{Target,Write}Nodeaccidentally creating additional nesting when not necessary. -
BREAKING:
RequiredDestructuredParameterNodehas been removed in favor of usingMultiTargetNodein those places. -
BREAKING:
HashPatternNode#assocshas been renamed toHashPatternNode#elements.HashPatternNode#kwresthas been renamed toHashPatternNode#rest.
0.15.1 - 2023-10-18
Changed
-
Fix compilation warning on assigning to bitfield.
0.15.0 - 2023-10-18
Added
-
BackReferenceReadNode#nameis now provided. -
Index{Operator,And,Or}WriteNodeare introduced, split out fromCall{Operator,And,Or}WriteNodewhen the method is[].
Changed
-
Ensure
PM_NODE_FLAG_COMMON_MASKinto a constant expression to fix compile errors. -
super(&arg)is now fixed. -
Ensure the last encoding flag on regular expressions wins.
-
Fix the common whitespace calculation when embedded expressions begin on a line.
-
Capture groups in regular expressions now scan the unescaped version to get the correct local variables.
-
*and&are added to the local table when...is found in the parameters of a method definition.
0.14.0 - 2023-10-13
Added
-
Syntax errors are added for invalid lambda local semicolon placement.
-
Lambda locals are now checked for duplicate names.
-
Destructured parameters are now checked for duplicate names.
-
Constant{Read,Path,PathTarget}Node#full_nameandConstant{Read,Path,PathTarget}Node#full_name_partsare added to walk constant paths for you to find the full name of the constant. -
Syntax errors are added when assigning to a numbered parameter.
-
Node::typeis added, which matches theNode#typeAPI. -
Magic comments are now parsed as part of the parsing process and a new field is added in the form of
ParseResult#magic_commentsto access them.
Changed
-
BREAKING:
Call*Node#namemethods now return symbols instead of strings. -
BREAKING: For loops now have their index value considered as part of the body, so depths of local variable assignments will be increased by 1.
-
Tilde heredocs now split up their lines into multiple string nodes to make them easier to dedent.
0.13.0 - 2023-09-29
Added
-
BEGIN {}blocks are only allowed at the top-level, and will now provide a syntax error if they are not. -
Numbered parameters are not allowed in block parameters, and will now provide a syntax error if they are.
-
Many more Ruby modules and classes are now documented. Also, many have been moved into their own files and autoloaded so that initial boot time of the gem is much faster.
-
PM_TOKEN_METHOD_NAMEis introduced, used to indicate an identifier that if definitely a method name because it has an!or?at the end. -
In the C API, arrays, assocs, and hashes now can have the
PM_NODE_FLAG_STATIC_LITERALflag attached if they can be compiled statically. This is used in CRuby, for example, to determine if aduphash/duparrayinstruction can be used as opposed to anewhash/newarray. -
Node#typeis introduced, which returns a symbol representing the type of the node. This is useful for case comparisons when you have to compare against multiple types.
Changed
-
BREAKING: Everything has been renamed to
prisminstead ofyarp. Theyp_/YP_prefix in the C API has been changed topm_/PM_. For the most part, everything should be find/replaceable. -
BREAKING:
BlockArgumentNodenodes now go into theblockfield onCallNodenodes, in addition to theBlockNodenodes that used to be there. Hopefully this makes it more consistent to compile/deal with in general, but it does mean it can be a surprising breaking change. -
Escaped whitespace in
%wlists is now properly unescaped. -
Node#pretty_printnow respects pretty print indentation. -
Dispatcherwas previously firing_leaveevents in the incorrect order. This has now been fixed. -
BREAKING:
Visitorhas now been split intoVisitorandCompiler. The visitor visits nodes but doesn’t return anything from the visit methods. It is suitable for taking action based on the tree, but not manipulating the tree itself. TheCompilervisits nodes and returns the computed value up the tree. It is suitable for compiling the tree into another format. As such,MutationVisitorhas been renamed toMutationCompiler.
0.12.0 - 2023-09-15
Added
-
RegularExpressionNode#optionsandInterpolatedRegularExpressionNode#optionsare now provided. These return integers that match up to theRegexp#optionsAPI. -
Greatly improved
Node#inspectandNode#pretty_printAPIs. -
MatchLastLineNodeandInterpolatedMatchLastLineNodeare introduced to represent using a regular expression as the predicate of aniforunlessstatement. -
IntegerNodenow has a base flag on it. -
Heredocs that were previously
InterpolatedStringNodeandInterpolatedXStringNodenodes without any actual interpolation are nowStringNodeandXStringNode, respectively. -
StringNodenow has afrozen?flag on it, which respects thefrozen_string_literalmagic comment. -
Numbered parameters are now supported, and are properly represented using
LocalVariableReadNodenodes. -
ImplicitNodeis introduced, which wraps implicit calls, local variable reads, or constant reads in omitted hash values. -
YARP::Dispatcheris introduced, which provides a way for multiple objects to listen for certain events on the AST while it is being walked. This is effectively a way to implement a more efficient visitor pattern when you have many different uses for the AST.
Changed
-
BREAKING: Flags fields are now marked as private, to ensure we can change their implementation under the hood. Actually querying should be through the accessor methods.
-
BREAKING:
AliasNodeis now split intoAliasMethodNodeandAliasGlobalVariableNode. -
Method definitions on local variables is now correctly handled.
-
Unary minus precedence has been fixed.
-
Concatenating character literals with string literals is now fixed.
-
Many more invalid syntaxes are now properly rejected.
-
BREAKING: Comments now no longer include their trailing newline.
0.11.0 - 2023-09-08
Added
-
Node#inspectis much improved. -
YARP::Patternis introduced, which can construct procs to match against nodes. -
BlockLocalVariableNodeis introduced to take the place of the locations array onBlockParametersNode. -
ParseResult#attach_comments!is now provided to attach comments to locations in the tree. -
MultiTargetNodeis introduced as the target of multi writes and for loops. -
Node#comment_targetsis introduced to return the list of objects that can have attached comments.
Changed
-
BREAKING:
GlobalVariable*Node#namenow returns a symbol. -
BREAKING:
Constant*Node#namenow returns a symbol. -
BREAKING:
BlockParameterNode,KeywordParameterNode,KeywordRestParameterNode,RestParameterNode,DefNodeall have theirnamemethods returning symbols now. -
BREAKING:
ClassNode#nameandModuleNode#namenow return symbols. -
BREAKING:
Location#end_columnis now exclusive instead of inclusive. -
Location#slicenow returns a properly encoded string. -
CallNode#operator_locis nowCallNode#call_operator_loc. -
CallOperatorAndWriteNodeis renamed toCallAndWriteNodeand its structure has changed. -
CallOperatorOrWriteNodeis renamed toCallOrWriteNodeand its structure has changed.
0.10.0 - 2023-09-01
Added
-
InstanceVariable*NodeandClassVariable*Nodeobjects now have theirnamereturning aSymbol. This is because they are now part of the constant pool. -
NumberedReferenceReadNodenow has anumberfield, which returns anInteger.
Changed
-
BREAKING: Various
operator_idandconstant_idfields have been renamed tooperatorandname, respectively. See 09d0a144 for details. -
%w,%W,%i,%I,%q, and%Qliterals can now span around the contents of a heredoc. -
BREAKING: All of the public C APIs that accept the source string now accept
const uint8_t *as opposed toconst char *.
0.9.0 - 2023-08-25
Added
-
Regular expressions can now be bound by
\n,\r, and a combination of\r\n. -
Strings delimited by
%,%q, and%Qcan now be bound by\n,\r, and a combination of\r\n. -
IntegerNode#valuenow returns the value of the integer as a RubyInteger. -
FloatNode#valuenow returns the value of the float as a RubyFloat. -
RationalNode#valuenow returns the value of the rational as a RubyRational. -
ImaginaryNode#valuenow returns the value of the imaginary as a RubyComplex. -
ClassNode#nameis now a string that returns the name of just the class, without the namespace. -
ModuleNode#nameis now a string that returns the name of just the module, without the namespace. -
Regular expressions and strings found after a heredoc declaration but before the heredoc body are now parsed correctly.
-
The serialization API now supports shared strings, which should help reduce the size of the serialized AST.
-
*Node#copyis introduced, which returns a copy of the node with the given overrides. -
Location#copyis introduced, which returns a copy of the location with the given overrides. -
DesugarVisitoris introduced, which provides a simpler AST for use in tools that want to process fewer node types. -
{ClassVariable,Constant,ConstantPath,GlobalVariable,InstanceVariable,LocalVariable}TargetNodeare introduced. These nodes represent the target of writes in locations where a value cannot be provided, like a multi write or a rescue reference. -
UntilNode#closing_locandWhileNode#closing_locare now provided. -
Location#joinis now provided, which joins two locations together. -
YARP::parse_lexandYARP::parse_lex_fileare introduced to parse and lex in one result.
Changed
-
When there is a magic encoding comment, the encoding of the first token’s source string is now properly reencoded.
-
Constants followed by unary
&are now properly parsed as a call with a passed block argument. -
Escaping multi-byte characters in a string literal will now properly escape the entire character.
-
YARP.lex_compatnow has more accurate behavior when a byte-order mark is present in the file. -
BREAKING:
AndWriteNode,OrWriteNode, andOperatorWriteNodehave been split back up into their0.7.0versions. -
We now properly support spaces between the
encodingand=/:in a magic encoding comment. -
We now properly parse
-> foo: bar do end.
0.8.0 - 2023-08-18
Added
-
Some performance improvements when converting from the C AST to the Ruby AST.
-
Two rust crates have been added:
yarp-sysandyarp. They are as yet unpublished.
Changed
-
Escaped newlines in strings and heredocs are now handled more correctly.
-
Dedenting heredocs that result in empty string nodes will now drop those string nodes from the list.
-
Beginless and endless ranges in conditional expressions now properly form a flip flop node.
-
%at the end of files no longer crashes. -
Location information has been corrected for
if/elsifchains that have noelse. -
__END__at the very end of the file was previously parsed as an identifier, but is now correct. -
BREAKING: Nodes that reference
&&=,||=, and other writing operators have been consolidated. Previously, they were separate individual nodes. Now they are a tree with the target being the left-hand side and the value being the right-hand side with a joiningAndWriteNode,OrWriteNode, orOperatorWriteNodein the middle. This impacts all of the nodes that match this pattern:{ClassVariable,Constant,ConstantPath,GlobalVariable,InstanceVariable,LocalVariable}Operator{And,Or,}WriteNode. -
BREAKING:
BlockParametersNode,ClassNode,DefNode,LambdaNode,ModuleNode,ParenthesesNode, andSingletonClassNodehave had theirstatementsfield renamed tobodyto give a hint that it might not be aStatementsNode(it could also be aBeginNode).
0.7.0 - 2023-08-14
Added
-
We now have an explicit
FlipFlopNode. It has the same flags asRangeNode. -
We now have a syntax error when implicit and explicit blocks are passed to a method call.
-
Node#sliceis now implemented, for retrieving the slice of the source code corresponding to a node. -
We now support the
utf8-macencoding. -
Predicate methods have been added for nodes that have flags. For example
CallNode#safe_navigation?andRangeNode#exclude_end?. -
The gem now functions on JRuby and TruffleRuby, thanks to a new FFI backend.
-
Comments are now part of the serialization API.
Changed
-
Autotools has been removed from the build system, so when the gem is installed it will no longer need to go through a configure step.
-
The AST for
foo = *barhas changed to have an explicit array on the right hand side, rather than a splat node. This is more consistent with how other parsers handle this. -
BREAKING:
RangeNodeFlagshas been renamed toRangeFlags. -
Unary minus on number literals is now parsed as part of the literal, rather than a call to a unary operator. This is more consistent with how other parsers handle this.
0.6.0 - 2023-08-09
Added
-
🎉 Initial release! 🎉