prism 1.3.0 โ 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -1
- data/config.yml +9 -0
- data/docs/releasing.md +1 -1
- data/docs/ruby_api.md +1 -1
- data/ext/prism/api_node.c +1814 -1303
- data/ext/prism/extension.c +230 -109
- data/ext/prism/extension.h +4 -4
- data/include/prism/ast.h +16 -0
- data/include/prism/defines.h +4 -1
- data/include/prism/options.h +47 -1
- data/include/prism/util/pm_buffer.h +10 -0
- data/include/prism/version.h +2 -2
- data/include/prism.h +4 -4
- data/lib/prism/dot_visitor.rb +16 -0
- data/lib/prism/dsl.rb +10 -2
- data/lib/prism/ffi.rb +45 -27
- data/lib/prism/inspect_visitor.rb +2 -1
- data/lib/prism/node.rb +48 -10
- data/lib/prism/parse_result/newlines.rb +1 -1
- data/lib/prism/parse_result.rb +52 -0
- data/lib/prism/polyfill/append_as_bytes.rb +15 -0
- data/lib/prism/reflection.rb +2 -2
- data/lib/prism/serialize.rb +1252 -765
- data/lib/prism/translation/parser/builder.rb +61 -0
- data/lib/prism/translation/parser/compiler.rb +192 -136
- data/lib/prism/translation/parser/lexer.rb +435 -61
- data/lib/prism/translation/parser.rb +51 -3
- data/lib/prism/translation/parser35.rb +12 -0
- data/lib/prism/translation/ripper.rb +13 -3
- data/lib/prism/translation/ruby_parser.rb +5 -4
- data/lib/prism/translation.rb +1 -0
- data/lib/prism.rb +3 -3
- data/prism.gemspec +5 -1
- data/rbi/prism/dsl.rbi +6 -3
- data/rbi/prism/node.rbi +22 -7
- data/rbi/prism/parse_result.rbi +17 -0
- data/rbi/prism/translation/parser35.rbi +6 -0
- data/rbi/prism.rbi +39 -36
- data/sig/prism/dsl.rbs +4 -2
- data/sig/prism/node.rbs +17 -7
- data/sig/prism/parse_result.rbs +10 -0
- data/sig/prism/serialize.rbs +4 -2
- data/sig/prism.rbs +22 -1
- data/src/diagnostic.c +2 -2
- data/src/node.c +21 -0
- data/src/options.c +31 -0
- data/src/prettyprint.c +30 -0
- data/src/prism.c +374 -118
- data/src/serialize.c +6 -0
- data/src/util/pm_buffer.c +40 -0
- data/src/util/pm_constant_pool.c +6 -2
- data/src/util/pm_strncasecmp.c +13 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0209a58426470fc6afedb5922c9bf9264cb9ccd2debbef68fb1a307a4d1be78
|
4
|
+
data.tar.gz: 491a11ab3d9d840f4ac228e8b79e85ddb24ae1f82b3cee7cbdb1003bea9f33f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30b9cb40262daf924f047034c6314b418c367691eccc188acd08328bd92e6a51d3818a91c3d17fb5dc3f159129186ef6c4bd7bfbe815b9c8f268fa9b938fd1ac
|
7
|
+
data.tar.gz: a1b9ab207e98c779b0d371f2f14e6c5fb8315273af7518bc8e8135ba3dff4f1385787e169a4e4c146aa1ea7c10f6fce4f82d37958f88e8f68f1e8dabe54115bf
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,28 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.4.0] - 2025-03-18
|
10
|
+
|
11
|
+
### Added
|
12
|
+
|
13
|
+
- Support `3.5` as a version option.
|
14
|
+
- Many, many compatibility fixes for the parser translation layer.
|
15
|
+
- Handle escapes in named capture names.
|
16
|
+
- The `freeze` option is added to the various `Prism::` APIs to deeply freeze the AST.
|
17
|
+
- Properly support `it` for the parser and ruby_parser translation layers.
|
18
|
+
- Track the `then` keyword on `rescue` nodes.
|
19
|
+
- Add a `multiple_statements?` flag to parentheses nodes to support desired `defined?` behavior.
|
20
|
+
|
21
|
+
### Changed
|
22
|
+
|
23
|
+
- The strings used in the AST are now frozen.
|
24
|
+
- Fixed handling escaped characters after control sequences in character literals.
|
25
|
+
- Fix reading off the end of an unterminated global variable.
|
26
|
+
- Raise a syntax error for defining `[]=` with endless method syntax.
|
27
|
+
- Increase value of `PRISM_DEPTH_MAXIMUM` to `10000`.
|
28
|
+
- Freeze `Prism::VERSION`.
|
29
|
+
- Fix up rescue modifier precedence.
|
30
|
+
|
9
31
|
## [1.3.0] - 2024-12-21
|
10
32
|
|
11
33
|
### Added
|
@@ -627,7 +649,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
627
649
|
|
628
650
|
- ๐ Initial release! ๐
|
629
651
|
|
630
|
-
[unreleased]: https://github.com/ruby/prism/compare/v1.
|
652
|
+
[unreleased]: https://github.com/ruby/prism/compare/v1.4.0...HEAD
|
653
|
+
[1.4.0]: https://github.com/ruby/prism/compare/v1.3.0...v1.4.0
|
631
654
|
[1.3.0]: https://github.com/ruby/prism/compare/v1.2.0...v1.3.0
|
632
655
|
[1.2.0]: https://github.com/ruby/prism/compare/v1.1.0...v1.2.0
|
633
656
|
[1.1.0]: https://github.com/ruby/prism/compare/v1.0.0...v1.1.0
|
data/config.yml
CHANGED
@@ -719,6 +719,11 @@ flags:
|
|
719
719
|
- name: REPEATED_PARAMETER
|
720
720
|
comment: "a parameter name that has been repeated in the method signature"
|
721
721
|
comment: Flags for parameter nodes.
|
722
|
+
- name: ParenthesesNodeFlags
|
723
|
+
values:
|
724
|
+
- name: MULTIPLE_STATEMENTS
|
725
|
+
comment: "parentheses that contain multiple potentially void statements"
|
726
|
+
comment: Flags for parentheses nodes.
|
722
727
|
- name: RangeFlags
|
723
728
|
values:
|
724
729
|
- name: EXCLUDE_END
|
@@ -3140,6 +3145,7 @@ nodes:
|
|
3140
3145
|
- EmbeddedStatementsNode
|
3141
3146
|
- EmbeddedVariableNode
|
3142
3147
|
- InterpolatedStringNode # `"a" "#{b}"`
|
3148
|
+
- on error: XStringNode # `<<`FOO` "bar"
|
3143
3149
|
- name: closing_loc
|
3144
3150
|
type: location?
|
3145
3151
|
newline: parts
|
@@ -3851,6 +3857,7 @@ nodes:
|
|
3851
3857
|
^^^^^^^
|
3852
3858
|
end
|
3853
3859
|
- name: ParenthesesNode
|
3860
|
+
flags: ParenthesesNodeFlags
|
3854
3861
|
fields:
|
3855
3862
|
- name: body
|
3856
3863
|
type: node?
|
@@ -4084,6 +4091,8 @@ nodes:
|
|
4084
4091
|
- on error: BackReferenceReadNode # => begin; rescue => $&; end
|
4085
4092
|
- on error: NumberedReferenceReadNode # => begin; rescue => $1; end
|
4086
4093
|
- on error: MissingNode # begin; rescue =>; end
|
4094
|
+
- name: then_keyword_loc
|
4095
|
+
type: location?
|
4087
4096
|
- name: statements
|
4088
4097
|
type: node?
|
4089
4098
|
kind: StatementsNode
|
data/docs/releasing.md
CHANGED
data/docs/ruby_api.md
CHANGED
@@ -23,7 +23,7 @@ The full API is documented below.
|
|
23
23
|
* `Prism.parse_stream(io)` - parse the syntax tree corresponding to the source that is read out of the given IO object using the `#gets` method and return it within a parse result
|
24
24
|
* `Prism.parse_lex(source)` - parse the syntax tree corresponding to the given source string and return it within a parse result, along with the tokens
|
25
25
|
* `Prism.parse_lex_file(filepath)` - parse the syntax tree corresponding to the given source file and return it within a parse result, along with the tokens
|
26
|
-
* `Prism.load(source, serialized)` - load the serialized syntax tree using the source as a reference into a syntax tree
|
26
|
+
* `Prism.load(source, serialized, freeze = false)` - load the serialized syntax tree using the source as a reference into a syntax tree
|
27
27
|
* `Prism.parse_comments(source)` - parse the comments corresponding to the given source string and return them
|
28
28
|
* `Prism.parse_file_comments(source)` - parse the comments corresponding to the given source file and return them
|
29
29
|
* `Prism.parse_success?(source)` - parse the syntax tree corresponding to the given source string and return true if it was parsed without errors
|