Releases: ruby/prism
Releases · ruby/prism
v0.23.0
Added
- More support for
Prism::RipperCompat
is added. - A significantly faster offset cache for
Prism::Translation::Parser
is added for files with multibyte characters. Prism::Translation::RubyParser
is added.Prism::ConstantPathTarget#full_name
is added.version: "3.4.0"
is added as an option that is an alias forversion: "latest"
.- Four new APIs are added to
Prism::Location
:Prism::Location#start_code_units_offset
Prism::Location#end_code_units_offset
Prism::Location#start_code_units_column
Prism::Location#end_code_units_column
- Invalid multibyte characters are now validated within strings, lists, and heredocs.
Changed
- When defining
def !@
, thename_loc
was previously only pointing to!
, but now includes the@
. Thename
is the same. Prism::RipperCompat
has been moved toPrism::Translation::Ripper
.- Many of the error messages that prism produces have been changed to match the error messages that CRuby produces.
v0.22.0
Added
- More support for
Prism::RipperCompat
is 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
:argument
level to indicate it raises an argument error. BeginNode
nodes that are used when a class, singleton class, module, method definition, or block have an inlinerescue
/ensure
/else
now have their opening locations set to the beginning of the respective keyword.- Improved error messages for invalid characters.
Prism.parse_file
and similar APIs will raise more appropriate errors when the file does not exist or cannot be mapped.- Correctly handle the
recover
parameter forPrism::Translation::Parser
.
v0.21.0
Added
- Add the
pm_constant_pool_find
API 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.
- Ensure all errors flow through
- Properly reject operator writes on operator calls, e.g.,
a.+ -= b
. - Fix multi-byte escapes.
- Handle missing body in
begin
within the receiver of a method call.
v0.20.0
Added
- String literal hash keys are now marked as frozen as static literal.
IndexTargetNode
now always has theATTRIBUTE_WRITE
flag.Call*Node
nodes now have anIGNORE_VISIBILITY
flag.- We now support the
it
default parameter. - Errors and warnings now have levels associated with them.
- Symbols now have correct encoding flags.
- We have now merged
parser-prism
in, which provides translation to thewhitequark/parser
AST. - 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#value
for non-decimal integers. - Unary symbols
!@
and~@
now unescape to!
and~
, respectively. frozen_string_literal: false
now works properly.
Removed
- We've removed the
locals_body_index
field. - We've removed the
verbose
option on the various parse APIs. Warnings are now always emitted with their associated level so that consumers can decide how to handle them.
v0.19.0
Added
ArrayNode
now 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. ImplicitRestNode
is 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.NumberedParametersNode
is 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
rest
field 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
StringNode
as opposed toInterpolatedStringNode
- BREAKING: Call node has been split up when it is in the target position into
CallTargetNode
andIndexTargetNode
.
v0.18.0
Added
- The
ParametersNode#signature
method is added, which returns the same thing asMethod#parameters
. - Visitor functionality has been added to the JavaScript API.
- The
Node#to_dot
API has been added to convert syntax trees to Graphviz digraphs. IfNode
andUnlessNode
now have athen_keyword_loc
field.- Many more encodings are now supported.
- Some new
Location
APIs 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
in
keyword 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-static
option 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:
MatchWriteNode
now has a list oftargets
, which are local variable target nodes. This is instead oflocals
which 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:
CaseNode
has been split intoCaseNode
andCaseMatchNode
, the latter is used forcase ... in
expressions. - BREAKING:
StringConcatNode
has been removed in favor of usingInterpolatedStringNode
as a list.
v0.17.1
v0.17.0
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:
KeywordParameterNode
is split intoOptionalKeywordParameterNode
andRequiredKeywordParameterNode
.RequiredKeywordParameterNode
has novalue
field. - 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
type
field has been removed. They are:InlineComment
,EmbDocComment
, andDATAComment
.
v0.16.0
Added
InterpolatedMatchLastLineNode#options
andMatchLastLineNode#options
are added, which are the same methods as are exposed onInterpolatedRegularExpressionNode
andRegularExpressionNode
.- The project can now be compiled with
wasi-sdk
to expose a WebAssembly interface. ArgumentsNode#keyword_splat?
is added to indicate if the arguments node has a keyword splat.- The C API
pm_prettyprint
has a much improved output which lines up closely withNode#inspect
. - Prism now ships with
RBS
andRBI
type signatures (in the/sig
and/rbi
directories, respectively). Prism::parse_comments
andPrism::parse_file_comments
APIs are added to extract only the comments from the source code.
Changed
- BREAKING:
Multi{Target,Write}Node#targets
is 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}Node
accidentally creating additional nesting when not necessary. - BREAKING:
RequiredDestructuredParameterNode
has been removed in favor of usingMultiTargetNode
in those places. - BREAKING:
HashPatternNode#assocs
has been renamed toHashPatternNode#elements
.HashPatternNode#kwrest
has been renamed toHashPatternNode#rest
.