Debian Codegraph @

sig/prism/parse_result.rbs

raw
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 byte_offset: (Integer line, Integer column) -> Integer
18 def line: (Integer byte_offset) -> Integer
19 def line_start: (Integer byte_offset) -> Integer
20 def line_end: (Integer byte_offset) -> Integer
21 def line_offset: (Integer byte_offset) -> Integer
22 def column: (Integer byte_offset) -> Integer
23 def character_offset: (Integer byte_offset) -> Integer
24 def character_column: (Integer byte_offset) -> Integer
25 def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
26 def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
27 def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
28 def deep_freeze: () -> void
29
30 def self.for: (String source) -> Source
31 end
32
33 class CodeUnitsCache
34 def initialize: (String source, Encoding encoding) -> void
35 def []: (Integer byte_offset) -> Integer
36 end
37
38 class ASCIISource < Source
39 def character_offset: (Integer byte_offset) -> Integer
40 def character_column: (Integer byte_offset) -> Integer
41 def code_units_offset: (Integer byte_offset, Encoding encoding) -> Integer
42 def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
43 def code_units_column: (Integer byte_offset, Encoding encoding) -> Integer
44 end
45
46 class Location
47 attr_reader source: Source
48 attr_reader start_offset: Integer
49 attr_reader length: Integer
50
51 def initialize: (Source source, Integer start_offset, Integer length) -> void
52 def leading_comments: () -> Array[comment]
53 def leading_comment: (comment) -> void
54 def trailing_comments: () -> Array[comment]
55 def trailing_comment: (comment) -> void
56 def comments: () -> Array[comment]
57 def copy: (?source: Source, ?start_offset: Integer, ?length: Integer) -> Location
58 def chop: () -> Location
59 def source_lines: () -> Array[String]
60 def slice: () -> String
61 def slice_lines: () -> String
62 def start_character_offset: () -> Integer
63 def start_code_units_offset: (Encoding encoding) -> Integer
64 def cached_start_code_units_offset: (_CodeUnitsCache cache) -> Integer
65 def end_offset: () -> Integer
66 def end_character_offset: () -> Integer
67 def end_code_units_offset: (Encoding encoding) -> Integer
68 def cached_end_code_units_offset: (_CodeUnitsCache cache) -> Integer
69 def start_line: () -> Integer
70 def start_line_slice: () -> String
71 def end_line: () -> Integer
72 def start_column: () -> Integer
73 def start_character_column: () -> Integer
74 def start_code_units_column: (Encoding encoding) -> Integer
75 def cached_start_code_units_column: (_CodeUnitsCache cache) -> Integer
76 def end_column: () -> Integer
77 def end_character_column: () -> Integer
78 def end_code_units_column: (Encoding encoding) -> Integer
79 def cached_end_code_units_column: (_CodeUnitsCache cache) -> Integer
80 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
81 def pretty_print: (untyped q) -> untyped
82 def join: (Location other) -> Location
83 def adjoin: (String string) -> Location
84 end
85
86 class Comment
87 attr_reader location: Location
88
89 def initialize: (Location location) -> void
90 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
91 def slice: () -> String
92 end
93
94 interface _Comment
95 def trailing?: () -> bool
96 end
97
98 type comment = Comment & _Comment
99
100 class InlineComment < Comment
101 include _Comment
102 end
103
104 class EmbDocComment < Comment
105 include _Comment
106 end
107
108 class MagicComment
109 attr_reader key_loc: Location
110 attr_reader value_loc: Location
111
112 def initialize: (Location key_loc, Location value_loc) -> void
113
114 def key: () -> String
115 def value: () -> String
116
117 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
118 end
119
120 class ParseError
121 attr_reader type: Symbol
122 attr_reader message: String
123 attr_reader location: Location
124 attr_reader level: Symbol
125
126 def initialize: (Symbol type, String message, Location location, Symbol level) -> void
127 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
128 end
129
130 class ParseWarning
131 attr_reader type: Symbol
132 attr_reader message: String
133 attr_reader location: Location
134 attr_reader level: Symbol
135
136 def initialize: (Symbol type, String message, Location location, Symbol level) -> void
137 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
138 end
139
140 class Result
141 attr_reader comments: Array[comment]
142 attr_reader magic_comments: Array[MagicComment]
143 attr_reader data_loc: Location?
144 attr_reader errors: Array[ParseError]
145 attr_reader warnings: Array[ParseWarning]
146 attr_reader source: Source
147
148 def initialize: (Array[comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
149 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
150 def encoding: () -> Encoding
151 def success?: () -> bool
152 def failure?: () -> bool
153 def code_units_cache: (Encoding encoding) -> _CodeUnitsCache
154 end
155
156 class ParseResult < Result
157 attr_reader value: ProgramNode
158
159 def initialize: (ProgramNode value, Array[comment] comments, Array[MagicComment] magic_comments, Location? data_loc, Array[ParseError] errors, Array[ParseWarning] warnings, Source source) -> void
160 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
161 def errors_format: () -> String
162 end
163
164 class LexResult < Result
165 attr_reader value: Array[[Token, Integer]]
166
167 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
168 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
169 end
170
171 class ParseLexResult < Result
172 attr_reader value: [ProgramNode, Array[[Token, Integer]]]
173
174 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
175 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
176 end
177
178 class Token
179 attr_reader source: Source
180 attr_reader type: Symbol
181 attr_reader value: String
182 attr_reader location: Location
183
184 def initialize: (Source source, Symbol type, String value, Location location) -> void
185 def deconstruct_keys: (Array[Symbol]? keys) -> Hash[Symbol, untyped]
186 def pretty_print: (untyped q) -> untyped
187 def ==: (untyped other) -> bool
188 def deep_freeze: () -> void
189 end
190
191 class Scope
192 attr_reader locals: Array[Symbol]
193 attr_reader forwarding: Array[Symbol]
194
195 def initialize: (Array[Symbol] locals, Array[Symbol] forwarding) -> void
196 end
197 end