prism 1.4.0 → 1.7.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 +73 -1
- data/Makefile +7 -5
- data/README.md +3 -1
- data/config.yml +294 -41
- data/docs/build_system.md +2 -2
- data/docs/cruby_compilation.md +1 -1
- data/docs/design.md +2 -2
- data/docs/parser_translation.md +8 -23
- data/docs/releasing.md +6 -25
- data/docs/ripper_translation.md +1 -1
- data/ext/prism/api_node.c +9 -3
- data/ext/prism/extconf.rb +1 -1
- data/ext/prism/extension.c +24 -3
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +360 -70
- data/include/prism/diagnostic.h +7 -0
- data/include/prism/options.h +49 -3
- data/include/prism/parser.h +3 -0
- data/include/prism/regexp.h +2 -2
- data/include/prism/util/pm_buffer.h +8 -0
- data/include/prism/util/pm_integer.h +4 -0
- data/include/prism/util/pm_list.h +6 -0
- data/include/prism/util/pm_string.h +12 -2
- data/include/prism/version.h +2 -2
- data/include/prism.h +40 -15
- data/lib/prism/compiler.rb +456 -151
- data/lib/prism/desugar_compiler.rb +1 -0
- data/lib/prism/dispatcher.rb +16 -0
- data/lib/prism/dot_visitor.rb +10 -1
- data/lib/prism/dsl.rb +5 -2
- data/lib/prism/ffi.rb +28 -10
- data/lib/prism/inspect_visitor.rb +4 -0
- data/lib/prism/lex_compat.rb +1 -0
- data/lib/prism/mutation_compiler.rb +3 -0
- data/lib/prism/node.rb +559 -349
- data/lib/prism/node_ext.rb +4 -1
- data/lib/prism/pack.rb +2 -0
- data/lib/prism/parse_result/comments.rb +1 -0
- data/lib/prism/parse_result/errors.rb +1 -0
- data/lib/prism/parse_result/newlines.rb +1 -0
- data/lib/prism/parse_result.rb +3 -15
- data/lib/prism/pattern.rb +1 -0
- data/lib/prism/polyfill/scan_byte.rb +14 -0
- data/lib/prism/polyfill/warn.rb +36 -0
- data/lib/prism/reflection.rb +4 -1
- data/lib/prism/relocation.rb +1 -0
- data/lib/prism/serialize.rb +30 -22
- data/lib/prism/string_query.rb +1 -0
- data/lib/prism/translation/parser/builder.rb +1 -0
- data/lib/prism/translation/parser/compiler.rb +63 -41
- data/lib/prism/translation/parser/lexer.rb +29 -21
- data/lib/prism/translation/parser.rb +25 -4
- data/lib/prism/translation/parser33.rb +1 -0
- data/lib/prism/translation/parser34.rb +1 -0
- data/lib/prism/translation/parser35.rb +2 -6
- data/lib/prism/translation/parser40.rb +13 -0
- data/lib/prism/translation/parser41.rb +13 -0
- data/lib/prism/translation/parser_current.rb +26 -0
- data/lib/prism/translation/ripper/sexp.rb +1 -0
- data/lib/prism/translation/ripper.rb +19 -3
- data/lib/prism/translation/ruby_parser.rb +340 -22
- data/lib/prism/translation.rb +4 -0
- data/lib/prism/visitor.rb +457 -152
- data/lib/prism.rb +22 -0
- data/prism.gemspec +9 -1
- data/rbi/prism/dsl.rbi +6 -6
- data/rbi/prism/node.rbi +42 -17
- data/rbi/prism/translation/parser35.rbi +0 -2
- data/rbi/prism/translation/parser40.rbi +6 -0
- data/rbi/prism/translation/parser41.rbi +6 -0
- data/sig/prism/dispatcher.rbs +3 -0
- data/sig/prism/dsl.rbs +5 -5
- data/sig/prism/node.rbs +462 -38
- data/sig/prism/node_ext.rbs +84 -17
- data/sig/prism/parse_result/comments.rbs +38 -0
- data/sig/prism/parse_result.rbs +4 -0
- data/sig/prism/reflection.rbs +1 -1
- data/sig/prism.rbs +4 -0
- data/src/diagnostic.c +13 -1
- data/src/encoding.c +172 -67
- data/src/node.c +11 -0
- data/src/options.c +17 -7
- data/src/prettyprint.c +18 -0
- data/src/prism.c +1495 -2021
- data/src/serialize.c +9 -1
- data/src/token_type.c +38 -36
- data/src/util/pm_constant_pool.c +1 -1
- data/src/util/pm_string.c +6 -8
- metadata +11 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34ddf7552f6698f496fba09232eac5bcfb053d0455cdac655d81d4a9e5c60d96
|
|
4
|
+
data.tar.gz: 248141836d3f2502508f3374586bfd6590d1457dd0508494588a8905c56aea91
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e46578f5a2dd28f487bd4ffbdc7cd34bf15f230118f53bf932bea0ccff22cc4fcd000804f9a7bc27fd3399099bbd368f9ac89b6408df7de766ad1aef24a3cda
|
|
7
|
+
data.tar.gz: 7e25c7caf0fbf963e7c7aadaf35535f3c770c1813e0b9cfd3f8d4623d2d47c5a1d8e2e487d59d75a711871b9bdf5dca92c9e85af0dd4d3f513e86d3d7a66e37d
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,73 @@ 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.7.0] - 2025-12-18
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Support `4.1` as a version option.
|
|
14
|
+
- Add `equal_loc` to `CallNode`.
|
|
15
|
+
- Add `len()`/`is_empty()` to `ConstantList` and `NodeList` in the Rust API.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Rename version `3.5` to version `4.0`.
|
|
20
|
+
- Fix compiling the gem from source on Windows.
|
|
21
|
+
- Fix parsing of unary method calls like `42.~@`.
|
|
22
|
+
- Reject `def f a, (b) = 1`.
|
|
23
|
+
- Reject endless method as a block parameter default.
|
|
24
|
+
- Reject variable capture in alternative pattern.
|
|
25
|
+
- Many fixes in regards to memory safety, found through fuzzing.
|
|
26
|
+
- Many fixes to better handle invalid syntax, also found through fuzzing.
|
|
27
|
+
- Fix the ruby version used by the `ripper` translator.
|
|
28
|
+
- Fix `ruby_parser` translation comment processing.
|
|
29
|
+
|
|
30
|
+
## [1.6.0] - 2025-10-16
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- Add support for passing `"current"` as the version option to `Prism.*` APIs.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- Remove a compiler warning for a missing unsigned cast for a shift value.
|
|
39
|
+
|
|
40
|
+
## [1.5.2] - 2025-10-09
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- Fix character literal forced encoding when a unicode escape sequence is used.
|
|
45
|
+
- Reject `1 if foo = bar baz`.
|
|
46
|
+
- Clear static literal flag on interpolated strings.
|
|
47
|
+
- Reject optional argument/endless method definition ambiguity.
|
|
48
|
+
|
|
49
|
+
## [1.5.1] - 2025-09-13
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
|
|
53
|
+
- Revert of a bug introduced with static literal flags on interpolated strings.
|
|
54
|
+
|
|
55
|
+
## [1.5.0] - 2025-09-12
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- Add `Prism::Translation::ParserCurrent`.
|
|
60
|
+
- Add `Integer::to_u32_digits` for the Rust API.
|
|
61
|
+
- Add `pm_comment_type_t` field for the Rust API.
|
|
62
|
+
- Support leading logical operators for CRuby 3.5+.
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- Mark Prism as ractor-safe.
|
|
67
|
+
- Enforce a minimum version for the parser translation layer.
|
|
68
|
+
- Many fixes to the parser translation layer.
|
|
69
|
+
- Accept a newline after the `defined?` keyword.
|
|
70
|
+
- Reject `true && not true`.
|
|
71
|
+
- Make `it = it` assign nil to match parse.y behavior [Bug #21139].
|
|
72
|
+
- Some fixes to the ruby parser translation layer.
|
|
73
|
+
- Ensure call nodes have the correct ending location.
|
|
74
|
+
- Reject `foo && return bar`.
|
|
75
|
+
|
|
9
76
|
## [1.4.0] - 2025-03-18
|
|
10
77
|
|
|
11
78
|
### Added
|
|
@@ -649,7 +716,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
|
649
716
|
|
|
650
717
|
- 🎉 Initial release! 🎉
|
|
651
718
|
|
|
652
|
-
[unreleased]: https://github.com/ruby/prism/compare/v1.
|
|
719
|
+
[unreleased]: https://github.com/ruby/prism/compare/v1.7.0...HEAD
|
|
720
|
+
[1.7.0]: https://github.com/ruby/prism/compare/v1.6.0...v1.7.0
|
|
721
|
+
[1.6.0]: https://github.com/ruby/prism/compare/v1.5.2...v1.6.0
|
|
722
|
+
[1.5.2]: https://github.com/ruby/prism/compare/v1.5.1...v1.5.2
|
|
723
|
+
[1.5.1]: https://github.com/ruby/prism/compare/v1.5.0...v1.5.1
|
|
724
|
+
[1.5.0]: https://github.com/ruby/prism/compare/v1.4.0...v1.5.0
|
|
653
725
|
[1.4.0]: https://github.com/ruby/prism/compare/v1.3.0...v1.4.0
|
|
654
726
|
[1.3.0]: https://github.com/ruby/prism/compare/v1.2.0...v1.3.0
|
|
655
727
|
[1.2.0]: https://github.com/ruby/prism/compare/v1.1.0...v1.2.0
|
data/Makefile
CHANGED
|
@@ -12,8 +12,10 @@ SOEXT ?= $(shell ruby -e 'puts RbConfig::CONFIG["SOEXT"]')
|
|
|
12
12
|
|
|
13
13
|
CPPFLAGS := -Iinclude $(CPPFLAGS)
|
|
14
14
|
CFLAGS := -g -O2 -std=c99 -Wall -Werror -Wextra -Wpedantic -Wundef -Wconversion -Wno-missing-braces -fPIC -fvisibility=hidden -Wimplicit-fallthrough $(CFLAGS)
|
|
15
|
+
JAVA_WASM_CFLAGS := -g -Oz -std=c99 -Wall -Werror -Wextra -Wpedantic -Wundef -Wconversion -Wno-missing-braces -fPIC -fvisibility=hidden -Wimplicit-fallthrough $(JAVA_WASM_CFLAGS)
|
|
15
16
|
CC ?= cc
|
|
16
17
|
AR ?= ar
|
|
18
|
+
ARFLAGS ?= -r$(V0:1=v)
|
|
17
19
|
WASI_SDK_PATH := /opt/wasi-sdk
|
|
18
20
|
|
|
19
21
|
MAKEDIRS ?= mkdir -p
|
|
@@ -37,7 +39,7 @@ build/libprism.$(SOEXT): $(SHARED_OBJECTS)
|
|
|
37
39
|
|
|
38
40
|
build/libprism.a: $(STATIC_OBJECTS)
|
|
39
41
|
$(ECHO) "building $@ with $(AR)"
|
|
40
|
-
$(Q) $(AR) $(ARFLAGS) $@ $(STATIC_OBJECTS)
|
|
42
|
+
$(Q) $(AR) $(ARFLAGS) $@ $(STATIC_OBJECTS)
|
|
41
43
|
|
|
42
44
|
javascript/src/prism.wasm: Makefile $(SOURCES) $(HEADERS)
|
|
43
45
|
$(ECHO) "building $@"
|
|
@@ -45,7 +47,7 @@ javascript/src/prism.wasm: Makefile $(SOURCES) $(HEADERS)
|
|
|
45
47
|
|
|
46
48
|
java-wasm/src/test/resources/prism.wasm: Makefile $(SOURCES) $(HEADERS)
|
|
47
49
|
$(ECHO) "building $@"
|
|
48
|
-
$(Q) $(WASI_SDK_PATH)/bin/clang $(DEBUG_FLAGS) -DPRISM_EXPORT_SYMBOLS -D_WASI_EMULATED_MMAN -lwasi-emulated-mman $(CPPFLAGS) $(
|
|
50
|
+
$(Q) $(WASI_SDK_PATH)/bin/clang $(DEBUG_FLAGS) -DPRISM_EXCLUDE_PRETTYPRINT -DPRISM_EXPORT_SYMBOLS -D_WASI_EMULATED_MMAN -lwasi-emulated-mman $(CPPFLAGS) $(JAVA_WASM_CFLAGS) -Wl,--export-all -Wl,--no-entry -mexec-model=reactor -lc++ -lc++abi -o $@ $(SOURCES)
|
|
49
51
|
|
|
50
52
|
build/shared/%.o: src/%.c Makefile $(HEADERS)
|
|
51
53
|
$(ECHO) "compiling $@"
|
|
@@ -61,12 +63,12 @@ build/fuzz.%: $(SOURCES) fuzz/%.c fuzz/fuzz.c
|
|
|
61
63
|
$(ECHO) "building $* fuzzer"
|
|
62
64
|
$(Q) $(MAKEDIRS) $(@D)
|
|
63
65
|
$(ECHO) "building main fuzz binary"
|
|
64
|
-
$(Q)
|
|
66
|
+
$(Q) afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@ $^
|
|
65
67
|
$(ECHO) "building cmplog binary"
|
|
66
|
-
$(Q)
|
|
68
|
+
$(Q) AFL_LLVM_CMPLOG=1 afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@.cmplog $^
|
|
67
69
|
|
|
68
70
|
build/fuzz.heisenbug.%: $(SOURCES) fuzz/%.c fuzz/heisenbug.c
|
|
69
|
-
$(Q)
|
|
71
|
+
$(Q) afl-clang-lto $(DEBUG_FLAGS) $(CPPFLAGS) $(CFLAGS) $(FUZZ_FLAGS) -O0 -fsanitize-ignorelist=fuzz/asan.ignore -fsanitize=fuzzer,address -ggdb3 -std=c99 -Iinclude -o $@ $^
|
|
70
72
|
|
|
71
73
|
fuzz-debug:
|
|
72
74
|
$(ECHO) "entering debug shell"
|
data/README.md
CHANGED
|
@@ -116,7 +116,7 @@ Prism has been integrated into the majority of Ruby runtimes, many libraries, an
|
|
|
116
116
|
* [JRuby](https://github.com/jruby/jruby/pull/8103) (via Java)
|
|
117
117
|
* [Natalie](https://github.com/natalie-lang/natalie/pull/1213) (via C++ and Ruby)
|
|
118
118
|
* [Opal](https://github.com/opal/opal/pull/2642) (via Ruby and WASM)
|
|
119
|
-
* [TruffleRuby](https://github.com/
|
|
119
|
+
* [TruffleRuby](https://github.com/truffleruby/truffleruby/issues/3117) (via Java)
|
|
120
120
|
|
|
121
121
|
### Libraries
|
|
122
122
|
|
|
@@ -135,7 +135,9 @@ Prism has been integrated into the majority of Ruby runtimes, many libraries, an
|
|
|
135
135
|
* [sorbet-eraser](https://github.com/kddnewton/sorbet-eraser/pull/25)
|
|
136
136
|
* [synvert](https://github.com/xinminlabs/synvert-core-ruby)
|
|
137
137
|
* [typeprof](https://github.com/ruby/typeprof)
|
|
138
|
+
* [unparser](https://github.com/mbj/unparser) (via parser translator)
|
|
138
139
|
|
|
139
140
|
### Applications
|
|
140
141
|
|
|
141
142
|
* [gem.sh](https://github.com/marcoroth/gem.sh/pull/96)
|
|
143
|
+
* [Sorbet](https://github.com/sorbet/sorbet)
|