prism 1.9.0 → 2.0.0.rc2

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.
Files changed (244) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +88 -0
  3. data/CODE_OF_CONDUCT.md +1 -1
  4. data/LICENSE.md +1 -1
  5. data/Makefile +41 -12
  6. data/README.md +35 -97
  7. data/config.yml +174 -161
  8. data/docs/build_system.md +2 -2
  9. data/docs/configuration.md +5 -4
  10. data/docs/encoding.md +2 -2
  11. data/docs/fuzzing.md +4 -11
  12. data/docs/javascript.md +19 -4
  13. data/docs/mapping.md +1 -1
  14. data/docs/releasing.md +77 -5
  15. data/docs/relocation.md +2 -4
  16. data/docs/serialization.md +22 -24
  17. data/docs/testing.md +46 -29
  18. data/ext/prism/api_node.c +1461 -1401
  19. data/ext/prism/extconf.rb +3 -4
  20. data/ext/prism/extension.c +796 -422
  21. data/ext/prism/extension.h +3 -3
  22. data/include/prism/arena.h +37 -0
  23. data/include/prism/ast.h +2727 -610
  24. data/include/prism/buffer.h +52 -0
  25. data/include/prism/comments.h +55 -0
  26. data/include/prism/compiler/accel.h +26 -0
  27. data/include/prism/compiler/align.h +36 -0
  28. data/include/prism/compiler/assume.h +25 -0
  29. data/include/prism/compiler/bswap.h +46 -0
  30. data/include/prism/compiler/endianness.h +34 -0
  31. data/include/prism/compiler/exported.h +24 -0
  32. data/include/prism/compiler/fallthrough.h +22 -0
  33. data/include/prism/compiler/filesystem.h +32 -0
  34. data/include/prism/compiler/flex_array.h +19 -0
  35. data/include/prism/compiler/force_inline.h +21 -0
  36. data/include/prism/compiler/format.h +25 -0
  37. data/include/prism/compiler/inline.h +17 -0
  38. data/include/prism/compiler/nodiscard.h +22 -0
  39. data/include/prism/compiler/nonnull.h +18 -0
  40. data/include/prism/compiler/unused.h +18 -0
  41. data/include/prism/constant_pool.h +81 -0
  42. data/include/prism/diagnostic.h +38 -403
  43. data/include/prism/errors_format.h +53 -0
  44. data/include/prism/excludes.h +29 -0
  45. data/include/prism/integer.h +41 -0
  46. data/include/prism/internal/allocator.h +68 -0
  47. data/include/prism/internal/allocator_debug.h +88 -0
  48. data/include/prism/internal/arena.h +108 -0
  49. data/include/prism/internal/bit.h +42 -0
  50. data/include/prism/internal/buffer.h +94 -0
  51. data/include/prism/internal/char.h +145 -0
  52. data/include/prism/internal/comments.h +53 -0
  53. data/include/prism/internal/constant_pool.h +152 -0
  54. data/include/prism/internal/diagnostic.h +389 -0
  55. data/include/prism/{encoding.h → internal/encoding.h} +27 -68
  56. data/include/prism/internal/integer.h +68 -0
  57. data/include/prism/internal/isinf.h +16 -0
  58. data/include/prism/internal/line_offset_list.h +34 -0
  59. data/include/prism/{util/pm_list.h → internal/list.h} +11 -52
  60. data/include/prism/internal/magic_comments.h +23 -0
  61. data/include/prism/internal/memchr.h +15 -0
  62. data/include/prism/internal/node.h +38 -0
  63. data/include/prism/internal/options.h +232 -0
  64. data/include/prism/internal/parser.h +1004 -0
  65. data/include/prism/internal/regexp.h +26 -0
  66. data/include/prism/internal/serialize.h +39 -0
  67. data/include/prism/internal/source.h +72 -0
  68. data/include/prism/{static_literals.h → internal/static_literals.h} +26 -47
  69. data/include/prism/internal/stringy.h +35 -0
  70. data/include/prism/{util/pm_strncasecmp.h → internal/strncasecmp.h} +3 -17
  71. data/include/prism/{util/pm_strpbrk.h → internal/strpbrk.h} +7 -20
  72. data/include/prism/internal/tokens.h +11 -0
  73. data/include/prism/internal/xxh3.h +16 -0
  74. data/include/prism/json.h +32 -0
  75. data/include/prism/line_offset_list.h +61 -0
  76. data/include/prism/magic_comments.h +35 -0
  77. data/include/prism/node.h +18 -53
  78. data/include/prism/options.h +146 -280
  79. data/include/prism/parser.h +356 -867
  80. data/include/prism/prettyprint.h +6 -9
  81. data/include/prism/serialize.h +115 -0
  82. data/include/prism/source.h +155 -0
  83. data/include/prism/stream.h +28 -0
  84. data/include/prism/string_query.h +74 -0
  85. data/include/prism/stringy.h +72 -0
  86. data/include/prism/version.h +12 -3
  87. data/include/prism.h +43 -320
  88. data/lib/prism/compiler.rb +319 -305
  89. data/lib/prism/desugar_compiler.rb +105 -34
  90. data/lib/prism/dispatcher.rb +646 -473
  91. data/lib/prism/dot_visitor.rb +592 -511
  92. data/lib/prism/dsl.rb +391 -25
  93. data/lib/prism/ffi.rb +258 -90
  94. data/lib/prism/inspect_visitor.rb +357 -325
  95. data/lib/prism/lex_compat.rb +254 -212
  96. data/lib/prism/mutation_compiler.rb +313 -305
  97. data/lib/prism/node.rb +20966 -6992
  98. data/lib/prism/node_ext.rb +180 -187
  99. data/lib/prism/node_find.rb +215 -0
  100. data/lib/prism/parse_result/errors.rb +7 -1
  101. data/lib/prism/parse_result/newlines.rb +276 -8
  102. data/lib/prism/parse_result.rb +468 -139
  103. data/lib/prism/pattern.rb +65 -20
  104. data/lib/prism/reflection.rb +23 -12
  105. data/lib/prism/relocation.rb +149 -87
  106. data/lib/prism/serialize.rb +3460 -539
  107. data/lib/prism/string_query.rb +24 -1
  108. data/lib/prism/translation/parser/builder.rb +10 -2
  109. data/lib/prism/translation/parser/compiler.rb +44 -52
  110. data/lib/prism/translation/parser/lexer.rb +41 -92
  111. data/lib/prism/translation/parser.rb +1 -1
  112. data/lib/prism/translation/parser_current.rb +1 -1
  113. data/lib/prism/translation/ripper/lexer.rb +8 -10
  114. data/lib/prism/translation/ripper/sexp.rb +2 -10
  115. data/lib/prism/translation/ripper/shim.rb +2 -0
  116. data/lib/prism/translation/ripper.rb +967 -209
  117. data/lib/prism/translation/ruby_parser.rb +73 -316
  118. data/lib/prism/translation.rb +2 -0
  119. data/lib/prism/visitor.rb +632 -5
  120. data/lib/prism.rb +79 -9
  121. data/prism.gemspec +128 -62
  122. data/rbi/generated/prism/compiler.rbi +489 -0
  123. data/rbi/generated/prism/desugar_compiler.rbi +306 -0
  124. data/rbi/generated/prism/dispatcher.rbi +1138 -0
  125. data/rbi/generated/prism/dot_visitor.rbi +618 -0
  126. data/rbi/generated/prism/dsl.rbi +751 -0
  127. data/rbi/generated/prism/inspect_visitor.rbi +503 -0
  128. data/rbi/generated/prism/lex_compat.rbi +162 -0
  129. data/rbi/generated/prism/mutation_compiler.rbi +464 -0
  130. data/rbi/generated/prism/node.rbi +14407 -0
  131. data/rbi/generated/prism/node_ext.rbi +259 -0
  132. data/rbi/generated/prism/node_find.rbi +79 -0
  133. data/rbi/generated/prism/parse_result/errors.rbi +21 -0
  134. data/rbi/generated/prism/parse_result/newlines.rbi +208 -0
  135. data/rbi/generated/prism/parse_result.rbi +776 -0
  136. data/rbi/generated/prism/pattern.rbi +134 -0
  137. data/rbi/generated/prism/reflection.rbi +89 -0
  138. data/rbi/generated/prism/relocation.rbi +329 -0
  139. data/rbi/generated/prism/serialize.rbi +184 -0
  140. data/rbi/generated/prism/string_query.rbi +43 -0
  141. data/rbi/generated/prism/translation.rbi +7 -0
  142. data/rbi/generated/prism/visitor.rbi +650 -0
  143. data/rbi/generated/prism.rbi +86 -0
  144. data/rbi/prism/translation/parser_versions.rbi +5 -0
  145. data/rbi/rubyvm/node_find.rbi +14 -0
  146. data/sig/generated/prism/compiler.rbs +492 -0
  147. data/sig/generated/prism/desugar_compiler.rbs +305 -0
  148. data/sig/generated/prism/dispatcher.rbs +1292 -0
  149. data/sig/generated/prism/dot_visitor.rbs +635 -0
  150. data/sig/generated/prism/dsl.rbs +928 -0
  151. data/sig/generated/prism/inspect_visitor.rbs +509 -0
  152. data/sig/generated/prism/lex_compat.rbs +166 -0
  153. data/sig/{prism → generated/prism}/mutation_compiler.rbs +309 -4
  154. data/sig/generated/prism/node.rbs +20896 -0
  155. data/sig/generated/prism/node_ext.rbs +290 -0
  156. data/sig/generated/prism/node_find.rbs +90 -0
  157. data/sig/generated/prism/parse_result/errors.rbs +22 -0
  158. data/sig/generated/prism/parse_result/newlines.rbs +223 -0
  159. data/sig/generated/prism/parse_result.rbs +871 -0
  160. data/sig/generated/prism/pattern.rbs +156 -0
  161. data/sig/generated/prism/reflection.rbs +101 -0
  162. data/sig/generated/prism/relocation.rbs +428 -0
  163. data/sig/generated/prism/serialize.rbs +198 -0
  164. data/sig/generated/prism/string_query.rbs +43 -0
  165. data/sig/generated/prism/translation.rbs +8 -0
  166. data/sig/generated/prism/visitor.rbs +1111 -0
  167. data/sig/generated/prism.rbs +84 -0
  168. data/sig/manifest.yaml +2 -0
  169. data/src/arena.c +117 -0
  170. data/src/{util/pm_buffer.c → buffer.c} +53 -21
  171. data/src/{util/pm_char.c → char.c} +28 -57
  172. data/src/comments.c +454 -0
  173. data/src/constant_pool.c +406 -0
  174. data/src/diagnostic.c +97 -65
  175. data/src/encoding.c +8 -3
  176. data/src/errors_format.c +519 -0
  177. data/src/{util/pm_integer.c → integer.c} +33 -22
  178. data/src/json.c +5733 -0
  179. data/src/line_offset_list.c +100 -0
  180. data/src/list.c +24 -0
  181. data/src/{util/pm_memchr.c → memchr.c} +8 -6
  182. data/src/node.c +3504 -7674
  183. data/src/options.c +162 -49
  184. data/src/parser.c +367 -0
  185. data/src/prettyprint.c +421 -354
  186. data/src/prism.c +8402 -7161
  187. data/src/regexp.c +961 -45
  188. data/src/serialize.c +460 -424
  189. data/src/source.c +518 -0
  190. data/src/static_literals.c +111 -43
  191. data/src/string_query.c +180 -0
  192. data/src/stringy.c +91 -0
  193. data/src/{util/pm_strncasecmp.c → strncasecmp.c} +5 -4
  194. data/src/strpbrk.c +447 -0
  195. data/src/{token_type.c → tokens.c} +39 -18
  196. data/src/xxh3.c +292 -0
  197. metadata +128 -63
  198. data/ext/prism/api_pack.c +0 -276
  199. data/include/prism/defines.h +0 -260
  200. data/include/prism/pack.h +0 -163
  201. data/include/prism/regexp.h +0 -43
  202. data/include/prism/util/pm_buffer.h +0 -236
  203. data/include/prism/util/pm_char.h +0 -204
  204. data/include/prism/util/pm_constant_pool.h +0 -218
  205. data/include/prism/util/pm_integer.h +0 -130
  206. data/include/prism/util/pm_memchr.h +0 -29
  207. data/include/prism/util/pm_newline_list.h +0 -113
  208. data/include/prism/util/pm_string.h +0 -200
  209. data/lib/prism/pack.rb +0 -230
  210. data/lib/prism/parse_result/comments.rb +0 -188
  211. data/rbi/prism/compiler.rbi +0 -12
  212. data/rbi/prism/dsl.rbi +0 -524
  213. data/rbi/prism/inspect_visitor.rbi +0 -12
  214. data/rbi/prism/node.rbi +0 -8750
  215. data/rbi/prism/node_ext.rbi +0 -107
  216. data/rbi/prism/parse_result.rbi +0 -404
  217. data/rbi/prism/reflection.rbi +0 -58
  218. data/rbi/prism/string_query.rbi +0 -12
  219. data/rbi/prism/visitor.rbi +0 -473
  220. data/rbi/prism.rbi +0 -63
  221. data/sig/prism/compiler.rbs +0 -9
  222. data/sig/prism/dispatcher.rbs +0 -19
  223. data/sig/prism/dot_visitor.rbs +0 -6
  224. data/sig/prism/dsl.rbs +0 -351
  225. data/sig/prism/inspect_visitor.rbs +0 -22
  226. data/sig/prism/lex_compat.rbs +0 -10
  227. data/sig/prism/node.rbs +0 -4042
  228. data/sig/prism/node_ext.rbs +0 -149
  229. data/sig/prism/pack.rbs +0 -43
  230. data/sig/prism/parse_result/comments.rbs +0 -38
  231. data/sig/prism/parse_result.rbs +0 -197
  232. data/sig/prism/pattern.rbs +0 -13
  233. data/sig/prism/reflection.rbs +0 -50
  234. data/sig/prism/relocation.rbs +0 -185
  235. data/sig/prism/serialize.rbs +0 -8
  236. data/sig/prism/string_query.rbs +0 -11
  237. data/sig/prism/visitor.rbs +0 -169
  238. data/sig/prism.rbs +0 -272
  239. data/src/pack.c +0 -509
  240. data/src/util/pm_constant_pool.c +0 -342
  241. data/src/util/pm_list.c +0 -49
  242. data/src/util/pm_newline_list.c +0 -125
  243. data/src/util/pm_string.c +0 -381
  244. data/src/util/pm_strpbrk.c +0 -206
@@ -0,0 +1,871 @@
1
+ # Generated from lib/prism/parse_result.rb with RBS::Inline
2
+
3
+ module Prism
4
+ # An internal interface for a cache that can be used to compute code
5
+ # units from byte offsets.
6
+ interface _CodeUnitsCache
7
+ def []: (Integer byte_offset) -> Integer
8
+ end
9
+
10
+ # This represents a source of Ruby code that has been parsed. It is used in
11
+ # conjunction with locations to allow them to resolve line numbers and source
12
+ # ranges.
13
+ class Source
14
+ # Create a new source object with the given source code. This method should
15
+ # be used instead of `new` and it will return either a `Source` or a
16
+ # specialized and more performant `ASCIISource` if no multibyte characters
17
+ # are present in the source code.
18
+ #
19
+ # Note that if you are calling this method manually, you will need to supply
20
+ # the start_line and offsets parameters. start_line is the line number that
21
+ # the source starts on, which is typically 1 but can be different if this
22
+ # source is a subset of a larger source or if this is an eval. offsets is an
23
+ # array of byte offsets for the start of each line in the source code, which
24
+ # can be calculated by iterating through the source code and recording the
25
+ # byte offset whenever a newline character is encountered. The first
26
+ # element is always 0 to mark the first line.
27
+ #
28
+ # The comments, comment_attachments, and comment_ranges parameters are the
29
+ # lists described by the attributes of the same names. They are passed in
30
+ # empty when the source is created by the parser and filled in afterward,
31
+ # because the comments themselves refer to the source.
32
+ #
33
+ # The checksum parameter is the value described by the attribute of the same
34
+ # name. It is nil when the source is not created by the parser.
35
+ #
36
+ # : (String source, Integer start_line, Array[Integer] offsets, ?Array[Comment] comments, ?Array[Comment] comment_attachments, ?Array[Integer?] comment_ranges, ?Integer? checksum) -> Source
37
+ def self.for: (String source, Integer start_line, Array[Integer] offsets, ?Array[Comment] comments, ?Array[Comment] comment_attachments, ?Array[Integer?] comment_ranges, ?Integer? checksum) -> Source
38
+
39
+ # The source code that this source object represents.
40
+ attr_reader source: String
41
+
42
+ # The line number where this source starts.
43
+ attr_reader start_line: Integer
44
+
45
+ # The checksum of the source code which can be used to quickly determine if
46
+ # the source has changed.
47
+ attr_reader checksum: Integer?
48
+
49
+ # The list of comments that were encountered during parsing. When the source
50
+ # is parsed with the attach_comments option, these are sorted by start
51
+ # offset.
52
+ attr_reader comments: Array[Comment]
53
+
54
+ # The comments attached to nodes, grouped by node in order of node id. This
55
+ # is empty unless the source was parsed with the attach_comments option.
56
+ attr_reader comment_attachments: Array[Comment]
57
+
58
+ # Indices into comment_attachments, indexed by node id. For each node that
59
+ # owns comments, the index at which its comments begin is stored at its node
60
+ # id and the index at which they end is stored at the following node id. The
61
+ # other entries are nil. This is empty unless the source was parsed with the
62
+ # attach_comments option.
63
+ attr_reader comment_ranges: Array[Integer?]
64
+
65
+ # The list of newline byte offsets in the source code. When initialized from
66
+ # the C extension, this may be a packed binary string of uint32_t values
67
+ # that is lazily unpacked on first access.
68
+ #
69
+ # : () -> Array[Integer]
70
+ def offsets: () -> Array[Integer]
71
+
72
+ # Create a new source object with the given source code. The offsets
73
+ # parameter can be either an Array of Integer byte offsets or a packed
74
+ # binary string of uint32_t values (from the C extension).
75
+ #
76
+ # : (String source, Integer start_line, Array[Integer] | String offsets, ?Array[Comment] comments, ?Array[Comment] comment_attachments, ?Array[Integer?] comment_ranges, ?Integer? checksum) -> void
77
+ def initialize: (String source, Integer start_line, Array[Integer] | String offsets, ?Array[Comment] comments, ?Array[Comment] comment_attachments, ?Array[Integer?] comment_ranges, ?Integer? checksum) -> void
78
+
79
+ # Replace the value of start_line with the given value.
80
+ #
81
+ # : (Integer start_line) -> void
82
+ def replace_start_line: (Integer start_line) -> void
83
+
84
+ # Replace the value of checksum with the given value.
85
+ #
86
+ # : (Integer checksum) -> void
87
+ def replace_checksum: (Integer checksum) -> void
88
+
89
+ # Replace the value of offsets with the given value.
90
+ #
91
+ # : (Array[Integer] offsets) -> void
92
+ def replace_offsets: (Array[Integer] offsets) -> void
93
+
94
+ # The comments attached to the node with the given id, ordered by start
95
+ # offset. Comments are only attached when the source is parsed with the
96
+ # attach_comments option.
97
+ #
98
+ # : (Integer node_id) -> Array[Comment]
99
+ def comments_for: (Integer node_id) -> Array[Comment]
100
+
101
+ # Returns the encoding of the source code, which is set by parameters to the
102
+ # parser or by the encoding magic comment.
103
+ #
104
+ # : () -> Encoding
105
+ def encoding: () -> Encoding
106
+
107
+ # Returns the lines of the source code as an array of strings.
108
+ #
109
+ # : () -> Array[String]
110
+ def lines: () -> Array[String]
111
+
112
+ # Perform a byteslice on the source code using the given byte offset and
113
+ # byte length.
114
+ #
115
+ # : (Integer byte_offset, Integer length) -> String
116
+ def slice: (Integer byte_offset, Integer length) -> String
117
+
118
+ # Converts the line number and column in bytes to a byte offset.
119
+ #
120
+ # : (Integer line, Integer column) -> Integer
121
+ def byte_offset: (Integer line, Integer column) -> Integer
122
+
123
+ # Binary search through the offsets to find the line number for the given
124
+ # byte offset.
125
+ #
126
+ # : (Integer byte_offset) -> Integer
127
+ def line: (Integer byte_offset) -> Integer
128
+
129
+ # Return the byte offset of the start of the line corresponding to the given
130
+ # byte offset.
131
+ #
132
+ # : (Integer byte_offset) -> Integer
133
+ def line_start: (Integer byte_offset) -> Integer
134
+
135
+ # Returns the byte offset of the end of the line corresponding to the given
136
+ # byte offset.
137
+ #
138
+ # : (Integer byte_offset) -> Integer
139
+ def line_end: (Integer byte_offset) -> Integer
140
+
141
+ # Return the column in bytes for the given byte offset.
142
+ #
143
+ # : (Integer byte_offset) -> Integer
144
+ def column: (Integer byte_offset) -> Integer
145
+
146
+ # Return the character offset for the given byte offset.
147
+ #
148
+ # : (Integer byte_offset) -> Integer
149
+ def character_offset: (Integer byte_offset) -> Integer
150
+
151
+ # Return the column in characters for the given byte offset.
152
+ #
153
+ # : (Integer byte_offset) -> Integer
154
+ def character_column: (Integer byte_offset) -> Integer
155
+
156
+ # Returns the offset from the start of the file for the given byte offset
157
+ # counting in code units for the given encoding.
158
+ #
159
+ # This method is tested with UTF-8, UTF-16, and UTF-32. If there is the
160
+ # concept of code units that differs from the number of characters in other
161
+ # encodings, it is not captured here.
162
+ #
163
+ # We purposefully replace invalid and undefined characters with replacement
164
+ # characters in this conversion. This happens for two reasons. First, it's
165
+ # possible that the given byte offset will not occur on a character
166
+ # boundary. Second, it's possible that the source code will contain a
167
+ # character that has no equivalent in the given encoding.
168
+ #
169
+ # : (Integer byte_offset, Encoding encoding) -> Integer
170
+ def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
171
+
172
+ # Generate a cache that targets a specific encoding for calculating code
173
+ # unit offsets.
174
+ #
175
+ # : (Encoding encoding) -> CodeUnitsCache
176
+ def code_units_cache: (Encoding encoding) -> CodeUnitsCache
177
+
178
+ # Returns the column in code units for the given encoding for the
179
+ # given byte offset.
180
+ #
181
+ # : (Integer byte_offset, Encoding encoding) -> Integer
182
+ def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
183
+
184
+ # Freeze this object and the objects it contains.
185
+ #
186
+ # : () -> void
187
+ def deep_freeze: () -> void
188
+
189
+ # Binary search through the offsets to find the index for the given
190
+ # byte offset.
191
+ #
192
+ # : (Integer byte_offset) -> Integer
193
+ def find_line: (Integer byte_offset) -> Integer
194
+ end
195
+
196
+ # A cache that can be used to quickly compute code unit offsets from byte
197
+ # offsets. It purposefully provides only a single #[] method to access the
198
+ # cache in order to minimize surface area.
199
+ #
200
+ # Note that there are some known issues here that may or may not be addressed
201
+ # in the future:
202
+ #
203
+ # * The first is that there are issues when the cache computes values that are
204
+ # not on character boundaries. This can result in subsequent computations
205
+ # being off by one or more code units.
206
+ # * The second is that this cache is currently unbounded. In theory we could
207
+ # introduce some kind of LRU cache to limit the number of entries, but this
208
+ # has not yet been implemented.
209
+ class CodeUnitsCache
210
+ # Counter used for UTF-8, where one code unit equals one byte.
211
+ class UTF8Counter
212
+ # : (Integer byte_offset, Integer byte_length) -> Integer
213
+ def count: (Integer byte_offset, Integer byte_length) -> Integer
214
+ end
215
+
216
+ class UTF16Counter
217
+ @source: String
218
+
219
+ @encoding: Encoding
220
+
221
+ # : (String source, Encoding encoding) -> void
222
+ def initialize: (String source, Encoding encoding) -> void
223
+
224
+ # : (Integer byte_offset, Integer byte_length) -> Integer
225
+ def count: (Integer byte_offset, Integer byte_length) -> Integer
226
+ end
227
+
228
+ # Counter used for UTF-32, where one code unit equals one code point and
229
+ # matches String#length. Also used as a best-effort fallback for any other
230
+ # encoding that does not have a dedicated counter.
231
+ class UTF32Counter
232
+ @source: String
233
+
234
+ @encoding: Encoding
235
+
236
+ # : (String source, Encoding encoding) -> void
237
+ def initialize: (String source, Encoding encoding) -> void
238
+
239
+ # : (Integer byte_offset, Integer byte_length) -> Integer
240
+ def count: (Integer byte_offset, Integer byte_length) -> Integer
241
+ end
242
+
243
+ @source: String
244
+
245
+ @counter: UTF8Counter | UTF16Counter | UTF32Counter
246
+
247
+ @cache: Hash[Integer, Integer]
248
+
249
+ @offsets: Array[Integer]
250
+
251
+ # Initialize a new cache with the given source and encoding.
252
+ #
253
+ # : (String source, Encoding encoding) -> void
254
+ def initialize: (String source, Encoding encoding) -> void
255
+
256
+ # Retrieve the code units offset from the given byte offset.
257
+ #
258
+ # : (Integer byte_offset) -> Integer
259
+ def []: (Integer byte_offset) -> Integer
260
+ end
261
+
262
+ # Specialized version of Prism::Source for source code that includes ASCII
263
+ # characters only. This class is used to apply performance optimizations that
264
+ # cannot be applied to sources that include multibyte characters.
265
+ #
266
+ # In the extremely rare case that a source includes multi-byte characters but
267
+ # is marked as binary because of a magic encoding comment and it cannot be
268
+ # eagerly converted to UTF-8, this class will be used as well. This is because
269
+ # at that point we will treat everything as single-byte characters.
270
+ class ASCIISource < Source
271
+ # Return the character offset for the given byte offset.
272
+ #
273
+ # : (Integer byte_offset) -> Integer
274
+ def character_offset: (Integer byte_offset) -> Integer
275
+
276
+ # Return the column in characters for the given byte offset.
277
+ #
278
+ # : (Integer byte_offset) -> Integer
279
+ def character_column: (Integer byte_offset) -> Integer
280
+
281
+ # Returns the offset from the start of the file for the given byte offset
282
+ # counting in code units for the given encoding.
283
+ #
284
+ # This method is tested with UTF-8, UTF-16, and UTF-32. If there is the
285
+ # concept of code units that differs from the number of characters in other
286
+ # encodings, it is not captured here.
287
+ #
288
+ # : (Integer byte_offset, Encoding encoding) -> Integer
289
+ def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
290
+
291
+ # Returns a cache that is the identity function in order to maintain the
292
+ # same interface. We can do this because code units are always equivalent to
293
+ # byte offsets for ASCII-only sources.
294
+ #
295
+ # : (Encoding encoding) -> _CodeUnitsCache
296
+ def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
297
+
298
+ # Specialized version of `code_units_column` that does not depend on
299
+ # `code_units_offset`, which is a more expensive operation. This is
300
+ # essentially the same as `Prism::Source#column`.
301
+ #
302
+ # : (Integer byte_offset, Encoding encoding) -> Integer
303
+ def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
304
+ end
305
+
306
+ # This represents a location in the source.
307
+ class Location
308
+ # A Source object that is used to determine more information from the given
309
+ # offset and length.
310
+ attr_reader source: Source
311
+
312
+ # The byte offset from the beginning of the source where this location
313
+ # starts.
314
+ attr_reader start_offset: Integer
315
+
316
+ # The length of this location in bytes.
317
+ attr_reader length: Integer
318
+
319
+ # Create a new location object with the given source, start byte offset, and
320
+ # byte length.
321
+ #
322
+ # : (Source source, Integer start_offset, Integer length) -> void
323
+ def initialize: (Source source, Integer start_offset, Integer length) -> void
324
+
325
+ # Create a new location object with the given options.
326
+ #
327
+ # : (?source: Source, ?start_offset: Integer, ?length: Integer) -> Location
328
+ def copy: (?source: Source, ?start_offset: Integer, ?length: Integer) -> Location
329
+
330
+ # Returns a new location that is the result of chopping off the last byte.
331
+ #
332
+ # : () -> Location
333
+ def chop: () -> Location
334
+
335
+ # Returns a string representation of this location.
336
+ #
337
+ # : () -> String
338
+ def inspect: () -> String
339
+
340
+ # Returns all of the lines of the source code associated with this location.
341
+ #
342
+ # : () -> Array[String]
343
+ def source_lines: () -> Array[String]
344
+
345
+ # The source code that this location represents.
346
+ #
347
+ # : () -> String
348
+ def slice: () -> String
349
+
350
+ # The source code that this location represents starting from the beginning
351
+ # of the line that this location starts on to the end of the line that this
352
+ # location ends on.
353
+ #
354
+ # : () -> String
355
+ def slice_lines: () -> String
356
+
357
+ # The character offset from the beginning of the source where this location
358
+ # starts.
359
+ #
360
+ # : () -> Integer
361
+ def start_character_offset: () -> Integer
362
+
363
+ # The offset from the start of the file in code units of the given encoding.
364
+ #
365
+ # : (Encoding encoding) -> Integer
366
+ def start_code_units_offset: (Encoding encoding) -> Integer
367
+
368
+ # The start offset from the start of the file in code units using the given
369
+ # cache to fetch or calculate the value.
370
+ #
371
+ # : (_CodeUnitsCache cache) -> Integer
372
+ def cached_start_code_units_offset: (_CodeUnitsCache cache) -> Integer
373
+
374
+ # The byte offset from the beginning of the source where this location ends.
375
+ #
376
+ # : () -> Integer
377
+ def end_offset: () -> Integer
378
+
379
+ # The character offset from the beginning of the source where this location
380
+ # ends.
381
+ #
382
+ # : () -> Integer
383
+ def end_character_offset: () -> Integer
384
+
385
+ # The offset from the start of the file in code units of the given encoding.
386
+ #
387
+ # : (Encoding encoding) -> Integer
388
+ def end_code_units_offset: (Encoding encoding) -> Integer
389
+
390
+ # The end offset from the start of the file in code units using the given
391
+ # cache to fetch or calculate the value.
392
+ #
393
+ # : (_CodeUnitsCache cache) -> Integer
394
+ def cached_end_code_units_offset: (_CodeUnitsCache cache) -> Integer
395
+
396
+ # The line number where this location starts.
397
+ #
398
+ # : () -> Integer
399
+ def start_line: () -> Integer
400
+
401
+ # The content of the line where this location starts before this location.
402
+ #
403
+ # : () -> String
404
+ def start_line_slice: () -> String
405
+
406
+ # The line number where this location ends.
407
+ #
408
+ # : () -> Integer
409
+ def end_line: () -> Integer
410
+
411
+ # The column in bytes where this location starts from the start of
412
+ # the line.
413
+ #
414
+ # : () -> Integer
415
+ def start_column: () -> Integer
416
+
417
+ # The column in characters where this location ends from the start of
418
+ # the line.
419
+ #
420
+ # : () -> Integer
421
+ def start_character_column: () -> Integer
422
+
423
+ # The column in code units of the given encoding where this location
424
+ # starts from the start of the line.
425
+ #
426
+ # : (?Encoding encoding) -> Integer
427
+ def start_code_units_column: (?Encoding encoding) -> Integer
428
+
429
+ # The start column in code units using the given cache to fetch or calculate
430
+ # the value.
431
+ #
432
+ # : (_CodeUnitsCache cache) -> Integer
433
+ def cached_start_code_units_column: (_CodeUnitsCache cache) -> Integer
434
+
435
+ # The column in bytes where this location ends from the start of the
436
+ # line.
437
+ #
438
+ # : () -> Integer
439
+ def end_column: () -> Integer
440
+
441
+ # The column in characters where this location ends from the start of
442
+ # the line.
443
+ #
444
+ # : () -> Integer
445
+ def end_character_column: () -> Integer
446
+
447
+ # The column in code units of the given encoding where this location
448
+ # ends from the start of the line.
449
+ #
450
+ # : (?Encoding encoding) -> Integer
451
+ def end_code_units_column: (?Encoding encoding) -> Integer
452
+
453
+ # The end column in code units using the given cache to fetch or calculate
454
+ # the value.
455
+ #
456
+ # : (_CodeUnitsCache cache) -> Integer
457
+ def cached_end_code_units_column: (_CodeUnitsCache cache) -> Integer
458
+
459
+ # Implement the hash pattern matching interface for Location.
460
+ #
461
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
462
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
463
+
464
+ # Implement the pretty print interface for Location.
465
+ #
466
+ # : (PP q) -> void
467
+ def pretty_print: (PP q) -> void
468
+
469
+ # Returns true if the given other location is equal to this location.
470
+ #
471
+ # : (untyped other) -> bool
472
+ def ==: (untyped other) -> bool
473
+
474
+ # Returns a new location that stretches from this location to the given
475
+ # other location. Raises an error if this location is not before the other
476
+ # location or if they don't share the same source.
477
+ #
478
+ # : (Location other) -> Location
479
+ def join: (Location other) -> Location
480
+
481
+ # Join this location with the first occurrence of the string in the source
482
+ # that occurs after this location on the same line, and return the new
483
+ # location. This will raise an error if the string does not exist.
484
+ #
485
+ # : (String string) -> Location
486
+ def adjoin: (String string) -> Location
487
+ end
488
+
489
+ # This represents a comment that was encountered during parsing. It is the
490
+ # base class for all comment types.
491
+ class Comment
492
+ # The Location of this comment in the source.
493
+ attr_reader location: Location
494
+
495
+ # Create a new comment object with the given location.
496
+ #
497
+ # : (Location location) -> void
498
+ def initialize: (Location location) -> void
499
+
500
+ # Implement the hash pattern matching interface for Comment.
501
+ #
502
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
503
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
504
+
505
+ # Returns the content of the comment by slicing it from the source code.
506
+ #
507
+ # : () -> String
508
+ def slice: () -> String
509
+
510
+ # Returns true if this comment happens on the same line as other code and
511
+ # false if the comment is by itself. This can only be true for inline
512
+ # comments and should be false for block comments.
513
+ #
514
+ # : () -> bool
515
+ def trailing?: () -> bool
516
+ end
517
+
518
+ # InlineComment objects are the most common. They correspond to comments in
519
+ # the source file like this one that start with #.
520
+ class InlineComment < Comment
521
+ # Returns true if this comment happens on the same line as other code and
522
+ # false if the comment is by itself.
523
+ #
524
+ # : () -> bool
525
+ def trailing?: () -> bool
526
+
527
+ # Returns a string representation of this comment.
528
+ #
529
+ # : () -> String
530
+ def inspect: () -> String
531
+ end
532
+
533
+ # EmbDocComment objects correspond to comments that are surrounded by =begin
534
+ # and =end.
535
+ class EmbDocComment < Comment
536
+ # Returns false. This can only be true for inline comments.
537
+ #
538
+ # : () -> bool
539
+ def trailing?: () -> bool
540
+
541
+ # Returns a string representation of this comment.
542
+ #
543
+ # : () -> String
544
+ def inspect: () -> String
545
+ end
546
+
547
+ # This represents a magic comment that was encountered during parsing.
548
+ class MagicComment
549
+ # A Location object representing the location of the key in the source.
550
+ attr_reader key_loc: Location
551
+
552
+ # A Location object representing the location of the value in the source.
553
+ attr_reader value_loc: Location
554
+
555
+ # Create a new magic comment object with the given key and value locations.
556
+ #
557
+ # : (Location key_loc, Location value_loc) -> void
558
+ def initialize: (Location key_loc, Location value_loc) -> void
559
+
560
+ # Returns the key of the magic comment by slicing it from the source code.
561
+ #
562
+ # : () -> String
563
+ def key: () -> String
564
+
565
+ # Returns the value of the magic comment by slicing it from the source code.
566
+ #
567
+ # : () -> String
568
+ def value: () -> String
569
+
570
+ # Implement the hash pattern matching interface for MagicComment.
571
+ #
572
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
573
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
574
+
575
+ # Returns a string representation of this magic comment.
576
+ #
577
+ # : () -> String
578
+ def inspect: () -> String
579
+ end
580
+
581
+ # This represents an error that was encountered during parsing.
582
+ class ParseError
583
+ # The type of error. This is an _internal_ symbol that is used for
584
+ # communicating with translation layers. It is not meant to be public API.
585
+ attr_reader type: Symbol
586
+
587
+ # The message associated with this error.
588
+ attr_reader message: String
589
+
590
+ # A Location object representing the location of this error in the source.
591
+ attr_reader location: Location
592
+
593
+ # The level of this error.
594
+ attr_reader level: Symbol
595
+
596
+ # Create a new error object with the given message and location.
597
+ #
598
+ # : (Symbol type, String message, Location location, Symbol level) -> void
599
+ def initialize: (Symbol type, String message, Location location, Symbol level) -> void
600
+
601
+ # Implement the hash pattern matching interface for ParseError.
602
+ #
603
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
604
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
605
+
606
+ # Returns a string representation of this error.
607
+ #
608
+ # : () -> String
609
+ def inspect: () -> String
610
+ end
611
+
612
+ # This represents a warning that was encountered during parsing.
613
+ class ParseWarning
614
+ # The type of warning. This is an _internal_ symbol that is used for
615
+ # communicating with translation layers. It is not meant to be public API.
616
+ attr_reader type: Symbol
617
+
618
+ # The message associated with this warning.
619
+ attr_reader message: String
620
+
621
+ # A Location object representing the location of this warning in the source.
622
+ attr_reader location: Location
623
+
624
+ # The level of this warning.
625
+ attr_reader level: Symbol
626
+
627
+ # Create a new warning object with the given message and location.
628
+ #
629
+ # : (Symbol type, String message, Location location, Symbol level) -> void
630
+ def initialize: (Symbol type, String message, Location location, Symbol level) -> void
631
+
632
+ # Implement the hash pattern matching interface for ParseWarning.
633
+ #
634
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
635
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
636
+
637
+ # Returns a string representation of this warning.
638
+ #
639
+ # : () -> String
640
+ def inspect: () -> String
641
+ end
642
+
643
+ # This represents the result of a call to Prism.parse or Prism.parse_file.
644
+ # It contains the requested structure, any comments that were encounters,
645
+ # and any errors that were encountered.
646
+ class Result
647
+ # The list of magic comments that were encountered during parsing.
648
+ attr_reader magic_comments: Array[MagicComment]
649
+
650
+ # An optional location that represents the location of the __END__ marker
651
+ # and the rest of the content of the file. This content is loaded into the
652
+ # DATA constant when the file being parsed is the main file being executed.
653
+ attr_reader data_loc: Location?
654
+
655
+ # The list of errors that were generated during parsing.
656
+ attr_reader errors: Array[ParseError]
657
+
658
+ # The list of warnings that were generated during parsing.
659
+ attr_reader warnings: Array[ParseWarning]
660
+
661
+ # A Source instance that represents the source code that was parsed.
662
+ attr_reader source: Source
663
+
664
+ # Create a new result object with the given values.
665
+ #
666
+ # : (Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
667
+ def initialize: (Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
668
+
669
+ # The list of comments that were encountered during parsing.
670
+ #
671
+ # : () -> Array[Comment]
672
+ def comments: () -> Array[Comment]
673
+
674
+ # Implement the hash pattern matching interface for Result.
675
+ #
676
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
677
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
678
+
679
+ # Returns the encoding of the source code that was parsed.
680
+ #
681
+ # : () -> Encoding
682
+ def encoding: () -> Encoding
683
+
684
+ # Returns true if there were no errors during parsing and false if there
685
+ # were.
686
+ #
687
+ # : () -> bool
688
+ def success?: () -> bool
689
+
690
+ # Returns true if there were errors during parsing and false if there were
691
+ # not.
692
+ #
693
+ # : () -> bool
694
+ def failure?: () -> bool
695
+
696
+ # Returns true if the parsed source is an incomplete expression that could
697
+ # become valid with additional input. This is useful for REPL contexts (such
698
+ # as IRB) where the user may be entering a multi-line expression one line at
699
+ # a time and the implementation needs to determine whether to wait for more
700
+ # input or to evaluate what has been entered so far.
701
+ #
702
+ # Concretely, this returns true when every error present is caused by the
703
+ # parser reaching the end of the input before a construct was closed (e.g.
704
+ # an unclosed string, array, block, or keyword), and returns false when any
705
+ # error is caused by a token that makes the input structurally invalid
706
+ # regardless of what might follow (e.g. a stray `end`, `]`, or `)` with no
707
+ # matching opener).
708
+ #
709
+ # Examples:
710
+ #
711
+ # Prism.parse("1 + [").continuable? #=> true (unclosed array)
712
+ # Prism.parse("1 + ]").continuable? #=> false (stray ])
713
+ # Prism.parse("tap do").continuable? #=> true (unclosed block)
714
+ # Prism.parse("end.tap do").continuable? #=> false (stray end)
715
+ #
716
+ # : () -> bool
717
+ def continuable?: () -> bool
718
+
719
+ # Create a code units cache for the given encoding.
720
+ #
721
+ # : (Encoding encoding) -> _CodeUnitsCache
722
+ def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
723
+ end
724
+
725
+ # This is a result specific to the `parse` and `parse_file` methods.
726
+ class ParseResult < Result
727
+ # The syntax tree that was parsed from the source code.
728
+ attr_reader value: ProgramNode
729
+
730
+ # Create a new parse result object with the given values.
731
+ #
732
+ # : (ProgramNode value, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
733
+ def initialize: (ProgramNode value, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
734
+
735
+ # Implement the hash pattern matching interface for ParseResult.
736
+ #
737
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
738
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
739
+
740
+ # Walk the tree and mark nodes that are on a new line, loosely emulating
741
+ # the behavior of CRuby's `:line` tracepoint event.
742
+ #
743
+ # : () -> void
744
+ def mark_newlines!: () -> void
745
+
746
+ # Returns a string representation of the syntax tree with the errors
747
+ # displayed inline.
748
+ #
749
+ # : () -> String
750
+ def errors_format: () -> String
751
+ end
752
+
753
+ # This is a result specific to the `lex` and `lex_file` methods.
754
+ class LexResult < Result
755
+ # The list of tokens that were parsed from the source code.
756
+ attr_reader value: Array[Token]
757
+
758
+ # Create a new lex result object with the given values.
759
+ #
760
+ # : (Array[Token] value, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
761
+ def initialize: (Array[Token] value, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
762
+
763
+ # Implement the hash pattern matching interface for LexResult.
764
+ #
765
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
766
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
767
+ end
768
+
769
+ # This is a result specific to the `parse_lex` and `parse_lex_file` methods.
770
+ class ParseLexResult < Result
771
+ # A tuple of the syntax tree and the list of tokens that were parsed from
772
+ # the source code.
773
+ attr_reader value: [ ProgramNode, Array[Token] ]
774
+
775
+ # Create a new parse lex result object with the given values.
776
+ #
777
+ # : ([ProgramNode, Array[Token]] value, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
778
+ def initialize: ([ ProgramNode, Array[Token] ] value, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, bool continuable, Source source) -> void
779
+
780
+ # Implement the hash pattern matching interface for ParseLexResult.
781
+ #
782
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
783
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
784
+ end
785
+
786
+ # This represents a token from the Ruby source.
787
+ class Token
788
+ # The Source object that represents the source this token came from.
789
+ attr_reader source: Source
790
+
791
+ # The type of token that this token is.
792
+ attr_reader type: Symbol
793
+
794
+ # A byteslice of the source that this token represents.
795
+ attr_reader value: String
796
+
797
+ @location: Location | Integer
798
+
799
+ # Create a new token object with the given type, value, and location.
800
+ #
801
+ # : (Source source, Symbol type, String value, Location | Integer location, Integer state) -> void
802
+ def initialize: (Source source, Symbol type, String value, Location | Integer location, Integer state) -> void
803
+
804
+ # Implement the hash pattern matching interface for Token.
805
+ #
806
+ # : (Array[Symbol]? keys) -> Hash[Symbol, untyped]
807
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
808
+
809
+ # A Location object representing the location of this token in the source.
810
+ #
811
+ # : () -> Location
812
+ def location: () -> Location
813
+
814
+ # Implement the pretty print interface for Token.
815
+ #
816
+ # : (PP q) -> void
817
+ def pretty_print: (PP q) -> void
818
+
819
+ # Returns true if the given other token is equal to this token.
820
+ #
821
+ # : (untyped other) -> bool
822
+ def ==: (untyped other) -> bool
823
+
824
+ # Returns a string representation of this token.
825
+ #
826
+ # : () -> String
827
+ def inspect: () -> String
828
+
829
+ # Freeze this object and the objects it contains.
830
+ #
831
+ # : () -> void
832
+ def deep_freeze: () -> void
833
+
834
+ # For internal use only.
835
+ # : () -> Integer
836
+ def _ripper_state: () -> Integer
837
+
838
+ # : (Integer index) -> Token | Integer
839
+ def []: (Integer index) -> Token
840
+
841
+ # : () -> Token
842
+ def first: () -> Token
843
+ end
844
+
845
+ # This object is passed to the various Prism.* methods that accept the
846
+ # `scopes` option as an element of the list. It defines both the local
847
+ # variables visible at that scope as well as the forwarding parameters
848
+ # available at that scope.
849
+ class Scope
850
+ # The list of local variables that are defined in this scope. This should be
851
+ # defined as an array of symbols.
852
+ attr_reader locals: Array[Symbol]
853
+
854
+ # The list of local variables that are forwarded to the next scope. This
855
+ # should by defined as an array of symbols containing the specific values of
856
+ # :*, :**, :&, or :"...".
857
+ attr_reader forwarding: Array[Symbol]
858
+
859
+ # Create a new scope object with the given locals and forwarding.
860
+ #
861
+ # : (Array[Symbol] locals, Array[Symbol] forwarding) -> void
862
+ def initialize: (Array[Symbol] locals, Array[Symbol] forwarding) -> void
863
+ end
864
+
865
+ # Create a new scope with the given locals and forwarding options that is
866
+ # suitable for passing into one of the Prism.* methods that accepts the
867
+ # `scopes` option.
868
+ #
869
+ # : (?locals: Array[Symbol], ?forwarding: Array[Symbol]) -> Scope
870
+ def self.scope: (?locals: Array[Symbol], ?forwarding: Array[Symbol]) -> Scope
871
+ end