prism 2.0.0.rc1 → 2.0.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 +13 -2
- data/CODE_OF_CONDUCT.md +1 -1
- data/LICENSE.md +1 -1
- data/docs/serialization.md +20 -6
- data/ext/prism/api_node.c +81 -81
- data/ext/prism/extension.c +54 -69
- data/ext/prism/extension.h +1 -1
- data/include/prism/arena.h +8 -0
- data/include/prism/arena.hpp +42 -0
- data/include/prism/ast.h +11 -1
- data/include/prism/ast.hpp +641 -0
- data/include/prism/buffer.h +8 -0
- data/include/prism/buffer.hpp +55 -0
- data/include/prism/comments.h +17 -0
- data/include/prism/compiler/accel.h +3 -1
- data/include/prism/compiler/branch.h +26 -0
- data/include/prism/compiler/bswap.h +46 -0
- data/include/prism/compiler/cplusplus.hpp +16 -0
- data/include/prism/compiler/endianness.h +34 -0
- data/include/prism/compiler/exceptions.hpp +17 -0
- data/include/prism/compiler/format.h +2 -0
- data/include/prism/compiler/lifetimebound.hpp +25 -0
- data/include/prism/constant_pool.h +25 -0
- data/include/prism/diagnostic.h +18 -0
- data/include/prism/errors_format.h +8 -0
- data/include/prism/internal/buffer.h +3 -0
- data/include/prism/internal/node.h +8 -4
- data/include/prism/internal/parser.h +20 -0
- data/include/prism/internal/stringy.h +1 -6
- data/include/prism/internal/xxh3.h +16 -0
- data/include/prism/json.h +8 -0
- data/include/prism/line_offset_list.h +8 -0
- data/include/prism/magic_comments.h +18 -0
- data/include/prism/node.h +55 -10
- data/include/prism/node.hpp +272 -0
- data/include/prism/node_type.hpp +38 -0
- data/include/prism/options.h +10 -1
- data/include/prism/options.hpp +43 -0
- data/include/prism/parser.h +93 -64
- data/include/prism/parser.hpp +274 -0
- data/include/prism/prettyprint.h +8 -0
- data/include/prism/serialize.h +8 -0
- data/include/prism/source.h +8 -0
- data/include/prism/stream.h +8 -0
- data/include/prism/string_query.h +19 -0
- data/include/prism/stringy.h +16 -27
- data/include/prism/stringy.hpp +31 -0
- data/include/prism/version.h +9 -1
- data/include/prism.h +0 -8
- data/include/prism.hpp +24 -0
- data/lib/prism/ffi.rb +6 -0
- data/lib/prism/node.rb +736 -0
- data/lib/prism/parse_result.rb +23 -8
- data/lib/prism/serialize.rb +2567 -3286
- data/lib/prism/string_query.rb +8 -0
- data/prism.gemspec +21 -4
- data/rbi/generated/prism/node.rbi +2430 -968
- data/rbi/generated/prism/parse_result.rbi +16 -4
- data/rbi/generated/prism/serialize.rbi +8 -4
- data/rbi/generated/prism/string_query.rbi +7 -0
- data/sig/generated/prism/node.rbs +2439 -967
- data/sig/generated/prism/parse_result.rbs +16 -4
- data/sig/generated/prism/serialize.rbs +9 -4
- data/sig/generated/prism/string_query.rbs +7 -0
- data/src/buffer.c +9 -0
- data/src/comments.c +2 -2
- data/src/diagnostic.c +8 -0
- data/src/node.c +216 -368
- data/src/options.c +7 -13
- data/src/parser.c +70 -48
- data/src/prism.c +581 -419
- data/src/regexp.c +0 -1
- data/src/serialize.c +2301 -1950
- data/src/source.c +8 -2
- data/src/string_query.c +14 -0
- data/src/stringy.c +3 -33
- data/src/xxh3.c +292 -0
- metadata +20 -3
data/lib/prism/string_query.rb
CHANGED
|
@@ -11,6 +11,7 @@ module Prism
|
|
|
11
11
|
# def self.local?: (String string) -> bool
|
|
12
12
|
# def self.constant?: (String string) -> bool
|
|
13
13
|
# def self.method_name?: (String string) -> bool
|
|
14
|
+
# def self.keyword?: (String string) -> bool
|
|
14
15
|
|
|
15
16
|
# The string that this query is wrapping.
|
|
16
17
|
attr_reader :string #: String
|
|
@@ -42,5 +43,12 @@ module Prism
|
|
|
42
43
|
def method_name?
|
|
43
44
|
StringQuery.method_name?(string)
|
|
44
45
|
end
|
|
46
|
+
|
|
47
|
+
# Whether or not this string is a valid keyword.
|
|
48
|
+
#
|
|
49
|
+
#: () -> bool
|
|
50
|
+
def keyword?
|
|
51
|
+
StringQuery.keyword?(string)
|
|
52
|
+
end
|
|
45
53
|
end
|
|
46
54
|
end
|
data/prism.gemspec
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |spec|
|
|
4
4
|
spec.name = "prism"
|
|
5
|
-
spec.version = "2.0.0
|
|
6
|
-
spec.authors = ["
|
|
7
|
-
spec.email = ["ruby@
|
|
5
|
+
spec.version = "2.0.0"
|
|
6
|
+
spec.authors = ["Ruby developers"]
|
|
7
|
+
spec.email = ["ruby-core@ruby-lang.org"]
|
|
8
8
|
|
|
9
9
|
spec.summary = "Prism Ruby parser"
|
|
10
10
|
spec.homepage = "https://github.com/ruby/prism"
|
|
@@ -46,9 +46,15 @@ Gem::Specification.new do |spec|
|
|
|
46
46
|
"ext/prism/extension.c",
|
|
47
47
|
"ext/prism/extension.h",
|
|
48
48
|
"include/prism.h",
|
|
49
|
+
"include/prism.hpp",
|
|
49
50
|
"include/prism/compiler/accel.h",
|
|
50
51
|
"include/prism/compiler/align.h",
|
|
51
52
|
"include/prism/compiler/assume.h",
|
|
53
|
+
"include/prism/compiler/branch.h",
|
|
54
|
+
"include/prism/compiler/bswap.h",
|
|
55
|
+
"include/prism/compiler/cplusplus.hpp",
|
|
56
|
+
"include/prism/compiler/endianness.h",
|
|
57
|
+
"include/prism/compiler/exceptions.hpp",
|
|
52
58
|
"include/prism/compiler/exported.h",
|
|
53
59
|
"include/prism/compiler/fallthrough.h",
|
|
54
60
|
"include/prism/compiler/filesystem.h",
|
|
@@ -56,6 +62,7 @@ Gem::Specification.new do |spec|
|
|
|
56
62
|
"include/prism/compiler/force_inline.h",
|
|
57
63
|
"include/prism/compiler/format.h",
|
|
58
64
|
"include/prism/compiler/inline.h",
|
|
65
|
+
"include/prism/compiler/lifetimebound.hpp",
|
|
59
66
|
"include/prism/compiler/nodiscard.h",
|
|
60
67
|
"include/prism/compiler/nonnull.h",
|
|
61
68
|
"include/prism/compiler/unused.h",
|
|
@@ -86,9 +93,13 @@ Gem::Specification.new do |spec|
|
|
|
86
93
|
"include/prism/internal/stringy.h",
|
|
87
94
|
"include/prism/internal/strpbrk.h",
|
|
88
95
|
"include/prism/internal/tokens.h",
|
|
96
|
+
"include/prism/internal/xxh3.h",
|
|
89
97
|
"include/prism/arena.h",
|
|
98
|
+
"include/prism/arena.hpp",
|
|
90
99
|
"include/prism/ast.h",
|
|
100
|
+
"include/prism/ast.hpp",
|
|
91
101
|
"include/prism/buffer.h",
|
|
102
|
+
"include/prism/buffer.hpp",
|
|
92
103
|
"include/prism/comments.h",
|
|
93
104
|
"include/prism/constant_pool.h",
|
|
94
105
|
"include/prism/diagnostic.h",
|
|
@@ -99,14 +110,19 @@ Gem::Specification.new do |spec|
|
|
|
99
110
|
"include/prism/line_offset_list.h",
|
|
100
111
|
"include/prism/magic_comments.h",
|
|
101
112
|
"include/prism/node.h",
|
|
113
|
+
"include/prism/node.hpp",
|
|
114
|
+
"include/prism/node_type.hpp",
|
|
102
115
|
"include/prism/options.h",
|
|
116
|
+
"include/prism/options.hpp",
|
|
103
117
|
"include/prism/parser.h",
|
|
118
|
+
"include/prism/parser.hpp",
|
|
104
119
|
"include/prism/prettyprint.h",
|
|
105
120
|
"include/prism/serialize.h",
|
|
106
121
|
"include/prism/source.h",
|
|
107
122
|
"include/prism/stream.h",
|
|
108
123
|
"include/prism/string_query.h",
|
|
109
124
|
"include/prism/stringy.h",
|
|
125
|
+
"include/prism/stringy.hpp",
|
|
110
126
|
"include/prism/version.h",
|
|
111
127
|
"lib/prism.rb",
|
|
112
128
|
"lib/prism/compiler.rb",
|
|
@@ -224,7 +240,8 @@ Gem::Specification.new do |spec|
|
|
|
224
240
|
"src/stringy.c",
|
|
225
241
|
"src/strncasecmp.c",
|
|
226
242
|
"src/strpbrk.c",
|
|
227
|
-
"src/tokens.c"
|
|
243
|
+
"src/tokens.c",
|
|
244
|
+
"src/xxh3.c"
|
|
228
245
|
]
|
|
229
246
|
|
|
230
247
|
spec.extensions = ["ext/prism/extconf.rb"]
|