From 6ca8896fc660592af958542cebda06737ec3d58b Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 21 Nov 2023 13:59:22 -0500 Subject: [PATCH] Update to v0.18.0 (#1902) --- CHANGELOG.md | 31 ++++++++++++++++++++- Gemfile.lock | 2 +- ext/prism/extension.h | 2 +- include/prism/version.h | 6 ++-- javascript/package.json | 2 +- prism.gemspec | 2 +- rust/prism-sys/Cargo.lock | 2 +- rust/prism-sys/Cargo.toml | 2 +- rust/prism-sys/tests/utils_tests.rs | 2 +- rust/prism/Cargo.lock | 4 +-- rust/prism/Cargo.toml | 2 +- templates/java/org/prism/Loader.java.erb | 4 +-- templates/javascript/src/deserialize.js.erb | 4 +-- templates/lib/prism/serialize.rb.erb | 4 +-- 14 files changed, 49 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fef48088e9..1d5b02fea98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,34 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [Unreleased] +## [0.18.0] - 2023-11-21 + +### Added + +- The `ParametersNode#signature` method is added, which returns the same thing as `Method#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` and `UnlessNode` now have a `then_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`, and `end_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 to `libprism.*` 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 of `targets`, which are local variable target nodes. This is instead of `locals` 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 into `CaseNode` and `CaseMatchNode`, the latter is used for `case ... in` expressions. +- **BREAKING**: `StringConcatNode` has been removed in favor of using `InterpolatedStringNode` as a list. + ## [0.17.1] - 2023-11-03 ### Changed @@ -239,7 +267,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - 🎉 Initial release! 🎉 -[unreleased]: https://github.com/ruby/prism/compare/v0.17.1...HEAD +[unreleased]: https://github.com/ruby/prism/compare/v0.18.0...HEAD +[0.18.0]: https://github.com/ruby/prism/compare/v0.17.1...v0.18.0 [0.17.1]: https://github.com/ruby/prism/compare/v0.17.0...v0.17.1 [0.17.0]: https://github.com/ruby/prism/compare/v0.16.0...v0.17.0 [0.16.0]: https://github.com/ruby/prism/compare/v0.15.1...v0.16.0 diff --git a/Gemfile.lock b/Gemfile.lock index 2d8cf8617f9..147976f7cd0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - prism (0.17.1) + prism (0.18.0) GEM remote: https://rubygems.org/ diff --git a/ext/prism/extension.h b/ext/prism/extension.h index 4803aabe5e8..33418b102a8 100644 --- a/ext/prism/extension.h +++ b/ext/prism/extension.h @@ -1,7 +1,7 @@ #ifndef PRISM_EXT_NODE_H #define PRISM_EXT_NODE_H -#define EXPECTED_PRISM_VERSION "0.17.1" +#define EXPECTED_PRISM_VERSION "0.18.0" #include #include diff --git a/include/prism/version.h b/include/prism/version.h index 6d0bea616de..67a29ed38f9 100644 --- a/include/prism/version.h +++ b/include/prism/version.h @@ -14,16 +14,16 @@ /** * The minor version of the Prism library as an int. */ -#define PRISM_VERSION_MINOR 17 +#define PRISM_VERSION_MINOR 18 /** * The patch version of the Prism library as an int. */ -#define PRISM_VERSION_PATCH 1 +#define PRISM_VERSION_PATCH 0 /** * The version of the Prism library as a constant string. */ -#define PRISM_VERSION "0.17.1" +#define PRISM_VERSION "0.18.0" #endif diff --git a/javascript/package.json b/javascript/package.json index 9727f641b33..d3dcc71caf0 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -1,6 +1,6 @@ { "name": "@ruby/prism", - "version": "0.17.1", + "version": "0.18.0", "description": "Prism Ruby parser", "type": "module", "main": "src/index.js", diff --git a/prism.gemspec b/prism.gemspec index 4b0f87d4429..6fbd6c2945b 100644 --- a/prism.gemspec +++ b/prism.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "prism" - spec.version = "0.17.1" + spec.version = "0.18.0" spec.authors = ["Shopify"] spec.email = ["ruby@shopify.com"] diff --git a/rust/prism-sys/Cargo.lock b/rust/prism-sys/Cargo.lock index 7d638a5965c..bbc3c0adb87 100644 --- a/rust/prism-sys/Cargo.lock +++ b/rust/prism-sys/Cargo.lock @@ -167,7 +167,7 @@ dependencies = [ [[package]] name = "prism-sys" -version = "0.17.1" +version = "0.18.0" dependencies = [ "bindgen", "cc", diff --git a/rust/prism-sys/Cargo.toml b/rust/prism-sys/Cargo.toml index bf2eac11b60..8dbf446271d 100644 --- a/rust/prism-sys/Cargo.toml +++ b/rust/prism-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prism-sys" -version = "0.17.1" +version = "0.18.0" edition = "2021" license-file = "../../LICENSE.md" repository = "https://github.com/ruby/prism" diff --git a/rust/prism-sys/tests/utils_tests.rs b/rust/prism-sys/tests/utils_tests.rs index a5adc9c6ad9..b5880801617 100644 --- a/rust/prism-sys/tests/utils_tests.rs +++ b/rust/prism-sys/tests/utils_tests.rs @@ -12,7 +12,7 @@ fn version_test() { CStr::from_ptr(version) }; - assert_eq!(&cstring.to_string_lossy(), "0.17.1"); + assert_eq!(&cstring.to_string_lossy(), "0.18.0"); } #[test] diff --git a/rust/prism/Cargo.lock b/rust/prism/Cargo.lock index 49a8fe444ce..c998ecc566b 100644 --- a/rust/prism/Cargo.lock +++ b/rust/prism/Cargo.lock @@ -195,7 +195,7 @@ dependencies = [ [[package]] name = "prism" -version = "0.17.1" +version = "0.18.0" dependencies = [ "prism-sys", "serde", @@ -204,7 +204,7 @@ dependencies = [ [[package]] name = "prism-sys" -version = "0.17.1" +version = "0.18.0" dependencies = [ "bindgen", "cc", diff --git a/rust/prism/Cargo.toml b/rust/prism/Cargo.toml index 801c4a6c044..faed30bf172 100644 --- a/rust/prism/Cargo.toml +++ b/rust/prism/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prism" -version = "0.17.1" +version = "0.18.0" edition = "2021" license-file = "../../LICENSE.md" repository = "https://github.com/ruby/prism" diff --git a/templates/java/org/prism/Loader.java.erb b/templates/java/org/prism/Loader.java.erb index 0992c683351..8cae43dd96f 100644 --- a/templates/java/org/prism/Loader.java.erb +++ b/templates/java/org/prism/Loader.java.erb @@ -98,8 +98,8 @@ public class Loader { expect((byte) 'M', "incorrect prism header"); expect((byte) 0, "prism version does not match"); - expect((byte) 17, "prism version does not match"); - expect((byte) 1, "prism version does not match"); + expect((byte) 18, "prism version does not match"); + expect((byte) 0, "prism version does not match"); expect((byte) 1, "Loader.java requires no location fields in the serialized output"); diff --git a/templates/javascript/src/deserialize.js.erb b/templates/javascript/src/deserialize.js.erb index 2c615a7c66f..573d1146c94 100644 --- a/templates/javascript/src/deserialize.js.erb +++ b/templates/javascript/src/deserialize.js.erb @@ -1,8 +1,8 @@ import * as nodes from "./nodes.js"; const MAJOR_VERSION = 0; -const MINOR_VERSION = 17; -const PATCH_VERSION = 1; +const MINOR_VERSION = 18; +const PATCH_VERSION = 0; class SerializationBuffer { constructor(source, array) { diff --git a/templates/lib/prism/serialize.rb.erb b/templates/lib/prism/serialize.rb.erb index e5a88ae99ad..058142682e0 100644 --- a/templates/lib/prism/serialize.rb.erb +++ b/templates/lib/prism/serialize.rb.erb @@ -20,11 +20,11 @@ module Prism # The minor version of prism that we are expecting to find in the serialized # strings. - MINOR_VERSION = 17 + MINOR_VERSION = 18 # The patch version of prism that we are expecting to find in the serialized # strings. - PATCH_VERSION = 1 + PATCH_VERSION = 0 # Deserialize the AST represented by the given string into a parse result. def self.load(input, serialized)