jruby-prism-parser 0.24.0-java → 1.4.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/BSDmakefile +58 -0
- data/CHANGELOG.md +269 -1
- data/CONTRIBUTING.md +0 -4
- data/Makefile +25 -18
- data/README.md +57 -6
- data/config.yml +1724 -140
- data/docs/build_system.md +39 -11
- data/docs/configuration.md +4 -0
- data/docs/cruby_compilation.md +1 -1
- data/docs/fuzzing.md +1 -1
- data/docs/parser_translation.md +14 -9
- data/docs/parsing_rules.md +4 -1
- data/docs/releasing.md +8 -10
- data/docs/relocation.md +34 -0
- data/docs/ripper_translation.md +72 -0
- data/docs/ruby_api.md +2 -1
- data/docs/serialization.md +29 -5
- data/ext/prism/api_node.c +3395 -1999
- data/ext/prism/api_pack.c +9 -0
- data/ext/prism/extconf.rb +55 -34
- data/ext/prism/extension.c +597 -346
- data/ext/prism/extension.h +6 -5
- data/include/prism/ast.h +2612 -455
- data/include/prism/defines.h +160 -2
- data/include/prism/diagnostic.h +188 -76
- data/include/prism/encoding.h +22 -4
- data/include/prism/node.h +89 -17
- data/include/prism/options.h +224 -12
- data/include/prism/pack.h +11 -0
- data/include/prism/parser.h +267 -66
- data/include/prism/prettyprint.h +8 -0
- data/include/prism/regexp.h +18 -8
- data/include/prism/static_literals.h +121 -0
- data/include/prism/util/pm_buffer.h +75 -2
- data/include/prism/util/pm_char.h +1 -2
- data/include/prism/util/pm_constant_pool.h +18 -9
- data/include/prism/util/pm_integer.h +126 -0
- data/include/prism/util/pm_list.h +1 -1
- data/include/prism/util/pm_newline_list.h +19 -0
- data/include/prism/util/pm_string.h +48 -8
- data/include/prism/version.h +3 -3
- data/include/prism.h +99 -5
- data/jruby-prism.jar +0 -0
- data/lib/prism/compiler.rb +11 -1
- data/lib/prism/desugar_compiler.rb +113 -74
- data/lib/prism/dispatcher.rb +45 -1
- data/lib/prism/dot_visitor.rb +201 -77
- data/lib/prism/dsl.rb +673 -461
- data/lib/prism/ffi.rb +233 -45
- data/lib/prism/inspect_visitor.rb +2389 -0
- data/lib/prism/lex_compat.rb +35 -16
- data/lib/prism/mutation_compiler.rb +24 -8
- data/lib/prism/node.rb +7731 -8460
- data/lib/prism/node_ext.rb +328 -32
- data/lib/prism/pack.rb +4 -0
- data/lib/prism/parse_result/comments.rb +34 -24
- data/lib/prism/parse_result/errors.rb +65 -0
- data/lib/prism/parse_result/newlines.rb +102 -12
- data/lib/prism/parse_result.rb +448 -44
- data/lib/prism/pattern.rb +28 -10
- data/lib/prism/polyfill/append_as_bytes.rb +15 -0
- data/lib/prism/polyfill/byteindex.rb +13 -0
- data/lib/prism/polyfill/unpack1.rb +14 -0
- data/lib/prism/reflection.rb +413 -0
- data/lib/prism/relocation.rb +504 -0
- data/lib/prism/serialize.rb +1940 -1198
- data/lib/prism/string_query.rb +30 -0
- data/lib/prism/translation/parser/builder.rb +61 -0
- data/lib/prism/translation/parser/compiler.rb +569 -195
- data/lib/prism/translation/parser/lexer.rb +516 -39
- data/lib/prism/translation/parser.rb +177 -12
- data/lib/prism/translation/parser33.rb +1 -1
- data/lib/prism/translation/parser34.rb +1 -1
- data/lib/prism/translation/parser35.rb +12 -0
- data/lib/prism/translation/ripper/sexp.rb +125 -0
- data/lib/prism/translation/ripper/shim.rb +5 -0
- data/lib/prism/translation/ripper.rb +3224 -462
- data/lib/prism/translation/ruby_parser.rb +194 -69
- data/lib/prism/translation.rb +4 -1
- data/lib/prism/version.rb +1 -1
- data/lib/prism/visitor.rb +13 -0
- data/lib/prism.rb +17 -27
- data/prism.gemspec +57 -17
- data/rbi/prism/compiler.rbi +12 -0
- data/rbi/prism/dsl.rbi +524 -0
- data/rbi/prism/inspect_visitor.rbi +12 -0
- data/rbi/prism/node.rbi +8722 -0
- data/rbi/prism/node_ext.rbi +107 -0
- data/rbi/prism/parse_result.rbi +404 -0
- data/rbi/prism/reflection.rbi +58 -0
- data/rbi/prism/string_query.rbi +12 -0
- data/rbi/prism/translation/parser.rbi +11 -0
- data/rbi/prism/translation/parser33.rbi +6 -0
- data/rbi/prism/translation/parser34.rbi +6 -0
- data/rbi/prism/translation/parser35.rbi +6 -0
- data/rbi/prism/translation/ripper.rbi +15 -0
- data/rbi/prism/visitor.rbi +473 -0
- data/rbi/prism.rbi +44 -7745
- data/sig/prism/compiler.rbs +9 -0
- data/sig/prism/dispatcher.rbs +16 -0
- data/sig/prism/dot_visitor.rbs +6 -0
- data/sig/prism/dsl.rbs +351 -0
- data/sig/prism/inspect_visitor.rbs +22 -0
- data/sig/prism/lex_compat.rbs +10 -0
- data/sig/prism/mutation_compiler.rbs +159 -0
- data/sig/prism/node.rbs +3614 -0
- data/sig/prism/node_ext.rbs +82 -0
- data/sig/prism/pack.rbs +43 -0
- data/sig/prism/parse_result.rbs +192 -0
- data/sig/prism/pattern.rbs +13 -0
- data/sig/prism/reflection.rbs +50 -0
- data/sig/prism/relocation.rbs +185 -0
- data/sig/prism/serialize.rbs +8 -0
- data/sig/prism/string_query.rbs +11 -0
- data/sig/prism/visitor.rbs +169 -0
- data/sig/prism.rbs +248 -4767
- data/src/diagnostic.c +672 -230
- data/src/encoding.c +211 -108
- data/src/node.c +7541 -1653
- data/src/options.c +135 -20
- data/src/pack.c +33 -17
- data/src/prettyprint.c +1543 -1485
- data/src/prism.c +7813 -3050
- data/src/regexp.c +225 -73
- data/src/serialize.c +101 -77
- data/src/static_literals.c +617 -0
- data/src/token_type.c +14 -13
- data/src/util/pm_buffer.c +187 -20
- data/src/util/pm_char.c +5 -5
- data/src/util/pm_constant_pool.c +39 -19
- data/src/util/pm_integer.c +670 -0
- data/src/util/pm_list.c +1 -1
- data/src/util/pm_newline_list.c +43 -5
- data/src/util/pm_string.c +213 -33
- data/src/util/pm_strncasecmp.c +13 -1
- data/src/util/pm_strpbrk.c +32 -6
- metadata +55 -19
- data/docs/ripper.md +0 -36
- data/include/prism/util/pm_state_stack.h +0 -42
- data/include/prism/util/pm_string_list.h +0 -44
- data/lib/prism/debug.rb +0 -206
- data/lib/prism/node_inspector.rb +0 -68
- data/lib/prism/translation/parser/rubocop.rb +0 -45
- data/rbi/prism_static.rbi +0 -207
- data/sig/prism_static.rbs +0 -201
- data/src/util/pm_state_stack.c +0 -25
- data/src/util/pm_string_list.c +0 -28
@@ -0,0 +1,82 @@
|
|
1
|
+
module Prism
|
2
|
+
class InterpolatedMatchLastLineNode < Node
|
3
|
+
# Returns a numeric value that represents the flags that were used to create
|
4
|
+
# the regular expression.
|
5
|
+
def options: () -> Integer
|
6
|
+
end
|
7
|
+
|
8
|
+
class InterpolatedRegularExpressionNode < Node
|
9
|
+
# Returns a numeric value that represents the flags that were used to create
|
10
|
+
# the regular expression.
|
11
|
+
def options: () -> Integer
|
12
|
+
end
|
13
|
+
|
14
|
+
class MatchLastLineNode < Node
|
15
|
+
# Returns a numeric value that represents the flags that were used to create
|
16
|
+
# the regular expression.
|
17
|
+
def options: () -> Integer
|
18
|
+
end
|
19
|
+
|
20
|
+
class RegularExpressionNode < Node
|
21
|
+
# Returns a numeric value that represents the flags that were used to create
|
22
|
+
# the regular expression.
|
23
|
+
def options: () -> Integer
|
24
|
+
end
|
25
|
+
|
26
|
+
class InterpolatedStringNode < Node
|
27
|
+
# Returns true if this node was represented as a heredoc in the source code.
|
28
|
+
def heredoc?: () -> bool?
|
29
|
+
end
|
30
|
+
|
31
|
+
class InterpolatedXStringNode < Node
|
32
|
+
# Returns true if this node was represented as a heredoc in the source code.
|
33
|
+
def heredoc?: () -> bool?
|
34
|
+
end
|
35
|
+
|
36
|
+
class StringNode < Node
|
37
|
+
# Returns true if this node was represented as a heredoc in the source code.
|
38
|
+
def heredoc?: () -> bool?
|
39
|
+
end
|
40
|
+
|
41
|
+
class XStringNode < Node
|
42
|
+
# Returns true if this node was represented as a heredoc in the source code.
|
43
|
+
def heredoc?: () -> bool?
|
44
|
+
end
|
45
|
+
|
46
|
+
class ImaginaryNode < Node
|
47
|
+
def value: () -> Complex
|
48
|
+
end
|
49
|
+
|
50
|
+
class RationalNode < Node
|
51
|
+
def value: () -> Rational
|
52
|
+
end
|
53
|
+
|
54
|
+
class ConstantReadNode < Node
|
55
|
+
def full_name_parts: () -> [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
|
+
end
|
69
|
+
|
70
|
+
class ConstantPathTargetNode < Node
|
71
|
+
def full_name_parts: () -> Array[Symbol]
|
72
|
+
def full_name: () -> String
|
73
|
+
end
|
74
|
+
|
75
|
+
class ParametersNode < Node
|
76
|
+
def signature: () -> Array[[Symbol, Symbol] | [Symbol]]
|
77
|
+
end
|
78
|
+
|
79
|
+
class CallNode < Node
|
80
|
+
def full_message_loc: () -> Location?
|
81
|
+
end
|
82
|
+
end
|
data/sig/prism/pack.rbs
ADDED
@@ -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,192 @@
|
|
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
|
+
|
28
|
+
def self.for: (String source) -> Source
|
29
|
+
end
|
30
|
+
|
31
|
+
class CodeUnitsCache
|
32
|
+
def initialize: (String source, Encoding encoding) -> void
|
33
|
+
def []: (Integer byte_offset) -> Integer
|
34
|
+
end
|
35
|
+
|
36
|
+
class ASCIISource < Source
|
37
|
+
def character_offset: (Integer byte_offset) -> Integer
|
38
|
+
def character_column: (Integer byte_offset) -> Integer
|
39
|
+
def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
|
40
|
+
def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
|
41
|
+
def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
|
42
|
+
end
|
43
|
+
|
44
|
+
class Location
|
45
|
+
attr_reader source: Source
|
46
|
+
attr_reader start_offset: Integer
|
47
|
+
attr_reader length: Integer
|
48
|
+
|
49
|
+
def initialize: (Source source, Integer start_offset, Integer length) -> void
|
50
|
+
def leading_comments: () -> Array[comment]
|
51
|
+
def leading_comment: (comment) -> void
|
52
|
+
def trailing_comments: () -> Array[comment]
|
53
|
+
def trailing_comment: (comment) -> void
|
54
|
+
def comments: () -> Array[comment]
|
55
|
+
def copy: (?source: Source, ?start_offset: Integer, ?length: Integer) -> Location
|
56
|
+
def chop: () -> Location
|
57
|
+
def source_lines: () -> Array[String]
|
58
|
+
def slice: () -> String
|
59
|
+
def slice_lines: () -> String
|
60
|
+
def start_character_offset: () -> Integer
|
61
|
+
def start_code_units_offset: (Encoding encoding) -> Integer
|
62
|
+
def cached_start_code_units_offset: (_CodeUnitsCache cache) -> Integer
|
63
|
+
def end_offset: () -> Integer
|
64
|
+
def end_character_offset: () -> Integer
|
65
|
+
def end_code_units_offset: (Encoding encoding) -> Integer
|
66
|
+
def cached_end_code_units_offset: (_CodeUnitsCache cache) -> Integer
|
67
|
+
def start_line: () -> Integer
|
68
|
+
def start_line_slice: () -> String
|
69
|
+
def end_line: () -> Integer
|
70
|
+
def start_column: () -> Integer
|
71
|
+
def start_character_column: () -> Integer
|
72
|
+
def start_code_units_column: (Encoding encoding) -> Integer
|
73
|
+
def cached_start_code_units_column: (_CodeUnitsCache cache) -> Integer
|
74
|
+
def end_column: () -> Integer
|
75
|
+
def end_character_column: () -> Integer
|
76
|
+
def end_code_units_column: (Encoding encoding) -> Integer
|
77
|
+
def cached_end_code_units_column: (_CodeUnitsCache cache) -> Integer
|
78
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
79
|
+
def pretty_print: (untyped q) -> untyped
|
80
|
+
def join: (Location other) -> Location
|
81
|
+
def adjoin: (String string) -> Location
|
82
|
+
end
|
83
|
+
|
84
|
+
class Comment
|
85
|
+
attr_reader location: Location
|
86
|
+
|
87
|
+
def initialize: (Location location) -> void
|
88
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
89
|
+
def slice: () -> String
|
90
|
+
end
|
91
|
+
|
92
|
+
interface _Comment
|
93
|
+
def trailing?: () -> bool
|
94
|
+
end
|
95
|
+
|
96
|
+
type comment = Comment & _Comment
|
97
|
+
|
98
|
+
class InlineComment < Comment
|
99
|
+
include _Comment
|
100
|
+
end
|
101
|
+
|
102
|
+
class EmbDocComment < Comment
|
103
|
+
include _Comment
|
104
|
+
end
|
105
|
+
|
106
|
+
class MagicComment
|
107
|
+
attr_reader key_loc: Location
|
108
|
+
attr_reader value_loc: Location
|
109
|
+
|
110
|
+
def initialize: (Location key_loc, Location value_loc) -> void
|
111
|
+
|
112
|
+
def key: () -> String
|
113
|
+
def value: () -> String
|
114
|
+
|
115
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
116
|
+
end
|
117
|
+
|
118
|
+
class ParseError
|
119
|
+
attr_reader type: Symbol
|
120
|
+
attr_reader message: String
|
121
|
+
attr_reader location: Location
|
122
|
+
attr_reader level: Symbol
|
123
|
+
|
124
|
+
def initialize: (Symbol type, String message, Location location, Symbol level) -> void
|
125
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
126
|
+
end
|
127
|
+
|
128
|
+
class ParseWarning
|
129
|
+
attr_reader type: Symbol
|
130
|
+
attr_reader message: String
|
131
|
+
attr_reader location: Location
|
132
|
+
attr_reader level: Symbol
|
133
|
+
|
134
|
+
def initialize: (Symbol type, String message, Location location, Symbol level) -> void
|
135
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
136
|
+
end
|
137
|
+
|
138
|
+
class Result
|
139
|
+
attr_reader comments: Array[comment]
|
140
|
+
attr_reader magic_comments: Array[MagicComment]
|
141
|
+
attr_reader data_loc: Location?
|
142
|
+
attr_reader errors: Array[ParseError]
|
143
|
+
attr_reader warnings: Array[ParseWarning]
|
144
|
+
attr_reader source: Source
|
145
|
+
|
146
|
+
def initialize: (Array[comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
|
147
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
148
|
+
def success?: () -> bool
|
149
|
+
def failure?: () -> bool
|
150
|
+
def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
|
151
|
+
end
|
152
|
+
|
153
|
+
class ParseResult < Result
|
154
|
+
attr_reader value: ProgramNode
|
155
|
+
|
156
|
+
def initialize: (ProgramNode value, Array[comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
|
157
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
158
|
+
end
|
159
|
+
|
160
|
+
class LexResult < Result
|
161
|
+
attr_reader value: Array[[Token, Integer]]
|
162
|
+
|
163
|
+
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
|
164
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
165
|
+
end
|
166
|
+
|
167
|
+
class ParseLexResult < Result
|
168
|
+
attr_reader value: [ProgramNode, Array[[Token, Integer]]]
|
169
|
+
|
170
|
+
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
|
171
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
172
|
+
end
|
173
|
+
|
174
|
+
class Token
|
175
|
+
attr_reader source: Source
|
176
|
+
attr_reader type: Symbol
|
177
|
+
attr_reader value: String
|
178
|
+
attr_reader location: Location
|
179
|
+
|
180
|
+
def initialize: (Source source, Symbol type, String value, Location location) -> void
|
181
|
+
def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
|
182
|
+
def pretty_print: (untyped q) -> untyped
|
183
|
+
def ==: (untyped other) -> bool
|
184
|
+
end
|
185
|
+
|
186
|
+
class Scope
|
187
|
+
attr_reader locals: Array[Symbol]
|
188
|
+
attr_reader forwarding: Array[Symbol]
|
189
|
+
|
190
|
+
def initialize: (Array[Symbol] locals, Array[Symbol] forwarding) -> void
|
191
|
+
end
|
192
|
+
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: (node_singleton 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
|