ed-precompiled_prism 1.5.2

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 (154) hide show
  1. checksums.yaml +7 -0
  2. data/BSDmakefile +58 -0
  3. data/CHANGELOG.md +723 -0
  4. data/CODE_OF_CONDUCT.md +76 -0
  5. data/CONTRIBUTING.md +58 -0
  6. data/LICENSE.md +7 -0
  7. data/Makefile +110 -0
  8. data/README.md +143 -0
  9. data/config.yml +4714 -0
  10. data/docs/build_system.md +119 -0
  11. data/docs/configuration.md +68 -0
  12. data/docs/cruby_compilation.md +27 -0
  13. data/docs/design.md +53 -0
  14. data/docs/encoding.md +121 -0
  15. data/docs/fuzzing.md +88 -0
  16. data/docs/heredocs.md +36 -0
  17. data/docs/javascript.md +118 -0
  18. data/docs/local_variable_depth.md +229 -0
  19. data/docs/mapping.md +117 -0
  20. data/docs/parser_translation.md +24 -0
  21. data/docs/parsing_rules.md +22 -0
  22. data/docs/releasing.md +98 -0
  23. data/docs/relocation.md +34 -0
  24. data/docs/ripper_translation.md +72 -0
  25. data/docs/ruby_api.md +44 -0
  26. data/docs/ruby_parser_translation.md +19 -0
  27. data/docs/serialization.md +233 -0
  28. data/docs/testing.md +55 -0
  29. data/ext/prism/api_node.c +6941 -0
  30. data/ext/prism/api_pack.c +276 -0
  31. data/ext/prism/extconf.rb +127 -0
  32. data/ext/prism/extension.c +1419 -0
  33. data/ext/prism/extension.h +19 -0
  34. data/include/prism/ast.h +8220 -0
  35. data/include/prism/defines.h +260 -0
  36. data/include/prism/diagnostic.h +456 -0
  37. data/include/prism/encoding.h +283 -0
  38. data/include/prism/node.h +129 -0
  39. data/include/prism/options.h +482 -0
  40. data/include/prism/pack.h +163 -0
  41. data/include/prism/parser.h +933 -0
  42. data/include/prism/prettyprint.h +34 -0
  43. data/include/prism/regexp.h +43 -0
  44. data/include/prism/static_literals.h +121 -0
  45. data/include/prism/util/pm_buffer.h +236 -0
  46. data/include/prism/util/pm_char.h +204 -0
  47. data/include/prism/util/pm_constant_pool.h +218 -0
  48. data/include/prism/util/pm_integer.h +130 -0
  49. data/include/prism/util/pm_list.h +103 -0
  50. data/include/prism/util/pm_memchr.h +29 -0
  51. data/include/prism/util/pm_newline_list.h +113 -0
  52. data/include/prism/util/pm_string.h +200 -0
  53. data/include/prism/util/pm_strncasecmp.h +32 -0
  54. data/include/prism/util/pm_strpbrk.h +46 -0
  55. data/include/prism/version.h +29 -0
  56. data/include/prism.h +408 -0
  57. data/lib/prism/compiler.rb +801 -0
  58. data/lib/prism/desugar_compiler.rb +392 -0
  59. data/lib/prism/dispatcher.rb +2210 -0
  60. data/lib/prism/dot_visitor.rb +4762 -0
  61. data/lib/prism/dsl.rb +1003 -0
  62. data/lib/prism/ffi.rb +570 -0
  63. data/lib/prism/inspect_visitor.rb +2392 -0
  64. data/lib/prism/lex_compat.rb +928 -0
  65. data/lib/prism/mutation_compiler.rb +772 -0
  66. data/lib/prism/node.rb +18816 -0
  67. data/lib/prism/node_ext.rb +511 -0
  68. data/lib/prism/pack.rb +230 -0
  69. data/lib/prism/parse_result/comments.rb +188 -0
  70. data/lib/prism/parse_result/errors.rb +66 -0
  71. data/lib/prism/parse_result/newlines.rb +155 -0
  72. data/lib/prism/parse_result.rb +911 -0
  73. data/lib/prism/pattern.rb +269 -0
  74. data/lib/prism/polyfill/append_as_bytes.rb +15 -0
  75. data/lib/prism/polyfill/byteindex.rb +13 -0
  76. data/lib/prism/polyfill/scan_byte.rb +14 -0
  77. data/lib/prism/polyfill/unpack1.rb +14 -0
  78. data/lib/prism/polyfill/warn.rb +36 -0
  79. data/lib/prism/reflection.rb +416 -0
  80. data/lib/prism/relocation.rb +505 -0
  81. data/lib/prism/serialize.rb +2398 -0
  82. data/lib/prism/string_query.rb +31 -0
  83. data/lib/prism/translation/parser/builder.rb +62 -0
  84. data/lib/prism/translation/parser/compiler.rb +2234 -0
  85. data/lib/prism/translation/parser/lexer.rb +820 -0
  86. data/lib/prism/translation/parser.rb +374 -0
  87. data/lib/prism/translation/parser33.rb +13 -0
  88. data/lib/prism/translation/parser34.rb +13 -0
  89. data/lib/prism/translation/parser35.rb +13 -0
  90. data/lib/prism/translation/parser_current.rb +24 -0
  91. data/lib/prism/translation/ripper/sexp.rb +126 -0
  92. data/lib/prism/translation/ripper/shim.rb +5 -0
  93. data/lib/prism/translation/ripper.rb +3474 -0
  94. data/lib/prism/translation/ruby_parser.rb +1929 -0
  95. data/lib/prism/translation.rb +16 -0
  96. data/lib/prism/visitor.rb +813 -0
  97. data/lib/prism.rb +97 -0
  98. data/prism.gemspec +174 -0
  99. data/rbi/prism/compiler.rbi +12 -0
  100. data/rbi/prism/dsl.rbi +524 -0
  101. data/rbi/prism/inspect_visitor.rbi +12 -0
  102. data/rbi/prism/node.rbi +8734 -0
  103. data/rbi/prism/node_ext.rbi +107 -0
  104. data/rbi/prism/parse_result.rbi +404 -0
  105. data/rbi/prism/reflection.rbi +58 -0
  106. data/rbi/prism/string_query.rbi +12 -0
  107. data/rbi/prism/translation/parser.rbi +11 -0
  108. data/rbi/prism/translation/parser33.rbi +6 -0
  109. data/rbi/prism/translation/parser34.rbi +6 -0
  110. data/rbi/prism/translation/parser35.rbi +6 -0
  111. data/rbi/prism/translation/ripper.rbi +15 -0
  112. data/rbi/prism/visitor.rbi +473 -0
  113. data/rbi/prism.rbi +66 -0
  114. data/sig/prism/compiler.rbs +9 -0
  115. data/sig/prism/dispatcher.rbs +19 -0
  116. data/sig/prism/dot_visitor.rbs +6 -0
  117. data/sig/prism/dsl.rbs +351 -0
  118. data/sig/prism/inspect_visitor.rbs +22 -0
  119. data/sig/prism/lex_compat.rbs +10 -0
  120. data/sig/prism/mutation_compiler.rbs +159 -0
  121. data/sig/prism/node.rbs +4028 -0
  122. data/sig/prism/node_ext.rbs +149 -0
  123. data/sig/prism/pack.rbs +43 -0
  124. data/sig/prism/parse_result/comments.rbs +38 -0
  125. data/sig/prism/parse_result.rbs +196 -0
  126. data/sig/prism/pattern.rbs +13 -0
  127. data/sig/prism/reflection.rbs +50 -0
  128. data/sig/prism/relocation.rbs +185 -0
  129. data/sig/prism/serialize.rbs +8 -0
  130. data/sig/prism/string_query.rbs +11 -0
  131. data/sig/prism/visitor.rbs +169 -0
  132. data/sig/prism.rbs +254 -0
  133. data/src/diagnostic.c +850 -0
  134. data/src/encoding.c +5235 -0
  135. data/src/node.c +8676 -0
  136. data/src/options.c +328 -0
  137. data/src/pack.c +509 -0
  138. data/src/prettyprint.c +8941 -0
  139. data/src/prism.c +23361 -0
  140. data/src/regexp.c +790 -0
  141. data/src/serialize.c +2268 -0
  142. data/src/static_literals.c +617 -0
  143. data/src/token_type.c +703 -0
  144. data/src/util/pm_buffer.c +357 -0
  145. data/src/util/pm_char.c +318 -0
  146. data/src/util/pm_constant_pool.c +342 -0
  147. data/src/util/pm_integer.c +670 -0
  148. data/src/util/pm_list.c +49 -0
  149. data/src/util/pm_memchr.c +35 -0
  150. data/src/util/pm_newline_list.c +125 -0
  151. data/src/util/pm_string.c +381 -0
  152. data/src/util/pm_strncasecmp.c +36 -0
  153. data/src/util/pm_strpbrk.c +206 -0
  154. metadata +195 -0
@@ -0,0 +1,149 @@
1
+ module Prism
2
+ class Node
3
+ def deprecated: (*String replacements) -> void
4
+ end
5
+
6
+ class InterpolatedMatchLastLineNode < Node
7
+ def options: () -> Integer
8
+ end
9
+
10
+ class InterpolatedRegularExpressionNode < Node
11
+ def options: () -> Integer
12
+ end
13
+
14
+ class MatchLastLineNode < Node
15
+ def options: () -> Integer
16
+ end
17
+
18
+ class RegularExpressionNode < Node
19
+ def options: () -> Integer
20
+ end
21
+
22
+ class InterpolatedStringNode < Node
23
+ def heredoc?: () -> bool
24
+ end
25
+
26
+ class InterpolatedXStringNode < Node
27
+ def heredoc?: () -> bool
28
+ end
29
+
30
+ class StringNode < Node
31
+ def heredoc?: () -> bool
32
+ def to_interpolated: () -> InterpolatedStringNode
33
+ end
34
+
35
+ class XStringNode < Node
36
+ def heredoc?: () -> bool
37
+ def to_interpolated: () -> InterpolatedXStringNode
38
+ end
39
+
40
+ class ImaginaryNode < Node
41
+ def value: () -> Complex
42
+ end
43
+
44
+ class RationalNode < Node
45
+ def value: () -> Rational
46
+ def numeric: () -> (IntegerNode | FloatNode)
47
+ end
48
+
49
+ class ConstantReadNode < Node
50
+ def full_name_parts: () -> Array[Symbol]
51
+ def full_name: () -> String
52
+ end
53
+
54
+ class ConstantWriteNode < Node
55
+ def full_name_parts: () -> Array[Symbol]
56
+ def full_name: () -> String
57
+ end
58
+
59
+ class ConstantPathNode < Node
60
+ class DynamicPartsInConstantPathError < StandardError
61
+ end
62
+
63
+ class MissingNodesInConstantPathError < StandardError
64
+ end
65
+
66
+ def full_name_parts: () -> Array[Symbol]
67
+ def full_name: () -> String
68
+ def child: () -> (ConstantReadNode | MissingNode)
69
+ end
70
+
71
+ class ConstantPathTargetNode < Node
72
+ def full_name_parts: () -> Array[Symbol]
73
+ def full_name: () -> String
74
+ def child: () -> (ConstantReadNode | MissingNode)
75
+ end
76
+
77
+ class ConstantTargetNode < Node
78
+ def full_name_parts: () -> Array[Symbol]
79
+ def full_name: () -> String
80
+ end
81
+
82
+ class ParametersNode < Node
83
+ def signature: () -> Array[[Symbol, Symbol] | [Symbol]]
84
+ end
85
+
86
+ class CallNode < Node
87
+ def full_message_loc: () -> Location?
88
+ end
89
+
90
+ class CallOperatorWriteNode < Node
91
+ def operator: () -> Symbol
92
+ def operator_loc: () -> Location
93
+ end
94
+
95
+ class ClassVariableOperatorWriteNode < Node
96
+ def operator: () -> Symbol
97
+ def operator_loc: () -> Location
98
+ end
99
+
100
+ class ConstantOperatorWriteNode < Node
101
+ def operator: () -> Symbol
102
+ def operator_loc: () -> Location
103
+ end
104
+
105
+ class ConstantPathOperatorWriteNode < Node
106
+ def operator: () -> Symbol
107
+ def operator_loc: () -> Location
108
+ end
109
+
110
+ class GlobalVariableOperatorWriteNode < Node
111
+ def operator: () -> Symbol
112
+ def operator_loc: () -> Location
113
+ end
114
+
115
+ class IndexOperatorWriteNode < Node
116
+ def operator: () -> Symbol
117
+ def operator_loc: () -> Location
118
+ end
119
+
120
+ class InstanceVariableOperatorWriteNode < Node
121
+ def operator: () -> Symbol
122
+ def operator_loc: () -> Location
123
+ end
124
+
125
+ class LocalVariableOperatorWriteNode < Node
126
+ def operator: () -> Symbol
127
+ def operator_loc: () -> Location
128
+ end
129
+
130
+ class CaseMatchNode < Node
131
+ def consequent: () -> ElseNode?
132
+ end
133
+
134
+ class CaseNode < Node
135
+ def consequent: () -> ElseNode?
136
+ end
137
+
138
+ class IfNode < Node
139
+ def consequent: () -> (ElseNode | IfNode | nil)
140
+ end
141
+
142
+ class RescueNode < Node
143
+ def consequent: () -> RescueNode?
144
+ end
145
+
146
+ class UnlessNode < Node
147
+ def consequent: () -> ElseNode?
148
+ end
149
+ end
@@ -0,0 +1,43 @@
1
+ module Prism
2
+ module Pack
3
+ type variant = :pack | :unpack
4
+
5
+ def self.parse: (Symbol version, variant variant, String source) -> Format
6
+
7
+ class Directive
8
+ type directive_type = :SPACE | :COMMENT | :INTEGER | :UTF8 | :BER | :FLOAT | :STRING_SPACE_PADDED |
9
+ :STRING_NULL_PADDED | :STRING_NULL_TERMINATED | :STRING_MSB | :STRING_LSB |
10
+ :STRING_HEX_HIGH | :STRING_HEX_LOW | :STRING_UU | :STRING_MIME | :STRING_BASE64 |
11
+ :STRING_FIXED | :STRING_POINTER | :MOVE | :BACK | :NULL
12
+
13
+ type signness = :UNSIGNED | :SIGNED | :SIGNED_NA
14
+
15
+ type endianness = :AGNOSTIC_ENDIAN | :LITTLE_ENDIAN | :BIG_ENDIAN | :NATIVE_ENDIAN | :ENDIAN_NA
16
+
17
+ type size = :SIZE_SHORT | :SIZE_INT | :SIZE_LONG | :SIZE_LONG_LONG | :SIZE_8 | :SIZE_16 | :SIZE_32 |
18
+ :SIZE_64 | :SIZE_P | :SIZE_NA
19
+
20
+ type length_type = :LENGTH_FIXED | :LENGTH_MAX | :LENGTH_RELATIVE | :LENGTH_NA
21
+
22
+
23
+ attr_reader version: Symbol
24
+ attr_reader variant: variant
25
+ attr_reader source: String
26
+ attr_reader type: directive_type
27
+ attr_reader signed: signness
28
+ attr_reader endian: endianness
29
+ attr_reader size: size
30
+ attr_reader length_type: length_type
31
+ attr_reader length: Integer
32
+
33
+ def describe: () -> String
34
+ end
35
+
36
+ class Format
37
+ attr_reader directives: Array[Directive]
38
+ attr_reader encoding: Encoding
39
+
40
+ def describe: () -> String
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,38 @@
1
+ module Prism
2
+ class ParseResult < Result
3
+ class Comments
4
+ interface _Target
5
+ def start_offset: () -> Integer
6
+ def end_offset: () -> Integer
7
+ def encloses?: (comment) -> bool
8
+ def leading_comment: (comment) -> void
9
+ def trailing_comment: (comment) -> void
10
+ end
11
+
12
+ class NodeTarget
13
+ include _Target
14
+
15
+ attr_reader node: node
16
+
17
+ def initialize: (node) -> void
18
+ end
19
+
20
+ class LocationTarget
21
+ include _Target
22
+
23
+ attr_reader location: Location
24
+
25
+ def initialize: (Location location) -> void
26
+ end
27
+
28
+ attr_reader parse_result: ParseResult
29
+
30
+ def initialize: (ParseResult parse_result) -> void
31
+ def attach!: () -> void
32
+
33
+ private
34
+
35
+ def nearest_targets: (node, comment) -> [_Target?, _Target, _Target?]
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,196 @@
1
+ module Prism
2
+ interface _CodeUnitsCache
3
+ def []: (Integer byte_offset) -> Integer
4
+ end
5
+
6
+ class Source
7
+ attr_reader source: String
8
+ attr_reader start_line: Integer
9
+ attr_reader offsets: Array[Integer]
10
+
11
+ def initialize: (String source, ?Integer start_line, ?Array[Integer] offsets) -> void
12
+ def replace_start_line: (Integer start_line) -> void
13
+ def replace_offsets: (Array[Integer] offsets) -> void
14
+ def encoding: () -> Encoding
15
+ def lines: () -> Array[String]
16
+ def slice: (Integer byte_offset, Integer length) -> String
17
+ def line: (Integer byte_offset) -> Integer
18
+ def line_start: (Integer byte_offset) -> Integer
19
+ def line_end: (Integer byte_offset) -> Integer
20
+ def line_offset: (Integer byte_offset) -> Integer
21
+ def column: (Integer byte_offset) -> Integer
22
+ def character_offset: (Integer byte_offset) -> Integer
23
+ def character_column: (Integer byte_offset) -> Integer
24
+ def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
25
+ def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
26
+ def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
27
+ def deep_freeze: () -> void
28
+
29
+ def self.for: (String source) -> Source
30
+ end
31
+
32
+ class CodeUnitsCache
33
+ def initialize: (String source, Encoding encoding) -> void
34
+ def []: (Integer byte_offset) -> Integer
35
+ end
36
+
37
+ class ASCIISource < Source
38
+ def character_offset: (Integer byte_offset) -> Integer
39
+ def character_column: (Integer byte_offset) -> Integer
40
+ def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
41
+ def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
42
+ def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
43
+ end
44
+
45
+ class Location
46
+ attr_reader source: Source
47
+ attr_reader start_offset: Integer
48
+ attr_reader length: Integer
49
+
50
+ def initialize: (Source source, Integer start_offset, Integer length) -> void
51
+ def leading_comments: () -> Array[comment]
52
+ def leading_comment: (comment) -> void
53
+ def trailing_comments: () -> Array[comment]
54
+ def trailing_comment: (comment) -> void
55
+ def comments: () -> Array[comment]
56
+ def copy: (?source: Source, ?start_offset: Integer, ?length: Integer) -> Location
57
+ def chop: () -> Location
58
+ def source_lines: () -> Array[String]
59
+ def slice: () -> String
60
+ def slice_lines: () -> String
61
+ def start_character_offset: () -> Integer
62
+ def start_code_units_offset: (Encoding encoding) -> Integer
63
+ def cached_start_code_units_offset: (_CodeUnitsCache cache) -> Integer
64
+ def end_offset: () -> Integer
65
+ def end_character_offset: () -> Integer
66
+ def end_code_units_offset: (Encoding encoding) -> Integer
67
+ def cached_end_code_units_offset: (_CodeUnitsCache cache) -> Integer
68
+ def start_line: () -> Integer
69
+ def start_line_slice: () -> String
70
+ def end_line: () -> Integer
71
+ def start_column: () -> Integer
72
+ def start_character_column: () -> Integer
73
+ def start_code_units_column: (Encoding encoding) -> Integer
74
+ def cached_start_code_units_column: (_CodeUnitsCache cache) -> Integer
75
+ def end_column: () -> Integer
76
+ def end_character_column: () -> Integer
77
+ def end_code_units_column: (Encoding encoding) -> Integer
78
+ def cached_end_code_units_column: (_CodeUnitsCache cache) -> Integer
79
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
80
+ def pretty_print: (untyped q) -> untyped
81
+ def join: (Location other) -> Location
82
+ def adjoin: (String string) -> Location
83
+ end
84
+
85
+ class Comment
86
+ attr_reader location: Location
87
+
88
+ def initialize: (Location location) -> void
89
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
90
+ def slice: () -> String
91
+ end
92
+
93
+ interface _Comment
94
+ def trailing?: () -> bool
95
+ end
96
+
97
+ type comment = Comment & _Comment
98
+
99
+ class InlineComment < Comment
100
+ include _Comment
101
+ end
102
+
103
+ class EmbDocComment < Comment
104
+ include _Comment
105
+ end
106
+
107
+ class MagicComment
108
+ attr_reader key_loc: Location
109
+ attr_reader value_loc: Location
110
+
111
+ def initialize: (Location key_loc, Location value_loc) -> void
112
+
113
+ def key: () -> String
114
+ def value: () -> String
115
+
116
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
117
+ end
118
+
119
+ class ParseError
120
+ attr_reader type: Symbol
121
+ attr_reader message: String
122
+ attr_reader location: Location
123
+ attr_reader level: Symbol
124
+
125
+ def initialize: (Symbol type, String message, Location location, Symbol level) -> void
126
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
127
+ end
128
+
129
+ class ParseWarning
130
+ attr_reader type: Symbol
131
+ attr_reader message: String
132
+ attr_reader location: Location
133
+ attr_reader level: Symbol
134
+
135
+ def initialize: (Symbol type, String message, Location location, Symbol level) -> void
136
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
137
+ end
138
+
139
+ class Result
140
+ attr_reader comments: Array[comment]
141
+ attr_reader magic_comments: Array[MagicComment]
142
+ attr_reader data_loc: Location?
143
+ attr_reader errors: Array[ParseError]
144
+ attr_reader warnings: Array[ParseWarning]
145
+ attr_reader source: Source
146
+
147
+ def initialize: (Array[comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
148
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
149
+ def encoding: () -> Encoding
150
+ def success?: () -> bool
151
+ def failure?: () -> bool
152
+ def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
153
+ end
154
+
155
+ class ParseResult < Result
156
+ attr_reader value: ProgramNode
157
+
158
+ def initialize: (ProgramNode value, Array[comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
159
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
160
+ def errors_format: () -> String
161
+ end
162
+
163
+ class LexResult < Result
164
+ attr_reader value: Array[[Token, Integer]]
165
+
166
+ def initialize: (Array[[Token, Integer]] value, Array[comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
167
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
168
+ end
169
+
170
+ class ParseLexResult < Result
171
+ attr_reader value: [ProgramNode, Array[[Token, Integer]]]
172
+
173
+ def initialize: ([ProgramNode, Array[[Token, Integer]]] value, Array[comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
174
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
175
+ end
176
+
177
+ class Token
178
+ attr_reader source: Source
179
+ attr_reader type: Symbol
180
+ attr_reader value: String
181
+ attr_reader location: Location
182
+
183
+ def initialize: (Source source, Symbol type, String value, Location location) -> void
184
+ def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
185
+ def pretty_print: (untyped q) -> untyped
186
+ def ==: (untyped other) -> bool
187
+ def deep_freeze: () -> void
188
+ end
189
+
190
+ class Scope
191
+ attr_reader locals: Array[Symbol]
192
+ attr_reader forwarding: Array[Symbol]
193
+
194
+ def initialize: (Array[Symbol] locals, Array[Symbol] forwarding) -> void
195
+ end
196
+ end
@@ -0,0 +1,13 @@
1
+ module Prism
2
+ class Pattern
3
+ class CompilationError < StandardError
4
+ end
5
+
6
+ attr_reader query: String
7
+
8
+ def initialize: (String query) -> void
9
+ def compile: () -> Proc
10
+ def scan: (Prism::node root) { (Prism::node) -> void } -> void
11
+ | (Prism::node root) -> ::Enumerator[Prism::node, void]
12
+ end
13
+ end
@@ -0,0 +1,50 @@
1
+ module Prism
2
+ module Reflection
3
+ class Field
4
+ attr_reader name: Symbol
5
+
6
+ def initialize: (Symbol name) -> void
7
+ end
8
+
9
+ class NodeField < Field
10
+ end
11
+
12
+ class OptionalNodeField < Field
13
+ end
14
+
15
+ class NodeListField < Field
16
+ end
17
+
18
+ class ConstantField < Field
19
+ end
20
+
21
+ class OptionalConstantField < Field
22
+ end
23
+
24
+ class ConstantListField < Field
25
+ end
26
+
27
+ class StringField < Field
28
+ end
29
+
30
+ class LocationField < Field
31
+ end
32
+
33
+ class OptionalLocationField < Field
34
+ end
35
+
36
+ class IntegerField < Field
37
+ end
38
+
39
+ class FloatField < Field
40
+ end
41
+
42
+ class FlagsField < Field
43
+ attr_reader flags: Array[Symbol]
44
+
45
+ def initialize: (Symbol name, Array[Symbol] flags) -> void
46
+ end
47
+
48
+ def self.fields_for: (singleton(Node) node) -> Array[Field]
49
+ end
50
+ end
@@ -0,0 +1,185 @@
1
+ module Prism
2
+ module Relocation
3
+ interface _Value
4
+ def start_line: () -> Integer
5
+ def end_line: () -> Integer
6
+ def start_offset: () -> Integer
7
+ def end_offset: () -> Integer
8
+ def start_character_offset: () -> Integer
9
+ def end_character_offset: () -> Integer
10
+ def cached_start_code_units_offset: (_CodeUnitsCache cache) -> Integer
11
+ def cached_end_code_units_offset: (_CodeUnitsCache cache) -> Integer
12
+ def start_column: () -> Integer
13
+ def end_column: () -> Integer
14
+ def start_character_column: () -> Integer
15
+ def end_character_column: () -> Integer
16
+ def cached_start_code_units_column: (_CodeUnitsCache cache) -> Integer
17
+ def cached_end_code_units_column: (_CodeUnitsCache cache) -> Integer
18
+ def leading_comments: () -> Array[Comment]
19
+ def trailing_comments: () -> Array[Comment]
20
+ end
21
+
22
+ interface _Field
23
+ def fields: (_Value value) -> entry_values
24
+ end
25
+
26
+ type entry_value = untyped
27
+ type entry_values = Hash[Symbol, entry_value]
28
+
29
+ class Entry
30
+ class MissingValueError < StandardError
31
+ end
32
+
33
+ def initialize: (Repository repository) -> void
34
+
35
+ def filepath: () -> String
36
+
37
+ def start_line: () -> Integer
38
+ def end_line: () -> Integer
39
+
40
+ def start_offset: () -> Integer
41
+ def end_offset: () -> Integer
42
+ def start_character_offset: () -> Integer
43
+ def end_character_offset: () -> Integer
44
+ def start_code_units_offset: () -> Integer
45
+ def end_code_units_offset: () -> Integer
46
+
47
+ def start_column: () -> Integer
48
+ def end_column: () -> Integer
49
+ def start_character_column: () -> Integer
50
+ def end_character_column: () -> Integer
51
+ def start_code_units_column: () -> Integer
52
+ def end_code_units_column: () -> Integer
53
+
54
+ def leading_comments: () -> Array[CommentsField::Comment]
55
+ def trailing_comments: () -> Array[CommentsField::Comment]
56
+ def comments: () -> Array[CommentsField::Comment]
57
+
58
+ private
59
+
60
+ def fetch_value: (Symbol name) -> entry_value
61
+ def values: () -> entry_values
62
+ end
63
+
64
+ class Source
65
+ attr_reader value: untyped
66
+
67
+ def initialize: (untyped value) -> void
68
+
69
+ def result: () -> ParseResult
70
+ def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
71
+ end
72
+
73
+ class SourceFilepath < Source
74
+ def result: () -> ParseResult
75
+ end
76
+
77
+ class SourceString < Source
78
+ def result: () -> ParseResult
79
+ end
80
+
81
+ class FilepathField
82
+ attr_reader value: String
83
+
84
+ def initialize: (String value) -> void
85
+
86
+ def fields: (_Value value) -> entry_values
87
+ end
88
+
89
+ class LinesField
90
+ def fields: (_Value value) -> entry_values
91
+ end
92
+
93
+ class OffsetsField
94
+ def fields: (_Value value) -> entry_values
95
+ end
96
+
97
+ class CharacterOffsetsField
98
+ def fields: (_Value value) -> entry_values
99
+ end
100
+
101
+ class CodeUnitOffsetsField
102
+ attr_reader repository: Repository
103
+ attr_reader encoding: Encoding
104
+
105
+ def initialize: (Repository repository, Encoding encoding) -> void
106
+ def fields: (_Value value) -> entry_values
107
+
108
+ private
109
+
110
+ def cache: () -> _CodeUnitsCache
111
+ end
112
+
113
+ class ColumnsField
114
+ def fields: (_Value value) -> entry_values
115
+ end
116
+
117
+ class CharacterColumnsField
118
+ def fields: (_Value value) -> entry_values
119
+ end
120
+
121
+ class CodeUnitColumnsField
122
+ attr_reader repository: Repository
123
+ attr_reader encoding: Encoding
124
+
125
+ def initialize: (Repository repository, Encoding encoding) -> void
126
+ def fields: (_Value value) -> entry_values
127
+
128
+ private
129
+
130
+ def cache: () -> _CodeUnitsCache
131
+ end
132
+
133
+ class CommentsField
134
+ class Comment
135
+ attr_reader slice: String
136
+
137
+ def initialize: (String slice) -> void
138
+ end
139
+
140
+ private
141
+
142
+ def comments: (entry_value value) -> Array[Comment]
143
+ end
144
+
145
+ class LeadingCommentsField < CommentsField
146
+ def fields: (_Value value) -> entry_values
147
+ end
148
+
149
+ class TrailingCommentsField < CommentsField
150
+ def fields: (_Value value) -> entry_values
151
+ end
152
+
153
+ class Repository
154
+ class ConfigurationError < StandardError
155
+ end
156
+
157
+ attr_reader source: Source
158
+ attr_reader fields: Hash[Symbol, _Field]
159
+ attr_reader entries: Hash[Integer, Hash[Symbol, Entry]]
160
+
161
+ def initialize: (Source source) -> void
162
+
163
+ def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
164
+
165
+ def filepath: () -> self
166
+ def lines: () -> self
167
+ def offsets: () -> self
168
+ def character_offsets: () -> self
169
+ def code_unit_offsets: (Encoding encoding) -> self
170
+ def columns: () -> self
171
+ def character_columns: () -> self
172
+ def code_unit_columns: (Encoding encoding) -> self
173
+ def leading_comments: () -> self
174
+ def trailing_comments: () -> self
175
+ def comments: () -> self
176
+
177
+ private
178
+
179
+ def field: (Symbol name, _Field) -> self
180
+ end
181
+
182
+ def self.filepath: (String value) -> Repository
183
+ def self.string: (String value) -> Repository
184
+ end
185
+ end
@@ -0,0 +1,8 @@
1
+ module Prism
2
+ module Serialize
3
+ def self.load_parse: (String, String, bool) -> ParseResult
4
+ def self.load_lex: (String, String, bool) -> LexResult
5
+ def self.load_parse_comments: (String, String, bool) -> Array[comment]
6
+ def self.load_parse_lex: (String, String, bool) -> ParseLexResult
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ module Prism
2
+ class StringQuery
3
+ attr_reader string: String
4
+
5
+ def initialize: (String string) -> void
6
+
7
+ def local?: () -> bool
8
+ def constant?: () -> bool
9
+ def method_name?: () -> bool
10
+ end
11
+ end