prism 2.0.0.rc1-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 +7 -0
- data/BSDmakefile +58 -0
- data/CHANGELOG.md +870 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +58 -0
- data/LICENSE.md +7 -0
- data/Makefile +145 -0
- data/README.md +81 -0
- data/config.yml +4752 -0
- data/docs/build_system.md +119 -0
- data/docs/configuration.md +69 -0
- data/docs/cruby_compilation.md +27 -0
- data/docs/design.md +53 -0
- data/docs/encoding.md +121 -0
- data/docs/fuzzing.md +81 -0
- data/docs/heredocs.md +36 -0
- data/docs/javascript.md +133 -0
- data/docs/local_variable_depth.md +229 -0
- data/docs/mapping.md +117 -0
- data/docs/parser_translation.md +24 -0
- data/docs/parsing_rules.md +22 -0
- data/docs/releasing.md +147 -0
- data/docs/relocation.md +32 -0
- data/docs/ripper_translation.md +63 -0
- data/docs/ruby_api.md +45 -0
- data/docs/ruby_parser_translation.md +19 -0
- data/docs/serialization.md +230 -0
- data/docs/testing.md +72 -0
- data/ext/prism/api_node.c +7005 -0
- data/ext/prism/extconf.rb +126 -0
- data/ext/prism/extension.c +1783 -0
- data/ext/prism/extension.h +19 -0
- data/include/prism/arena.h +37 -0
- data/include/prism/ast.h +10371 -0
- data/include/prism/buffer.h +52 -0
- data/include/prism/comments.h +55 -0
- data/include/prism/compiler/accel.h +24 -0
- data/include/prism/compiler/align.h +36 -0
- data/include/prism/compiler/assume.h +25 -0
- data/include/prism/compiler/exported.h +24 -0
- data/include/prism/compiler/fallthrough.h +22 -0
- data/include/prism/compiler/filesystem.h +32 -0
- data/include/prism/compiler/flex_array.h +19 -0
- data/include/prism/compiler/force_inline.h +21 -0
- data/include/prism/compiler/format.h +25 -0
- data/include/prism/compiler/inline.h +17 -0
- data/include/prism/compiler/nodiscard.h +22 -0
- data/include/prism/compiler/nonnull.h +18 -0
- data/include/prism/compiler/unused.h +18 -0
- data/include/prism/constant_pool.h +81 -0
- data/include/prism/diagnostic.h +93 -0
- data/include/prism/errors_format.h +53 -0
- data/include/prism/excludes.h +29 -0
- data/include/prism/integer.h +41 -0
- data/include/prism/internal/allocator.h +68 -0
- data/include/prism/internal/allocator_debug.h +88 -0
- data/include/prism/internal/arena.h +108 -0
- data/include/prism/internal/bit.h +42 -0
- data/include/prism/internal/buffer.h +91 -0
- data/include/prism/internal/char.h +145 -0
- data/include/prism/internal/comments.h +53 -0
- data/include/prism/internal/constant_pool.h +152 -0
- data/include/prism/internal/diagnostic.h +389 -0
- data/include/prism/internal/encoding.h +242 -0
- data/include/prism/internal/integer.h +68 -0
- data/include/prism/internal/isinf.h +16 -0
- data/include/prism/internal/line_offset_list.h +34 -0
- data/include/prism/internal/list.h +62 -0
- data/include/prism/internal/magic_comments.h +23 -0
- data/include/prism/internal/memchr.h +15 -0
- data/include/prism/internal/node.h +38 -0
- data/include/prism/internal/options.h +232 -0
- data/include/prism/internal/parser.h +984 -0
- data/include/prism/internal/regexp.h +26 -0
- data/include/prism/internal/serialize.h +39 -0
- data/include/prism/internal/source.h +72 -0
- data/include/prism/internal/static_literals.h +100 -0
- data/include/prism/internal/stringy.h +35 -0
- data/include/prism/internal/strncasecmp.h +18 -0
- data/include/prism/internal/strpbrk.h +33 -0
- data/include/prism/internal/tokens.h +11 -0
- data/include/prism/json.h +32 -0
- data/include/prism/line_offset_list.h +61 -0
- data/include/prism/magic_comments.h +35 -0
- data/include/prism/node.h +94 -0
- data/include/prism/options.h +354 -0
- data/include/prism/parser.h +404 -0
- data/include/prism/prettyprint.h +31 -0
- data/include/prism/serialize.h +115 -0
- data/include/prism/source.h +155 -0
- data/include/prism/stream.h +28 -0
- data/include/prism/string_query.h +63 -0
- data/include/prism/stringy.h +72 -0
- data/include/prism/version.h +38 -0
- data/include/prism.h +131 -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/compiler.rb +815 -0
- data/lib/prism/desugar_compiler.rb +463 -0
- data/lib/prism/dispatcher.rb +2383 -0
- data/lib/prism/dot_visitor.rb +4848 -0
- data/lib/prism/dsl.rb +1369 -0
- data/lib/prism/ffi.rb +740 -0
- data/lib/prism/inspect_visitor.rb +2425 -0
- data/lib/prism/lex_compat.rb +953 -0
- data/lib/prism/mutation_compiler.rb +780 -0
- data/lib/prism/node.rb +33204 -0
- data/lib/prism/node_ext.rb +504 -0
- data/lib/prism/node_find.rb +215 -0
- data/lib/prism/parse_result/errors.rb +72 -0
- data/lib/prism/parse_result/newlines.rb +423 -0
- data/lib/prism/parse_result.rb +1221 -0
- data/lib/prism/pattern.rb +314 -0
- data/lib/prism/polyfill/append_as_bytes.rb +15 -0
- data/lib/prism/polyfill/byteindex.rb +13 -0
- data/lib/prism/polyfill/scan_byte.rb +14 -0
- data/lib/prism/polyfill/unpack1.rb +14 -0
- data/lib/prism/polyfill/warn.rb +36 -0
- data/lib/prism/reflection.rb +427 -0
- data/lib/prism/relocation.rb +567 -0
- data/lib/prism/serialize.rb +5308 -0
- data/lib/prism/string_query.rb +46 -0
- data/lib/prism/translation/parser/builder.rb +70 -0
- data/lib/prism/translation/parser/compiler.rb +2226 -0
- data/lib/prism/translation/parser/lexer.rb +769 -0
- data/lib/prism/translation/parser.rb +376 -0
- data/lib/prism/translation/parser_current.rb +26 -0
- data/lib/prism/translation/parser_versions.rb +36 -0
- data/lib/prism/translation/ripper/filter.rb +53 -0
- data/lib/prism/translation/ripper/lexer.rb +133 -0
- data/lib/prism/translation/ripper/sexp.rb +118 -0
- data/lib/prism/translation/ripper/shim.rb +7 -0
- data/lib/prism/translation/ripper.rb +4278 -0
- data/lib/prism/translation/ruby_parser.rb +1721 -0
- data/lib/prism/translation.rb +20 -0
- data/lib/prism/visitor.rb +1440 -0
- data/lib/prism.rb +168 -0
- data/prism.gemspec +234 -0
- data/rbi/generated/prism/compiler.rbi +489 -0
- data/rbi/generated/prism/desugar_compiler.rbi +306 -0
- data/rbi/generated/prism/dispatcher.rbi +1138 -0
- data/rbi/generated/prism/dot_visitor.rbi +618 -0
- data/rbi/generated/prism/dsl.rbi +751 -0
- data/rbi/generated/prism/inspect_visitor.rbi +503 -0
- data/rbi/generated/prism/lex_compat.rbi +162 -0
- data/rbi/generated/prism/mutation_compiler.rbi +464 -0
- data/rbi/generated/prism/node.rbi +13681 -0
- data/rbi/generated/prism/node_ext.rbi +259 -0
- data/rbi/generated/prism/node_find.rbi +79 -0
- data/rbi/generated/prism/parse_result/errors.rbi +21 -0
- data/rbi/generated/prism/parse_result/newlines.rbi +208 -0
- data/rbi/generated/prism/parse_result.rbi +764 -0
- data/rbi/generated/prism/pattern.rbi +134 -0
- data/rbi/generated/prism/reflection.rbi +89 -0
- data/rbi/generated/prism/relocation.rbi +329 -0
- data/rbi/generated/prism/serialize.rbi +181 -0
- data/rbi/generated/prism/string_query.rbi +36 -0
- data/rbi/generated/prism/translation.rbi +7 -0
- data/rbi/generated/prism/visitor.rbi +650 -0
- data/rbi/generated/prism.rbi +86 -0
- data/rbi/prism/translation/parser.rbi +11 -0
- data/rbi/prism/translation/parser_versions.rbi +28 -0
- data/rbi/prism/translation/ripper.rbi +15 -0
- data/rbi/rubyvm/node_find.rbi +14 -0
- data/sig/generated/prism/compiler.rbs +492 -0
- data/sig/generated/prism/desugar_compiler.rbs +305 -0
- data/sig/generated/prism/dispatcher.rbs +1292 -0
- data/sig/generated/prism/dot_visitor.rbs +635 -0
- data/sig/generated/prism/dsl.rbs +928 -0
- data/sig/generated/prism/inspect_visitor.rbs +509 -0
- data/sig/generated/prism/lex_compat.rbs +166 -0
- data/sig/generated/prism/mutation_compiler.rbs +464 -0
- data/sig/generated/prism/node.rbs +20160 -0
- data/sig/generated/prism/node_ext.rbs +290 -0
- data/sig/generated/prism/node_find.rbs +90 -0
- data/sig/generated/prism/parse_result/errors.rbs +22 -0
- data/sig/generated/prism/parse_result/newlines.rbs +223 -0
- data/sig/generated/prism/parse_result.rbs +859 -0
- data/sig/generated/prism/pattern.rbs +156 -0
- data/sig/generated/prism/reflection.rbs +101 -0
- data/sig/generated/prism/relocation.rbs +428 -0
- data/sig/generated/prism/serialize.rbs +195 -0
- data/sig/generated/prism/string_query.rbs +36 -0
- data/sig/generated/prism/translation.rbs +8 -0
- data/sig/generated/prism/visitor.rbs +1111 -0
- data/sig/generated/prism.rbs +84 -0
- data/sig/manifest.yaml +2 -0
- data/src/arena.c +117 -0
- data/src/buffer.c +380 -0
- data/src/char.c +289 -0
- data/src/comments.c +454 -0
- data/src/constant_pool.c +406 -0
- data/src/diagnostic.c +886 -0
- data/src/encoding.c +5345 -0
- data/src/errors_format.c +519 -0
- data/src/integer.c +681 -0
- data/src/json.c +5733 -0
- data/src/line_offset_list.c +100 -0
- data/src/list.c +24 -0
- data/src/memchr.c +37 -0
- data/src/node.c +4515 -0
- data/src/options.c +451 -0
- data/src/parser.c +349 -0
- data/src/prettyprint.c +9024 -0
- data/src/prism.c +23739 -0
- data/src/regexp.c +1706 -0
- data/src/serialize.c +2309 -0
- data/src/source.c +518 -0
- data/src/static_literals.c +685 -0
- data/src/string_query.c +166 -0
- data/src/stringy.c +91 -0
- data/src/strncasecmp.c +37 -0
- data/src/strpbrk.c +447 -0
- data/src/tokens.c +724 -0
- metadata +259 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Generated from lib/prism/serialize.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Prism
|
|
4
|
+
# A module responsible for deserializing parse results.
|
|
5
|
+
module Serialize
|
|
6
|
+
# The major version of prism that we are expecting to find in the serialized
|
|
7
|
+
# strings.
|
|
8
|
+
MAJOR_VERSION: ::Integer
|
|
9
|
+
|
|
10
|
+
# The minor version of prism that we are expecting to find in the serialized
|
|
11
|
+
# strings.
|
|
12
|
+
MINOR_VERSION: ::Integer
|
|
13
|
+
|
|
14
|
+
# The patch version of prism that we are expecting to find in the serialized
|
|
15
|
+
# strings.
|
|
16
|
+
PATCH_VERSION: ::Integer
|
|
17
|
+
|
|
18
|
+
# Deserialize the dumped output from a request to parse or parse_file.
|
|
19
|
+
#
|
|
20
|
+
# The formatting of the source of this method is purposeful to illustrate
|
|
21
|
+
# the structure of the serialized data.
|
|
22
|
+
#
|
|
23
|
+
# : (String input, String serialized, bool freeze) -> ParseResult
|
|
24
|
+
def self.load_parse: (String input, String serialized, bool freeze) -> ParseResult
|
|
25
|
+
|
|
26
|
+
# Deserialize the dumped output from a request to lex or lex_file.
|
|
27
|
+
#
|
|
28
|
+
# The formatting of the source of this method is purposeful to illustrate
|
|
29
|
+
# the structure of the serialized data.
|
|
30
|
+
#
|
|
31
|
+
# : (String input, String serialized, bool freeze) -> LexResult
|
|
32
|
+
def self.load_lex: (String input, String serialized, bool freeze) -> LexResult
|
|
33
|
+
|
|
34
|
+
# Deserialize the dumped output from a request to parse_comments or
|
|
35
|
+
# parse_file_comments.
|
|
36
|
+
#
|
|
37
|
+
# The formatting of the source of this method is purposeful to illustrate
|
|
38
|
+
# the structure of the serialized data.
|
|
39
|
+
#
|
|
40
|
+
# : (String input, String serialized, bool freeze) -> Array[Comment]
|
|
41
|
+
def self.load_parse_comments: (String input, String serialized, bool freeze) -> Array[Comment]
|
|
42
|
+
|
|
43
|
+
# Deserialize the dumped output from a request to parse_lex or
|
|
44
|
+
# parse_lex_file.
|
|
45
|
+
#
|
|
46
|
+
# The formatting of the source of this method is purposeful to illustrate
|
|
47
|
+
# the structure of the serialized data.
|
|
48
|
+
#
|
|
49
|
+
# : (String input, String serialized, bool freeze) -> ParseLexResult
|
|
50
|
+
def self.load_parse_lex: (String input, String serialized, bool freeze) -> ParseLexResult
|
|
51
|
+
|
|
52
|
+
class ConstantPool
|
|
53
|
+
# :nodoc:
|
|
54
|
+
attr_reader size: Integer
|
|
55
|
+
|
|
56
|
+
@serialized: String
|
|
57
|
+
|
|
58
|
+
@base: Integer
|
|
59
|
+
|
|
60
|
+
@pool: Array[Symbol?]
|
|
61
|
+
|
|
62
|
+
# : (String serialized, Integer base, Integer size) -> void
|
|
63
|
+
def initialize: (String serialized, Integer base, Integer size) -> void
|
|
64
|
+
|
|
65
|
+
# : (Integer index, Encoding encoding) -> Symbol
|
|
66
|
+
def get: (Integer index, Encoding encoding) -> Symbol
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
FastStringIO: untyped
|
|
70
|
+
|
|
71
|
+
class Loader
|
|
72
|
+
# :nodoc:
|
|
73
|
+
attr_reader input: String
|
|
74
|
+
|
|
75
|
+
attr_reader io: StringIO
|
|
76
|
+
|
|
77
|
+
attr_reader source: Source
|
|
78
|
+
|
|
79
|
+
# : (Source source, String serialized) -> void
|
|
80
|
+
def initialize: (Source source, String serialized) -> void
|
|
81
|
+
|
|
82
|
+
# : () -> bool
|
|
83
|
+
def eof?: () -> bool
|
|
84
|
+
|
|
85
|
+
# : (ConstantPool constant_pool) -> void
|
|
86
|
+
def load_constant_pool: (ConstantPool constant_pool) -> void
|
|
87
|
+
|
|
88
|
+
# : () -> void
|
|
89
|
+
def load_header: () -> void
|
|
90
|
+
|
|
91
|
+
# : () -> Encoding
|
|
92
|
+
def load_encoding: () -> Encoding
|
|
93
|
+
|
|
94
|
+
# : (bool freeze) -> Array[Integer]
|
|
95
|
+
def load_line_offsets: (bool freeze) -> Array[Integer]
|
|
96
|
+
|
|
97
|
+
# Load the comments attached to each node into the comment attachments and
|
|
98
|
+
# comment ranges of the given source. For each node that owns comments, the
|
|
99
|
+
# index at which its comments begin is stored at its node id and the index
|
|
100
|
+
# at which they end at the following node id.
|
|
101
|
+
#
|
|
102
|
+
# : (Source source, bool freeze) -> void
|
|
103
|
+
def load_comment_attachments: (Source source, bool freeze) -> void
|
|
104
|
+
|
|
105
|
+
# Load the comments into the given list, which belongs to the source that
|
|
106
|
+
# the comments refer to.
|
|
107
|
+
#
|
|
108
|
+
# : (Array[Comment] comments, bool freeze) -> Array[Comment]
|
|
109
|
+
def load_comments: (Array[Comment] comments, bool freeze) -> Array[Comment]
|
|
110
|
+
|
|
111
|
+
# : (bool freeze) -> Array[MagicComment]
|
|
112
|
+
def load_magic_comments: (bool freeze) -> Array[MagicComment]
|
|
113
|
+
|
|
114
|
+
DIAGNOSTIC_TYPES: Array[Symbol]
|
|
115
|
+
|
|
116
|
+
# : () -> Symbol
|
|
117
|
+
def load_error_level: () -> Symbol
|
|
118
|
+
|
|
119
|
+
# : (Encoding encoding, bool freeze) -> Array[ParseError]
|
|
120
|
+
def load_errors: (Encoding encoding, bool freeze) -> Array[ParseError]
|
|
121
|
+
|
|
122
|
+
# : () -> Symbol
|
|
123
|
+
def load_warning_level: () -> Symbol
|
|
124
|
+
|
|
125
|
+
# : (Encoding encoding, bool freeze) -> Array[ParseWarning]
|
|
126
|
+
def load_warnings: (Encoding encoding, bool freeze) -> Array[ParseWarning]
|
|
127
|
+
|
|
128
|
+
# : () -> Array[Token]
|
|
129
|
+
def load_tokens: () -> Array[Token]
|
|
130
|
+
|
|
131
|
+
# variable-length integer using https://en.wikipedia.org/wiki/LEB128
|
|
132
|
+
# This is also what protobuf uses: https://protobuf.dev/programming-guides/encoding/#varints
|
|
133
|
+
#
|
|
134
|
+
# : () -> Integer
|
|
135
|
+
def load_varuint: () -> Integer
|
|
136
|
+
|
|
137
|
+
# : () -> Integer
|
|
138
|
+
def load_varsint: () -> Integer
|
|
139
|
+
|
|
140
|
+
# : () -> Integer
|
|
141
|
+
def load_integer: () -> Integer
|
|
142
|
+
|
|
143
|
+
# : () -> Float
|
|
144
|
+
def load_double: () -> Float
|
|
145
|
+
|
|
146
|
+
# : () -> bool
|
|
147
|
+
def load_bool: () -> bool
|
|
148
|
+
|
|
149
|
+
# : () -> Integer
|
|
150
|
+
def load_uint32: () -> Integer
|
|
151
|
+
|
|
152
|
+
# : (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node?
|
|
153
|
+
def load_optional_node: (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node?
|
|
154
|
+
|
|
155
|
+
# : (Encoding encoding) -> String
|
|
156
|
+
def load_string: (Encoding encoding) -> String
|
|
157
|
+
|
|
158
|
+
# : (bool freeze) -> Location
|
|
159
|
+
def load_location_object: (bool freeze) -> Location
|
|
160
|
+
|
|
161
|
+
# Load a location object from the serialized data. Note that we are lying
|
|
162
|
+
# about the signature a bit here, because we sometimes load it as a packed
|
|
163
|
+
# integer instead of an object.
|
|
164
|
+
#
|
|
165
|
+
# : (bool freeze) -> Location
|
|
166
|
+
def load_location: (bool freeze) -> Location
|
|
167
|
+
|
|
168
|
+
# Load an optional location object from the serialized data if it is
|
|
169
|
+
# present. Note that we are lying about the signature a bit here, because
|
|
170
|
+
# we sometimes load it as a packed integer instead of an object.
|
|
171
|
+
#
|
|
172
|
+
# : (bool freeze) -> Location?
|
|
173
|
+
def load_optional_location: (bool freeze) -> Location?
|
|
174
|
+
|
|
175
|
+
# : (bool freeze) -> Location?
|
|
176
|
+
def load_optional_location_object: (bool freeze) -> Location?
|
|
177
|
+
|
|
178
|
+
# : (ConstantPool constant_pool, Encoding encoding) -> Symbol
|
|
179
|
+
def load_constant: (ConstantPool constant_pool, Encoding encoding) -> Symbol
|
|
180
|
+
|
|
181
|
+
# : (ConstantPool constant_pool, Encoding encoding) -> Symbol?
|
|
182
|
+
def load_optional_constant: (ConstantPool constant_pool, Encoding encoding) -> Symbol?
|
|
183
|
+
|
|
184
|
+
# : (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node
|
|
185
|
+
def load_node: (ConstantPool constant_pool, Encoding encoding, bool freeze) -> node
|
|
186
|
+
|
|
187
|
+
@load_node_lambdas: Array[Proc]
|
|
188
|
+
|
|
189
|
+
def define_load_node_lambdas: () -> void
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# The token types that can be indexed by their enum values.
|
|
193
|
+
TOKEN_TYPES: Array[Symbol?]
|
|
194
|
+
end
|
|
195
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generated from lib/prism/string_query.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Prism
|
|
4
|
+
# Query methods that allow categorizing strings based on their context for
|
|
5
|
+
# where they could be valid in a Ruby syntax tree.
|
|
6
|
+
class StringQuery
|
|
7
|
+
def self.local?: (String string) -> bool
|
|
8
|
+
|
|
9
|
+
def self.constant?: (String string) -> bool
|
|
10
|
+
|
|
11
|
+
def self.method_name?: (String string) -> bool
|
|
12
|
+
|
|
13
|
+
# The string that this query is wrapping.
|
|
14
|
+
attr_reader string: String
|
|
15
|
+
|
|
16
|
+
# Initialize a new query with the given string.
|
|
17
|
+
#
|
|
18
|
+
# : (String string) -> void
|
|
19
|
+
def initialize: (String string) -> void
|
|
20
|
+
|
|
21
|
+
# Whether or not this string is a valid local variable name.
|
|
22
|
+
#
|
|
23
|
+
# : () -> bool
|
|
24
|
+
def local?: () -> bool
|
|
25
|
+
|
|
26
|
+
# Whether or not this string is a valid constant name.
|
|
27
|
+
#
|
|
28
|
+
# : () -> bool
|
|
29
|
+
def constant?: () -> bool
|
|
30
|
+
|
|
31
|
+
# Whether or not this string is a valid method name.
|
|
32
|
+
#
|
|
33
|
+
# : () -> bool
|
|
34
|
+
def method_name?: () -> bool
|
|
35
|
+
end
|
|
36
|
+
end
|