prism 2.0.0.rc1-x86_64-linux-gnu → 2.0.0-x86_64-linux-gnu
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/3.3/prism.so +0 -0
- data/lib/prism/3.4/prism.so +0 -0
- data/lib/prism/4.0/prism.so +0 -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
|
@@ -23,8 +23,11 @@ module Prism
|
|
|
23
23
|
# lists described by the attributes of the same names. They are passed in
|
|
24
24
|
# empty when the source is created by the parser and filled in afterward,
|
|
25
25
|
# because the comments themselves refer to the source.
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
#
|
|
27
|
+
# The checksum parameter is the value described by the attribute of the same
|
|
28
|
+
# name. It is nil when the source is not created by the parser.
|
|
29
|
+
sig { params(source: String, start_line: Integer, offsets: T::Array[Integer], comments: T::Array[Comment], comment_attachments: T::Array[Comment], comment_ranges: T::Array[::T.nilable(Integer)], checksum: ::T.nilable(Integer)).returns(Source) }
|
|
30
|
+
def self.for(source, start_line, offsets, comments = T.unsafe(nil), comment_attachments = T.unsafe(nil), comment_ranges = T.unsafe(nil), checksum = T.unsafe(nil)); end
|
|
28
31
|
|
|
29
32
|
# The source code that this source object represents.
|
|
30
33
|
sig { returns(String) }
|
|
@@ -34,6 +37,11 @@ module Prism
|
|
|
34
37
|
sig { returns(Integer) }
|
|
35
38
|
attr_reader :start_line
|
|
36
39
|
|
|
40
|
+
# The checksum of the source code which can be used to quickly determine if
|
|
41
|
+
# the source has changed.
|
|
42
|
+
sig { returns(::T.nilable(Integer)) }
|
|
43
|
+
attr_reader :checksum
|
|
44
|
+
|
|
37
45
|
# The list of comments that were encountered during parsing. When the source
|
|
38
46
|
# is parsed with the attach_comments option, these are sorted by start
|
|
39
47
|
# offset.
|
|
@@ -62,13 +70,17 @@ module Prism
|
|
|
62
70
|
# Create a new source object with the given source code. The offsets
|
|
63
71
|
# parameter can be either an Array of Integer byte offsets or a packed
|
|
64
72
|
# binary string of uint32_t values (from the C extension).
|
|
65
|
-
sig { params(source: String, start_line: Integer, offsets: ::T.any(T::Array[Integer], String), comments: T::Array[Comment], comment_attachments: T::Array[Comment], comment_ranges: T::Array[::T.nilable(Integer)]).void }
|
|
66
|
-
def initialize(source, start_line, offsets, comments = T.unsafe(nil), comment_attachments = T.unsafe(nil), comment_ranges = T.unsafe(nil)); end
|
|
73
|
+
sig { params(source: String, start_line: Integer, offsets: ::T.any(T::Array[Integer], String), comments: T::Array[Comment], comment_attachments: T::Array[Comment], comment_ranges: T::Array[::T.nilable(Integer)], checksum: ::T.nilable(Integer)).void }
|
|
74
|
+
def initialize(source, start_line, offsets, comments = T.unsafe(nil), comment_attachments = T.unsafe(nil), comment_ranges = T.unsafe(nil), checksum = T.unsafe(nil)); end
|
|
67
75
|
|
|
68
76
|
# Replace the value of start_line with the given value.
|
|
69
77
|
sig { params(start_line: Integer).void }
|
|
70
78
|
def replace_start_line(start_line); end
|
|
71
79
|
|
|
80
|
+
# Replace the value of checksum with the given value.
|
|
81
|
+
sig { params(checksum: Integer).void }
|
|
82
|
+
def replace_checksum(checksum); end
|
|
83
|
+
|
|
72
84
|
# Replace the value of offsets with the given value.
|
|
73
85
|
sig { params(offsets: T::Array[Integer]).void }
|
|
74
86
|
def replace_offsets(offsets); end
|
|
@@ -138,8 +138,8 @@ module Prism
|
|
|
138
138
|
sig { returns(Integer) }
|
|
139
139
|
def load_uint32; end
|
|
140
140
|
|
|
141
|
-
sig {
|
|
142
|
-
def
|
|
141
|
+
sig { returns(Integer) }
|
|
142
|
+
def load_uint64; end
|
|
143
143
|
|
|
144
144
|
sig { params(encoding: Encoding).returns(String) }
|
|
145
145
|
def load_string(encoding); end
|
|
@@ -168,8 +168,12 @@ module Prism
|
|
|
168
168
|
sig { params(constant_pool: ConstantPool, encoding: Encoding).returns(::T.nilable(Symbol)) }
|
|
169
169
|
def load_optional_constant(constant_pool, encoding); end
|
|
170
170
|
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
# Load the nodes that are serialized before the given offset and return
|
|
172
|
+
# the root. Nodes are serialized in post-order, so the children of each
|
|
173
|
+
# node are the topmost values on the stack, in field order, by the time
|
|
174
|
+
# its record is read.
|
|
175
|
+
sig { params(constant_pool: ConstantPool, encoding: Encoding, freeze: T::Boolean, finish: Integer).returns(Node) }
|
|
176
|
+
def load_nodes(constant_pool, encoding, freeze, finish); end
|
|
173
177
|
|
|
174
178
|
sig { void }
|
|
175
179
|
def define_load_node_lambdas; end
|
|
@@ -13,6 +13,9 @@ module Prism
|
|
|
13
13
|
sig { params(string: String).returns(T::Boolean) }
|
|
14
14
|
def self.method_name?(string); end
|
|
15
15
|
|
|
16
|
+
sig { params(string: String).returns(T::Boolean) }
|
|
17
|
+
def self.keyword?(string); end
|
|
18
|
+
|
|
16
19
|
# The string that this query is wrapping.
|
|
17
20
|
sig { returns(String) }
|
|
18
21
|
attr_reader :string
|
|
@@ -32,5 +35,9 @@ module Prism
|
|
|
32
35
|
# Whether or not this string is a valid method name.
|
|
33
36
|
sig { returns(T::Boolean) }
|
|
34
37
|
def method_name?; end
|
|
38
|
+
|
|
39
|
+
# Whether or not this string is a valid keyword.
|
|
40
|
+
sig { returns(T::Boolean) }
|
|
41
|
+
def keyword?; end
|
|
35
42
|
end
|
|
36
43
|
end
|