rbs 3.0.0.dev.2 → 3.0.0.dev.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +2 -1
- data/.github/workflows/ruby.yml +4 -0
- data/Gemfile.lock +11 -11
- data/Rakefile +2 -2
- data/Steepfile +1 -1
- data/core/array.rbs +573 -423
- data/core/basic_object.rbs +11 -39
- data/core/binding.rbs +1 -1
- data/core/builtin.rbs +8 -0
- data/core/class.rbs +37 -0
- data/core/comparable.rbs +7 -18
- data/core/complex.rbs +2 -2
- data/core/data.rbs +419 -0
- data/core/dir.rbs +52 -104
- data/core/encoding.rbs +22 -181
- data/core/enumerable.rbs +212 -175
- data/core/enumerator/product.rbs +96 -0
- data/core/enumerator.rbs +57 -8
- data/core/errors.rbs +8 -2
- data/core/exception.rbs +41 -0
- data/core/fiber.rbs +95 -12
- data/core/file.rbs +840 -275
- data/core/file_test.rbs +34 -19
- data/core/float.rbs +40 -96
- data/core/gc.rbs +15 -3
- data/core/hash.rbs +113 -175
- data/core/integer.rbs +85 -145
- data/core/io/buffer.rbs +187 -60
- data/core/io/wait.rbs +28 -16
- data/core/io.rbs +1859 -1389
- data/core/kernel.rbs +525 -961
- data/core/match_data.rbs +306 -142
- data/core/math.rbs +506 -234
- data/core/method.rbs +0 -24
- data/core/module.rbs +110 -17
- data/core/nil_class.rbs +2 -0
- data/core/numeric.rbs +76 -144
- data/core/object.rbs +88 -212
- data/core/proc.rbs +17 -5
- data/core/process.rbs +22 -5
- data/core/ractor.rbs +1 -1
- data/core/random.rbs +20 -3
- data/core/range.rbs +91 -89
- data/core/rational.rbs +2 -3
- data/core/rbs/unnamed/argf.rbs +177 -120
- data/core/rbs/unnamed/env_class.rbs +89 -163
- data/core/rbs/unnamed/random.rbs +36 -12
- data/core/refinement.rbs +8 -0
- data/core/regexp.rbs +462 -272
- data/core/ruby_vm.rbs +210 -0
- data/{stdlib/set/0 → core}/set.rbs +43 -47
- data/core/string.rbs +1403 -1332
- data/core/string_io.rbs +191 -107
- data/core/struct.rbs +67 -63
- data/core/symbol.rbs +187 -201
- data/core/thread.rbs +40 -35
- data/core/time.rbs +902 -826
- data/core/trace_point.rbs +55 -6
- data/core/unbound_method.rbs +48 -24
- data/docs/collection.md +4 -0
- data/docs/syntax.md +55 -0
- data/ext/rbs_extension/parser.c +5 -6
- data/lib/rbs/cli.rb +6 -1
- data/lib/rbs/collection/cleaner.rb +8 -1
- data/lib/rbs/collection/config/lockfile.rb +3 -1
- data/lib/rbs/collection/config/lockfile_generator.rb +16 -14
- data/lib/rbs/collection/config.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +9 -2
- data/lib/rbs/collection/sources/local.rb +79 -0
- data/lib/rbs/collection/sources.rb +8 -1
- data/lib/rbs/environment.rb +6 -5
- data/lib/rbs/environment_loader.rb +3 -2
- data/lib/rbs/errors.rb +18 -0
- data/lib/rbs/locator.rb +26 -7
- data/lib/rbs/sorter.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/sig/collection/sources.rbs +32 -3
- data/sig/environment.rbs +2 -3
- data/sig/locator.rbs +14 -2
- data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
- data/stdlib/cgi/0/core.rbs +16 -0
- data/stdlib/coverage/0/coverage.rbs +50 -8
- data/stdlib/csv/0/csv.rbs +1 -1
- data/stdlib/date/0/date.rbs +856 -726
- data/stdlib/date/0/date_time.rbs +83 -210
- data/stdlib/erb/0/erb.rbs +13 -36
- data/stdlib/etc/0/etc.rbs +127 -20
- data/stdlib/fileutils/0/fileutils.rbs +1290 -381
- data/stdlib/logger/0/logger.rbs +466 -316
- data/stdlib/net-http/0/net-http.rbs +2211 -534
- data/stdlib/nkf/0/nkf.rbs +5 -5
- data/stdlib/objspace/0/objspace.rbs +31 -14
- data/stdlib/openssl/0/openssl.rbs +11 -7
- data/stdlib/optparse/0/optparse.rbs +20 -17
- data/stdlib/pathname/0/pathname.rbs +21 -4
- data/stdlib/pstore/0/pstore.rbs +378 -154
- data/stdlib/pty/0/pty.rbs +24 -8
- data/stdlib/ripper/0/ripper.rbs +1650 -0
- data/stdlib/socket/0/addrinfo.rbs +9 -15
- data/stdlib/socket/0/socket.rbs +36 -3
- data/stdlib/strscan/0/string_scanner.rbs +7 -5
- data/stdlib/tempfile/0/tempfile.rbs +104 -44
- data/stdlib/time/0/time.rbs +2 -2
- data/stdlib/uri/0/file.rbs +5 -0
- data/stdlib/uri/0/generic.rbs +2 -2
- data/stdlib/yaml/0/yaml.rbs +2 -2
- data/stdlib/zlib/0/zlib.rbs +1 -1
- metadata +8 -6
- data/core/deprecated.rbs +0 -9
- data/sig/shims/ripper.rbs +0 -8
@@ -0,0 +1,1650 @@
|
|
1
|
+
# <!-- rdoc-file=ext/ripper/lib/ripper.rb -->
|
2
|
+
# Ripper is a Ruby script parser.
|
3
|
+
#
|
4
|
+
# You can get information from the parser with event-based style. Information
|
5
|
+
# such as abstract syntax trees or simple lexical analysis of the Ruby program.
|
6
|
+
#
|
7
|
+
# ## Usage
|
8
|
+
#
|
9
|
+
# Ripper provides an easy interface for parsing your program into a symbolic
|
10
|
+
# expression tree (or S-expression).
|
11
|
+
#
|
12
|
+
# Understanding the output of the parser may come as a challenge, it's
|
13
|
+
# recommended you use PP to format the output for legibility.
|
14
|
+
#
|
15
|
+
# require 'ripper'
|
16
|
+
# require 'pp'
|
17
|
+
#
|
18
|
+
# pp Ripper.sexp('def hello(world) "Hello, #{world}!"; end')
|
19
|
+
# #=> [:program,
|
20
|
+
# [[:def,
|
21
|
+
# [:@ident, "hello", [1, 4]],
|
22
|
+
# [:paren,
|
23
|
+
# [:params, [[:@ident, "world", [1, 10]]], nil, nil, nil, nil, nil, nil]],
|
24
|
+
# [:bodystmt,
|
25
|
+
# [[:string_literal,
|
26
|
+
# [:string_content,
|
27
|
+
# [:@tstring_content, "Hello, ", [1, 18]],
|
28
|
+
# [:string_embexpr, [[:var_ref, [:@ident, "world", [1, 27]]]]],
|
29
|
+
# [:@tstring_content, "!", [1, 33]]]]],
|
30
|
+
# nil,
|
31
|
+
# nil,
|
32
|
+
# nil]]]]
|
33
|
+
#
|
34
|
+
# You can see in the example above, the expression starts with `:program`.
|
35
|
+
#
|
36
|
+
# From here, a method definition at `:def`, followed by the method's identifier
|
37
|
+
# `:@ident`. After the method's identifier comes the parentheses `:paren` and
|
38
|
+
# the method parameters under `:params`.
|
39
|
+
#
|
40
|
+
# Next is the method body, starting at `:bodystmt` (`stmt` meaning statement),
|
41
|
+
# which contains the full definition of the method.
|
42
|
+
#
|
43
|
+
# In our case, we're simply returning a String, so next we have the
|
44
|
+
# `:string_literal` expression.
|
45
|
+
#
|
46
|
+
# Within our `:string_literal` you'll notice two `@tstring_content`, this is the
|
47
|
+
# literal part for `Hello, ` and `!`. Between the two `@tstring_content`
|
48
|
+
# statements is a `:string_embexpr`, where *embexpr* is an embedded expression.
|
49
|
+
# Our expression consists of a local variable, or `var_ref`, with the identifier
|
50
|
+
# (`@ident`) of `world`.
|
51
|
+
#
|
52
|
+
# ## Resources
|
53
|
+
#
|
54
|
+
# * [Ruby
|
55
|
+
# Inside](http://www.rubyinside.com/using-ripper-to-see-how-ruby-is-parsing-
|
56
|
+
# your-code-5270.html)
|
57
|
+
#
|
58
|
+
#
|
59
|
+
# ## Requirements
|
60
|
+
#
|
61
|
+
# * ruby 1.9 (support CVS HEAD only)
|
62
|
+
# * bison 1.28 or later (Other yaccs do not work)
|
63
|
+
#
|
64
|
+
#
|
65
|
+
# ## License
|
66
|
+
#
|
67
|
+
# Ruby License.
|
68
|
+
#
|
69
|
+
# * Minero Aoki
|
70
|
+
# * aamine@loveruby.net
|
71
|
+
# * http://i.loveruby.net
|
72
|
+
#
|
73
|
+
class Ripper
|
74
|
+
# <!-- rdoc-file=ext/ripper/lib/ripper/core.rb -->
|
75
|
+
# This array contains name of all ripper events.
|
76
|
+
#
|
77
|
+
EVENTS: Array[Symbol]
|
78
|
+
|
79
|
+
EXPR_ARG: Integer
|
80
|
+
|
81
|
+
EXPR_ARG_ANY: Integer
|
82
|
+
|
83
|
+
EXPR_BEG: Integer
|
84
|
+
|
85
|
+
EXPR_BEG_ANY: Integer
|
86
|
+
|
87
|
+
EXPR_CLASS: Integer
|
88
|
+
|
89
|
+
EXPR_CMDARG: Integer
|
90
|
+
|
91
|
+
EXPR_DOT: Integer
|
92
|
+
|
93
|
+
EXPR_END: Integer
|
94
|
+
|
95
|
+
EXPR_ENDARG: Integer
|
96
|
+
|
97
|
+
EXPR_ENDFN: Integer
|
98
|
+
|
99
|
+
EXPR_END_ANY: Integer
|
100
|
+
|
101
|
+
EXPR_FITEM: Integer
|
102
|
+
|
103
|
+
EXPR_FNAME: Integer
|
104
|
+
|
105
|
+
EXPR_LABEL: Integer
|
106
|
+
|
107
|
+
EXPR_LABELED: Integer
|
108
|
+
|
109
|
+
EXPR_MID: Integer
|
110
|
+
|
111
|
+
EXPR_NONE: Integer
|
112
|
+
|
113
|
+
EXPR_VALUE: Integer
|
114
|
+
|
115
|
+
# <!-- rdoc-file=ext/ripper/lib/ripper/core.rb -->
|
116
|
+
# This array contains name of parser events.
|
117
|
+
#
|
118
|
+
PARSER_EVENTS: Array[Symbol]
|
119
|
+
|
120
|
+
PARSER_EVENT_TABLE: Hash[Symbol, Integer]
|
121
|
+
|
122
|
+
# <!-- rdoc-file=ext/ripper/lib/ripper/core.rb -->
|
123
|
+
# This array contains name of scanner events.
|
124
|
+
#
|
125
|
+
SCANNER_EVENTS: Array[Symbol]
|
126
|
+
|
127
|
+
SCANNER_EVENT_TABLE: Hash[Symbol, Integer]
|
128
|
+
|
129
|
+
# <!-- rdoc-file=parse.c -->
|
130
|
+
# version of Ripper
|
131
|
+
#
|
132
|
+
Version: String
|
133
|
+
|
134
|
+
# <!-- rdoc-file=ext/ripper/lib/ripper/filter.rb -->
|
135
|
+
# This class handles only scanner events, which are dispatched in the 'right'
|
136
|
+
# order (same with input).
|
137
|
+
#
|
138
|
+
class Filter
|
139
|
+
private
|
140
|
+
|
141
|
+
# <!--
|
142
|
+
# rdoc-file=ext/ripper/lib/ripper/filter.rb
|
143
|
+
# - new(src, filename = '-', lineno = 1)
|
144
|
+
# -->
|
145
|
+
# Creates a new Ripper::Filter instance, passes parameters `src`, `filename`,
|
146
|
+
# and `lineno` to Ripper::Lexer.new
|
147
|
+
#
|
148
|
+
# The lexer is for internal use only.
|
149
|
+
#
|
150
|
+
def initialize: (File | _Gets | String src, ?String filename, ?Integer lineno) -> void
|
151
|
+
|
152
|
+
public
|
153
|
+
|
154
|
+
# <!--
|
155
|
+
# rdoc-file=ext/ripper/lib/ripper/filter.rb
|
156
|
+
# - column()
|
157
|
+
# -->
|
158
|
+
# The column number of the current token. This value starts from 0. This method
|
159
|
+
# is valid only in event handlers.
|
160
|
+
#
|
161
|
+
def column: () -> Integer?
|
162
|
+
|
163
|
+
# <!--
|
164
|
+
# rdoc-file=ext/ripper/lib/ripper/filter.rb
|
165
|
+
# - filename()
|
166
|
+
# -->
|
167
|
+
# The file name of the input.
|
168
|
+
#
|
169
|
+
def filename: () -> String
|
170
|
+
|
171
|
+
# <!--
|
172
|
+
# rdoc-file=ext/ripper/lib/ripper/filter.rb
|
173
|
+
# - lineno()
|
174
|
+
# -->
|
175
|
+
# The line number of the current token. This value starts from 1. This method is
|
176
|
+
# valid only in event handlers.
|
177
|
+
#
|
178
|
+
def lineno: () -> Integer?
|
179
|
+
|
180
|
+
# <!--
|
181
|
+
# rdoc-file=ext/ripper/lib/ripper/filter.rb
|
182
|
+
# - parse(init = nil)
|
183
|
+
# -->
|
184
|
+
# Starts the parser. `init` is a data accumulator and is passed to the next
|
185
|
+
# event handler (as of Enumerable#inject).
|
186
|
+
#
|
187
|
+
def parse: (?untyped init) -> untyped
|
188
|
+
|
189
|
+
# <!--
|
190
|
+
# rdoc-file=ext/ripper/lib/ripper/filter.rb
|
191
|
+
# - state()
|
192
|
+
# -->
|
193
|
+
# The scanner's state of the current token. This value is the bitwise OR of zero
|
194
|
+
# or more of the `Ripper::EXPR_*` constants.
|
195
|
+
#
|
196
|
+
def state: () -> Ripper::Lexer::State
|
197
|
+
|
198
|
+
private
|
199
|
+
|
200
|
+
# <!--
|
201
|
+
# rdoc-file=ext/ripper/lib/ripper/filter.rb
|
202
|
+
# - on_default(event, token, data)
|
203
|
+
# -->
|
204
|
+
# This method is called when some event handler is undefined. `event` is
|
205
|
+
# :on_XXX, `token` is the scanned token, and `data` is a data accumulator.
|
206
|
+
#
|
207
|
+
# The return value of this method is passed to the next event handler (as of
|
208
|
+
# Enumerable#inject).
|
209
|
+
#
|
210
|
+
def on_default: (untyped event, untyped token, untyped data) -> untyped
|
211
|
+
end
|
212
|
+
|
213
|
+
class Lexer < Ripper
|
214
|
+
class Elem
|
215
|
+
attr_accessor event: Symbol
|
216
|
+
|
217
|
+
attr_accessor message: String?
|
218
|
+
attr_accessor pos: [ Integer, Integer ]
|
219
|
+
|
220
|
+
attr_accessor state: Ripper::Lexer::State
|
221
|
+
attr_accessor tok: String
|
222
|
+
|
223
|
+
private
|
224
|
+
|
225
|
+
# <!--
|
226
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
227
|
+
# - new(pos, event, tok, state, message = nil)
|
228
|
+
# -->
|
229
|
+
#
|
230
|
+
def initialize: ([ Integer, Integer ] pos, Symbol event, String tok, Integer | Ripper::Lexer::State state, ?String? message) -> void
|
231
|
+
|
232
|
+
public
|
233
|
+
|
234
|
+
# <!--
|
235
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
236
|
+
# - [](index)
|
237
|
+
# -->
|
238
|
+
#
|
239
|
+
def []: (0 | :pos) -> [ Integer, Integer ]
|
240
|
+
| (1 | :event) -> Symbol
|
241
|
+
| (2 | :tok) -> String
|
242
|
+
| (3 | :state) -> Ripper::Lexer::State
|
243
|
+
| (4 | :message) -> String?
|
244
|
+
| (Integer | Symbol) -> untyped
|
245
|
+
| (untyped) -> nil
|
246
|
+
|
247
|
+
# <!--
|
248
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
249
|
+
# - to_a()
|
250
|
+
# -->
|
251
|
+
#
|
252
|
+
def to_a: () -> [ [ Integer, Integer ], Symbol, String, Ripper::Lexer::State, String ]
|
253
|
+
| () -> [ [ Integer, Integer ], Symbol, String, Ripper::Lexer::State ]
|
254
|
+
end
|
255
|
+
|
256
|
+
class State
|
257
|
+
attr_reader to_int: Integer
|
258
|
+
attr_reader to_s: String
|
259
|
+
|
260
|
+
private
|
261
|
+
|
262
|
+
# <!--
|
263
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
264
|
+
# - new(i)
|
265
|
+
# -->
|
266
|
+
#
|
267
|
+
def initialize: (Integer | State i) -> void
|
268
|
+
|
269
|
+
public
|
270
|
+
|
271
|
+
# <!--
|
272
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
273
|
+
# - &(i)
|
274
|
+
# -->
|
275
|
+
#
|
276
|
+
def &: (Integer i) -> State
|
277
|
+
|
278
|
+
# <!--
|
279
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
280
|
+
# - ==(i)
|
281
|
+
# -->
|
282
|
+
#
|
283
|
+
def ==: (Integer | State i) -> bool
|
284
|
+
|
285
|
+
# <!--
|
286
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
287
|
+
# - [](index)
|
288
|
+
# -->
|
289
|
+
#
|
290
|
+
def []: (0 | :to_int index) -> (Integer | State)
|
291
|
+
| (1 | :to_s index) -> String
|
292
|
+
| (untyped) -> nil
|
293
|
+
|
294
|
+
# <!--
|
295
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
296
|
+
# - allbits?(i)
|
297
|
+
# -->
|
298
|
+
#
|
299
|
+
def allbits?: (int i) -> bool
|
300
|
+
|
301
|
+
# <!--
|
302
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
303
|
+
# - anybits?(i)
|
304
|
+
# -->
|
305
|
+
#
|
306
|
+
def anybits?: (int i) -> bool
|
307
|
+
|
308
|
+
# <!--
|
309
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
310
|
+
# - nobits?(i)
|
311
|
+
# -->
|
312
|
+
#
|
313
|
+
def nobits?: (int i) -> bool
|
314
|
+
|
315
|
+
alias to_i to_int
|
316
|
+
|
317
|
+
# <!--
|
318
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
319
|
+
# - |(i)
|
320
|
+
# -->
|
321
|
+
#
|
322
|
+
def |: (Integer i) -> State
|
323
|
+
end
|
324
|
+
attr_reader errors: Array[Lexer::Elem]
|
325
|
+
|
326
|
+
alias compile_error on_error1
|
327
|
+
def lex: (?raise_errors: boolish) -> Array[[ [ Integer, Integer ], Symbol, String, Lexer::State ]]
|
328
|
+
|
329
|
+
alias on_CHAR _push_token
|
330
|
+
|
331
|
+
alias on___end__ _push_token
|
332
|
+
|
333
|
+
alias on_alias_error on_error2
|
334
|
+
|
335
|
+
alias on_assign_error on_error2
|
336
|
+
|
337
|
+
alias on_backref _push_token
|
338
|
+
|
339
|
+
alias on_backtick _push_token
|
340
|
+
|
341
|
+
alias on_class_name_error on_error2
|
342
|
+
|
343
|
+
alias on_comma _push_token
|
344
|
+
|
345
|
+
alias on_comment _push_token
|
346
|
+
|
347
|
+
alias on_const _push_token
|
348
|
+
|
349
|
+
alias on_cvar _push_token
|
350
|
+
|
351
|
+
alias on_embdoc _push_token
|
352
|
+
|
353
|
+
alias on_embdoc_beg _push_token
|
354
|
+
|
355
|
+
alias on_embdoc_end _push_token
|
356
|
+
|
357
|
+
alias on_embexpr_beg _push_token
|
358
|
+
|
359
|
+
alias on_embexpr_end _push_token
|
360
|
+
|
361
|
+
alias on_embvar _push_token
|
362
|
+
|
363
|
+
alias on_float _push_token
|
364
|
+
|
365
|
+
alias on_gvar _push_token
|
366
|
+
|
367
|
+
alias on_ident _push_token
|
368
|
+
|
369
|
+
alias on_ignored_nl _push_token
|
370
|
+
|
371
|
+
alias on_ignored_sp _push_token
|
372
|
+
|
373
|
+
alias on_imaginary _push_token
|
374
|
+
|
375
|
+
alias on_int _push_token
|
376
|
+
|
377
|
+
alias on_ivar _push_token
|
378
|
+
|
379
|
+
alias on_kw _push_token
|
380
|
+
|
381
|
+
alias on_label _push_token
|
382
|
+
|
383
|
+
alias on_label_end _push_token
|
384
|
+
|
385
|
+
alias on_lbrace _push_token
|
386
|
+
|
387
|
+
alias on_lbracket _push_token
|
388
|
+
|
389
|
+
alias on_lparen _push_token
|
390
|
+
|
391
|
+
alias on_nl _push_token
|
392
|
+
|
393
|
+
alias on_op _push_token
|
394
|
+
|
395
|
+
alias on_param_error on_error2
|
396
|
+
|
397
|
+
alias on_parse_error on_error1
|
398
|
+
|
399
|
+
alias on_period _push_token
|
400
|
+
|
401
|
+
alias on_qsymbols_beg _push_token
|
402
|
+
|
403
|
+
alias on_qwords_beg _push_token
|
404
|
+
|
405
|
+
alias on_rational _push_token
|
406
|
+
|
407
|
+
alias on_rbrace _push_token
|
408
|
+
|
409
|
+
alias on_rbracket _push_token
|
410
|
+
|
411
|
+
alias on_regexp_beg _push_token
|
412
|
+
|
413
|
+
alias on_regexp_end _push_token
|
414
|
+
|
415
|
+
alias on_rparen _push_token
|
416
|
+
|
417
|
+
alias on_semicolon _push_token
|
418
|
+
|
419
|
+
alias on_sp _push_token
|
420
|
+
|
421
|
+
alias on_symbeg _push_token
|
422
|
+
|
423
|
+
alias on_symbols_beg _push_token
|
424
|
+
|
425
|
+
alias on_tlambda _push_token
|
426
|
+
|
427
|
+
alias on_tlambeg _push_token
|
428
|
+
|
429
|
+
alias on_tstring_beg _push_token
|
430
|
+
|
431
|
+
alias on_tstring_content _push_token
|
432
|
+
|
433
|
+
alias on_tstring_end _push_token
|
434
|
+
|
435
|
+
alias on_words_beg _push_token
|
436
|
+
|
437
|
+
alias on_words_sep _push_token
|
438
|
+
def parse: (?raise_errors: boolish) -> Array[Lexer::Elem]
|
439
|
+
|
440
|
+
def scan: (?raise_errors: boolish) -> Array[Lexer::Elem]
|
441
|
+
|
442
|
+
def tokenize: (?raise_errors: boolish) -> Array[String]
|
443
|
+
|
444
|
+
private
|
445
|
+
|
446
|
+
def _push_token: (untyped tok) -> Lexer::Elem
|
447
|
+
|
448
|
+
def on_error1: (untyped mesg) -> Array[Lexer::Elem]
|
449
|
+
|
450
|
+
def on_error2: (untyped mesg, untyped elem) -> Array[Lexer::Elem]
|
451
|
+
|
452
|
+
def on_heredoc_beg: (untyped tok) -> untyped
|
453
|
+
|
454
|
+
def on_heredoc_dedent: (untyped v, untyped w) -> untyped
|
455
|
+
|
456
|
+
def on_heredoc_end: (untyped tok) -> untyped
|
457
|
+
end
|
458
|
+
|
459
|
+
class SexpBuilder < Ripper
|
460
|
+
attr_reader error: untyped
|
461
|
+
|
462
|
+
alias compile_error on_error
|
463
|
+
def on_BEGIN: (*untyped args) -> untyped
|
464
|
+
|
465
|
+
def on_CHAR: (untyped tok) -> untyped
|
466
|
+
|
467
|
+
def on_END: (*untyped args) -> untyped
|
468
|
+
|
469
|
+
def on___end__: (untyped tok) -> untyped
|
470
|
+
|
471
|
+
def on_alias: (*untyped args) -> untyped
|
472
|
+
|
473
|
+
def on_alias_error: (*untyped args) -> untyped
|
474
|
+
|
475
|
+
def on_aref: (*untyped args) -> untyped
|
476
|
+
|
477
|
+
def on_aref_field: (*untyped args) -> untyped
|
478
|
+
|
479
|
+
def on_arg_ambiguous: (*untyped args) -> untyped
|
480
|
+
|
481
|
+
def on_arg_paren: (*untyped args) -> untyped
|
482
|
+
|
483
|
+
def on_args_add: (*untyped args) -> untyped
|
484
|
+
|
485
|
+
def on_args_add_block: (*untyped args) -> untyped
|
486
|
+
|
487
|
+
def on_args_add_star: (*untyped args) -> untyped
|
488
|
+
|
489
|
+
def on_args_forward: (*untyped args) -> untyped
|
490
|
+
|
491
|
+
def on_args_new: (*untyped args) -> untyped
|
492
|
+
|
493
|
+
def on_array: (*untyped args) -> untyped
|
494
|
+
|
495
|
+
def on_aryptn: (*untyped args) -> untyped
|
496
|
+
|
497
|
+
def on_assign: (*untyped args) -> untyped
|
498
|
+
|
499
|
+
def on_assign_error: (*untyped args) -> untyped
|
500
|
+
|
501
|
+
def on_assoc_new: (*untyped args) -> untyped
|
502
|
+
|
503
|
+
def on_assoc_splat: (*untyped args) -> untyped
|
504
|
+
|
505
|
+
def on_assoclist_from_args: (*untyped args) -> untyped
|
506
|
+
|
507
|
+
def on_backref: (untyped tok) -> untyped
|
508
|
+
|
509
|
+
def on_backtick: (untyped tok) -> untyped
|
510
|
+
|
511
|
+
def on_bare_assoc_hash: (*untyped args) -> untyped
|
512
|
+
|
513
|
+
def on_begin: (*untyped args) -> untyped
|
514
|
+
|
515
|
+
def on_binary: (*untyped args) -> untyped
|
516
|
+
|
517
|
+
def on_block_var: (*untyped args) -> untyped
|
518
|
+
|
519
|
+
def on_blockarg: (*untyped args) -> untyped
|
520
|
+
|
521
|
+
def on_bodystmt: (*untyped args) -> untyped
|
522
|
+
|
523
|
+
def on_brace_block: (*untyped args) -> untyped
|
524
|
+
|
525
|
+
def on_break: (*untyped args) -> untyped
|
526
|
+
|
527
|
+
def on_call: (*untyped args) -> untyped
|
528
|
+
|
529
|
+
def on_case: (*untyped args) -> untyped
|
530
|
+
|
531
|
+
def on_class: (*untyped args) -> untyped
|
532
|
+
|
533
|
+
def on_class_name_error: (*untyped args) -> untyped
|
534
|
+
|
535
|
+
def on_comma: (untyped tok) -> untyped
|
536
|
+
|
537
|
+
def on_command: (*untyped args) -> untyped
|
538
|
+
|
539
|
+
def on_command_call: (*untyped args) -> untyped
|
540
|
+
|
541
|
+
def on_comment: (untyped tok) -> untyped
|
542
|
+
|
543
|
+
def on_const: (untyped tok) -> untyped
|
544
|
+
|
545
|
+
def on_const_path_field: (*untyped args) -> untyped
|
546
|
+
|
547
|
+
def on_const_path_ref: (*untyped args) -> untyped
|
548
|
+
|
549
|
+
def on_const_ref: (*untyped args) -> untyped
|
550
|
+
|
551
|
+
def on_cvar: (untyped tok) -> untyped
|
552
|
+
|
553
|
+
def on_def: (*untyped args) -> untyped
|
554
|
+
|
555
|
+
def on_defined: (*untyped args) -> untyped
|
556
|
+
|
557
|
+
def on_defs: (*untyped args) -> untyped
|
558
|
+
|
559
|
+
def on_do_block: (*untyped args) -> untyped
|
560
|
+
|
561
|
+
def on_dot2: (*untyped args) -> untyped
|
562
|
+
|
563
|
+
def on_dot3: (*untyped args) -> untyped
|
564
|
+
|
565
|
+
def on_dyna_symbol: (*untyped args) -> untyped
|
566
|
+
|
567
|
+
def on_else: (*untyped args) -> untyped
|
568
|
+
|
569
|
+
def on_elsif: (*untyped args) -> untyped
|
570
|
+
|
571
|
+
def on_embdoc: (untyped tok) -> untyped
|
572
|
+
|
573
|
+
def on_embdoc_beg: (untyped tok) -> untyped
|
574
|
+
|
575
|
+
def on_embdoc_end: (untyped tok) -> untyped
|
576
|
+
|
577
|
+
def on_embexpr_beg: (untyped tok) -> untyped
|
578
|
+
|
579
|
+
def on_embexpr_end: (untyped tok) -> untyped
|
580
|
+
|
581
|
+
def on_embvar: (untyped tok) -> untyped
|
582
|
+
|
583
|
+
def on_ensure: (*untyped args) -> untyped
|
584
|
+
|
585
|
+
def on_excessed_comma: (*untyped args) -> untyped
|
586
|
+
|
587
|
+
def on_fcall: (*untyped args) -> untyped
|
588
|
+
|
589
|
+
def on_field: (*untyped args) -> untyped
|
590
|
+
|
591
|
+
def on_float: (untyped tok) -> untyped
|
592
|
+
|
593
|
+
def on_fndptn: (*untyped args) -> untyped
|
594
|
+
|
595
|
+
def on_for: (*untyped args) -> untyped
|
596
|
+
|
597
|
+
def on_gvar: (untyped tok) -> untyped
|
598
|
+
|
599
|
+
def on_hash: (*untyped args) -> untyped
|
600
|
+
|
601
|
+
def on_heredoc_beg: (untyped tok) -> untyped
|
602
|
+
|
603
|
+
def on_heredoc_end: (untyped tok) -> untyped
|
604
|
+
|
605
|
+
def on_hshptn: (*untyped args) -> untyped
|
606
|
+
|
607
|
+
def on_ident: (untyped tok) -> untyped
|
608
|
+
|
609
|
+
def on_if: (*untyped args) -> untyped
|
610
|
+
|
611
|
+
def on_if_mod: (*untyped args) -> untyped
|
612
|
+
|
613
|
+
def on_ifop: (*untyped args) -> untyped
|
614
|
+
|
615
|
+
def on_ignored_nl: (untyped tok) -> untyped
|
616
|
+
|
617
|
+
def on_ignored_sp: (untyped tok) -> untyped
|
618
|
+
|
619
|
+
def on_imaginary: (untyped tok) -> untyped
|
620
|
+
|
621
|
+
def on_in: (*untyped args) -> untyped
|
622
|
+
|
623
|
+
def on_int: (untyped tok) -> untyped
|
624
|
+
|
625
|
+
def on_ivar: (untyped tok) -> untyped
|
626
|
+
|
627
|
+
def on_kw: (untyped tok) -> untyped
|
628
|
+
|
629
|
+
def on_kwrest_param: (*untyped args) -> untyped
|
630
|
+
|
631
|
+
def on_label: (untyped tok) -> untyped
|
632
|
+
|
633
|
+
def on_label_end: (untyped tok) -> untyped
|
634
|
+
|
635
|
+
def on_lambda: (*untyped args) -> untyped
|
636
|
+
|
637
|
+
def on_lbrace: (untyped tok) -> untyped
|
638
|
+
|
639
|
+
def on_lbracket: (untyped tok) -> untyped
|
640
|
+
|
641
|
+
def on_lparen: (untyped tok) -> untyped
|
642
|
+
|
643
|
+
def on_magic_comment: (*untyped args) -> untyped
|
644
|
+
|
645
|
+
def on_massign: (*untyped args) -> untyped
|
646
|
+
|
647
|
+
def on_method_add_arg: (*untyped args) -> untyped
|
648
|
+
|
649
|
+
def on_method_add_block: (*untyped args) -> untyped
|
650
|
+
|
651
|
+
def on_mlhs_add: (*untyped args) -> untyped
|
652
|
+
|
653
|
+
def on_mlhs_add_post: (*untyped args) -> untyped
|
654
|
+
|
655
|
+
def on_mlhs_add_star: (*untyped args) -> untyped
|
656
|
+
|
657
|
+
def on_mlhs_new: (*untyped args) -> untyped
|
658
|
+
|
659
|
+
def on_mlhs_paren: (*untyped args) -> untyped
|
660
|
+
|
661
|
+
def on_module: (*untyped args) -> untyped
|
662
|
+
|
663
|
+
def on_mrhs_add: (*untyped args) -> untyped
|
664
|
+
|
665
|
+
def on_mrhs_add_star: (*untyped args) -> untyped
|
666
|
+
|
667
|
+
def on_mrhs_new: (*untyped args) -> untyped
|
668
|
+
|
669
|
+
def on_mrhs_new_from_args: (*untyped args) -> untyped
|
670
|
+
|
671
|
+
def on_next: (*untyped args) -> untyped
|
672
|
+
|
673
|
+
def on_nl: (untyped tok) -> untyped
|
674
|
+
|
675
|
+
def on_nokw_param: (*untyped args) -> untyped
|
676
|
+
|
677
|
+
def on_op: (untyped tok) -> untyped
|
678
|
+
|
679
|
+
def on_opassign: (*untyped args) -> untyped
|
680
|
+
|
681
|
+
def on_operator_ambiguous: (*untyped args) -> untyped
|
682
|
+
|
683
|
+
def on_param_error: (*untyped args) -> untyped
|
684
|
+
|
685
|
+
def on_params: (*untyped args) -> untyped
|
686
|
+
|
687
|
+
def on_paren: (*untyped args) -> untyped
|
688
|
+
|
689
|
+
alias on_parse_error on_error
|
690
|
+
def on_period: (untyped tok) -> untyped
|
691
|
+
|
692
|
+
def on_program: (*untyped args) -> untyped
|
693
|
+
|
694
|
+
def on_qsymbols_add: (*untyped args) -> untyped
|
695
|
+
|
696
|
+
def on_qsymbols_beg: (untyped tok) -> untyped
|
697
|
+
|
698
|
+
def on_qsymbols_new: (*untyped args) -> untyped
|
699
|
+
|
700
|
+
def on_qwords_add: (*untyped args) -> untyped
|
701
|
+
|
702
|
+
def on_qwords_beg: (untyped tok) -> untyped
|
703
|
+
|
704
|
+
def on_qwords_new: (*untyped args) -> untyped
|
705
|
+
|
706
|
+
def on_rational: (untyped tok) -> untyped
|
707
|
+
|
708
|
+
def on_rbrace: (untyped tok) -> untyped
|
709
|
+
|
710
|
+
def on_rbracket: (untyped tok) -> untyped
|
711
|
+
|
712
|
+
def on_redo: (*untyped args) -> untyped
|
713
|
+
|
714
|
+
def on_regexp_add: (*untyped args) -> untyped
|
715
|
+
|
716
|
+
def on_regexp_beg: (untyped tok) -> untyped
|
717
|
+
|
718
|
+
def on_regexp_end: (untyped tok) -> untyped
|
719
|
+
|
720
|
+
def on_regexp_literal: (*untyped args) -> untyped
|
721
|
+
|
722
|
+
def on_regexp_new: (*untyped args) -> untyped
|
723
|
+
|
724
|
+
def on_rescue: (*untyped args) -> untyped
|
725
|
+
|
726
|
+
def on_rescue_mod: (*untyped args) -> untyped
|
727
|
+
|
728
|
+
def on_rest_param: (*untyped args) -> untyped
|
729
|
+
|
730
|
+
def on_retry: (*untyped args) -> untyped
|
731
|
+
|
732
|
+
def on_return: (*untyped args) -> untyped
|
733
|
+
|
734
|
+
def on_return0: (*untyped args) -> untyped
|
735
|
+
|
736
|
+
def on_rparen: (untyped tok) -> untyped
|
737
|
+
|
738
|
+
def on_sclass: (*untyped args) -> untyped
|
739
|
+
|
740
|
+
def on_semicolon: (untyped tok) -> untyped
|
741
|
+
|
742
|
+
def on_sp: (untyped tok) -> untyped
|
743
|
+
|
744
|
+
def on_stmts_add: (*untyped args) -> untyped
|
745
|
+
|
746
|
+
def on_stmts_new: (*untyped args) -> untyped
|
747
|
+
|
748
|
+
def on_string_add: (*untyped args) -> untyped
|
749
|
+
|
750
|
+
def on_string_concat: (*untyped args) -> untyped
|
751
|
+
|
752
|
+
def on_string_content: (*untyped args) -> untyped
|
753
|
+
|
754
|
+
def on_string_dvar: (*untyped args) -> untyped
|
755
|
+
|
756
|
+
def on_string_embexpr: (*untyped args) -> untyped
|
757
|
+
|
758
|
+
def on_string_literal: (*untyped args) -> untyped
|
759
|
+
|
760
|
+
def on_super: (*untyped args) -> untyped
|
761
|
+
|
762
|
+
def on_symbeg: (untyped tok) -> untyped
|
763
|
+
|
764
|
+
def on_symbol: (*untyped args) -> untyped
|
765
|
+
|
766
|
+
def on_symbol_literal: (*untyped args) -> untyped
|
767
|
+
|
768
|
+
def on_symbols_add: (*untyped args) -> untyped
|
769
|
+
|
770
|
+
def on_symbols_beg: (untyped tok) -> untyped
|
771
|
+
|
772
|
+
def on_symbols_new: (*untyped args) -> untyped
|
773
|
+
|
774
|
+
def on_tlambda: (untyped tok) -> untyped
|
775
|
+
|
776
|
+
def on_tlambeg: (untyped tok) -> untyped
|
777
|
+
|
778
|
+
def on_top_const_field: (*untyped args) -> untyped
|
779
|
+
|
780
|
+
def on_top_const_ref: (*untyped args) -> untyped
|
781
|
+
|
782
|
+
def on_tstring_beg: (untyped tok) -> untyped
|
783
|
+
|
784
|
+
def on_tstring_content: (untyped tok) -> untyped
|
785
|
+
|
786
|
+
def on_tstring_end: (untyped tok) -> untyped
|
787
|
+
|
788
|
+
def on_unary: (*untyped args) -> untyped
|
789
|
+
|
790
|
+
def on_undef: (*untyped args) -> untyped
|
791
|
+
|
792
|
+
def on_unless: (*untyped args) -> untyped
|
793
|
+
|
794
|
+
def on_unless_mod: (*untyped args) -> untyped
|
795
|
+
|
796
|
+
def on_until: (*untyped args) -> untyped
|
797
|
+
|
798
|
+
def on_until_mod: (*untyped args) -> untyped
|
799
|
+
|
800
|
+
def on_var_alias: (*untyped args) -> untyped
|
801
|
+
|
802
|
+
def on_var_field: (*untyped args) -> untyped
|
803
|
+
|
804
|
+
def on_var_ref: (*untyped args) -> untyped
|
805
|
+
|
806
|
+
def on_vcall: (*untyped args) -> untyped
|
807
|
+
|
808
|
+
def on_void_stmt: (*untyped args) -> untyped
|
809
|
+
|
810
|
+
def on_when: (*untyped args) -> untyped
|
811
|
+
|
812
|
+
def on_while: (*untyped args) -> untyped
|
813
|
+
|
814
|
+
def on_while_mod: (*untyped args) -> untyped
|
815
|
+
|
816
|
+
def on_word_add: (*untyped args) -> untyped
|
817
|
+
|
818
|
+
def on_word_new: (*untyped args) -> untyped
|
819
|
+
|
820
|
+
def on_words_add: (*untyped args) -> untyped
|
821
|
+
|
822
|
+
def on_words_beg: (untyped tok) -> untyped
|
823
|
+
|
824
|
+
def on_words_new: (*untyped args) -> untyped
|
825
|
+
|
826
|
+
def on_words_sep: (untyped tok) -> untyped
|
827
|
+
|
828
|
+
def on_xstring_add: (*untyped args) -> untyped
|
829
|
+
|
830
|
+
def on_xstring_literal: (*untyped args) -> untyped
|
831
|
+
|
832
|
+
def on_xstring_new: (*untyped args) -> untyped
|
833
|
+
|
834
|
+
def on_yield: (*untyped args) -> untyped
|
835
|
+
|
836
|
+
def on_yield0: (*untyped args) -> untyped
|
837
|
+
|
838
|
+
def on_zsuper: (*untyped args) -> untyped
|
839
|
+
|
840
|
+
private
|
841
|
+
|
842
|
+
def dedent_element: (untyped e, untyped width) -> untyped
|
843
|
+
|
844
|
+
def on_error: (untyped mesg) -> untyped
|
845
|
+
|
846
|
+
def on_heredoc_dedent: (untyped val, untyped width) -> untyped
|
847
|
+
end
|
848
|
+
|
849
|
+
class SexpBuilderPP < Ripper::SexpBuilder
|
850
|
+
alias on_args_add _dispatch_event_push
|
851
|
+
|
852
|
+
alias on_args_new _dispatch_event_new
|
853
|
+
|
854
|
+
alias on_mlhs_add _dispatch_event_push
|
855
|
+
|
856
|
+
alias on_mlhs_new _dispatch_event_new
|
857
|
+
|
858
|
+
alias on_mrhs_add _dispatch_event_push
|
859
|
+
|
860
|
+
alias on_mrhs_new _dispatch_event_new
|
861
|
+
|
862
|
+
alias on_qsymbols_add _dispatch_event_push
|
863
|
+
|
864
|
+
alias on_qsymbols_new _dispatch_event_new
|
865
|
+
|
866
|
+
alias on_qwords_add _dispatch_event_push
|
867
|
+
|
868
|
+
alias on_qwords_new _dispatch_event_new
|
869
|
+
|
870
|
+
alias on_regexp_add _dispatch_event_push
|
871
|
+
|
872
|
+
alias on_regexp_new _dispatch_event_new
|
873
|
+
|
874
|
+
alias on_stmts_add _dispatch_event_push
|
875
|
+
|
876
|
+
alias on_stmts_new _dispatch_event_new
|
877
|
+
|
878
|
+
alias on_string_add _dispatch_event_push
|
879
|
+
|
880
|
+
alias on_symbols_add _dispatch_event_push
|
881
|
+
|
882
|
+
alias on_symbols_new _dispatch_event_new
|
883
|
+
|
884
|
+
alias on_word_add _dispatch_event_push
|
885
|
+
|
886
|
+
alias on_word_new _dispatch_event_new
|
887
|
+
|
888
|
+
alias on_words_add _dispatch_event_push
|
889
|
+
|
890
|
+
alias on_words_new _dispatch_event_new
|
891
|
+
|
892
|
+
alias on_xstring_add _dispatch_event_push
|
893
|
+
|
894
|
+
alias on_xstring_new _dispatch_event_new
|
895
|
+
|
896
|
+
private
|
897
|
+
|
898
|
+
def _dispatch_event_new: () -> untyped
|
899
|
+
|
900
|
+
def _dispatch_event_push: (untyped list, untyped item) -> untyped
|
901
|
+
|
902
|
+
def on_heredoc_dedent: (untyped val, untyped width) -> untyped
|
903
|
+
|
904
|
+
def on_mlhs_add_post: (untyped list, untyped post) -> untyped
|
905
|
+
|
906
|
+
def on_mlhs_add_star: (untyped list, untyped star) -> untyped
|
907
|
+
|
908
|
+
def on_mlhs_paren: (untyped list) -> untyped
|
909
|
+
end
|
910
|
+
|
911
|
+
class TokenPattern
|
912
|
+
MAP: Hash[String, String]
|
913
|
+
|
914
|
+
class CompileError < Error
|
915
|
+
end
|
916
|
+
class Error < StandardError
|
917
|
+
end
|
918
|
+
|
919
|
+
class MatchData
|
920
|
+
private
|
921
|
+
|
922
|
+
def initialize: (untyped tokens, untyped match) -> void
|
923
|
+
|
924
|
+
public
|
925
|
+
|
926
|
+
def string: (?untyped n) -> untyped
|
927
|
+
|
928
|
+
private
|
929
|
+
|
930
|
+
def match: (?untyped n) -> untyped
|
931
|
+
end
|
932
|
+
class MatchError < Error
|
933
|
+
end
|
934
|
+
alias self.compile self.new
|
935
|
+
|
936
|
+
private
|
937
|
+
|
938
|
+
def initialize: (untyped pattern) -> void
|
939
|
+
|
940
|
+
public
|
941
|
+
|
942
|
+
def match: (untyped str) -> untyped
|
943
|
+
|
944
|
+
def match_list: (untyped tokens) -> untyped
|
945
|
+
|
946
|
+
private
|
947
|
+
|
948
|
+
def compile: (untyped pattern) -> untyped
|
949
|
+
|
950
|
+
def map_token: (untyped tok) -> untyped
|
951
|
+
|
952
|
+
def map_tokens: (untyped tokens) -> untyped
|
953
|
+
end
|
954
|
+
interface _Gets
|
955
|
+
def gets: (?String sep, ?Integer limit) -> String?
|
956
|
+
end
|
957
|
+
|
958
|
+
# <!--
|
959
|
+
# rdoc-file=parse.c
|
960
|
+
# - Ripper.dedent_string(input, width) -> Integer
|
961
|
+
# -->
|
962
|
+
# USE OF RIPPER LIBRARY ONLY.
|
963
|
+
#
|
964
|
+
# Strips up to `width` leading whitespaces from `input`, and returns the
|
965
|
+
# stripped column width.
|
966
|
+
#
|
967
|
+
def self.dedent_string: (String input, int width) -> Integer
|
968
|
+
|
969
|
+
# <!--
|
970
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
971
|
+
# - lex(src, filename = '-', lineno = 1, **kw)
|
972
|
+
# -->
|
973
|
+
# Tokenizes the Ruby program and returns an array of an array, which is
|
974
|
+
# formatted like `[[lineno, column], type, token, state]`. The `filename`
|
975
|
+
# argument is mostly ignored. By default, this method does not handle syntax
|
976
|
+
# errors in `src`, use the `raise_errors` keyword to raise a SyntaxError for an
|
977
|
+
# error in `src`.
|
978
|
+
#
|
979
|
+
# require 'ripper'
|
980
|
+
# require 'pp'
|
981
|
+
#
|
982
|
+
# pp Ripper.lex("def m(a) nil end")
|
983
|
+
# #=> [[[1, 0], :on_kw, "def", FNAME ],
|
984
|
+
# [[1, 3], :on_sp, " ", FNAME ],
|
985
|
+
# [[1, 4], :on_ident, "m", ENDFN ],
|
986
|
+
# [[1, 5], :on_lparen, "(", BEG|LABEL],
|
987
|
+
# [[1, 6], :on_ident, "a", ARG ],
|
988
|
+
# [[1, 7], :on_rparen, ")", ENDFN ],
|
989
|
+
# [[1, 8], :on_sp, " ", BEG ],
|
990
|
+
# [[1, 9], :on_kw, "nil", END ],
|
991
|
+
# [[1, 12], :on_sp, " ", END ],
|
992
|
+
# [[1, 13], :on_kw, "end", END ]]
|
993
|
+
#
|
994
|
+
def self.lex: (String src, ?String filename, ?Integer lineno, ?raise_errors: boolish) -> Array[[ [ Integer, Integer ], Symbol, String, Lexer::State ]]
|
995
|
+
|
996
|
+
# <!--
|
997
|
+
# rdoc-file=parse.c
|
998
|
+
# - Ripper.lex_state_name(integer) -> string
|
999
|
+
# -->
|
1000
|
+
# Returns a string representation of lex_state.
|
1001
|
+
#
|
1002
|
+
def self.lex_state_name: (int) -> String
|
1003
|
+
|
1004
|
+
# <!--
|
1005
|
+
# rdoc-file=ext/ripper/lib/ripper/core.rb
|
1006
|
+
# - parse(src, filename = '(ripper)', lineno = 1)
|
1007
|
+
# -->
|
1008
|
+
# Parses the given Ruby program read from `src`. `src` must be a String or an IO
|
1009
|
+
# or a object with a #gets method.
|
1010
|
+
#
|
1011
|
+
def self.parse: (File | _Gets | String src, ?String filename, ?Integer lineno) -> nil
|
1012
|
+
|
1013
|
+
# <!--
|
1014
|
+
# rdoc-file=ext/ripper/lib/ripper/sexp.rb
|
1015
|
+
# - sexp(src, filename = '-', lineno = 1, raise_errors: false)
|
1016
|
+
# -->
|
1017
|
+
# EXPERIMENTAL
|
1018
|
+
# : Parses `src` and create S-exp tree. Returns more readable tree rather than
|
1019
|
+
# Ripper.sexp_raw. This method is mainly for developer use. The `filename`
|
1020
|
+
# argument is mostly ignored. By default, this method does not handle syntax
|
1021
|
+
# errors in `src`, returning `nil` in such cases. Use the `raise_errors`
|
1022
|
+
# keyword to raise a SyntaxError for an error in `src`.
|
1023
|
+
#
|
1024
|
+
# require 'ripper'
|
1025
|
+
# require 'pp'
|
1026
|
+
#
|
1027
|
+
# pp Ripper.sexp("def m(a) nil end")
|
1028
|
+
# #=> [:program,
|
1029
|
+
# [[:def,
|
1030
|
+
# [:@ident, "m", [1, 4]],
|
1031
|
+
# [:paren, [:params, [[:@ident, "a", [1, 6]]], nil, nil, nil, nil, nil, nil]],
|
1032
|
+
# [:bodystmt, [[:var_ref, [:@kw, "nil", [1, 9]]]], nil, nil, nil]]]]
|
1033
|
+
#
|
1034
|
+
def self.sexp: (File | _Gets | String src, ?String filename, ?Integer lineno, ?raise_errors: boolish) -> Array[untyped]
|
1035
|
+
|
1036
|
+
# <!--
|
1037
|
+
# rdoc-file=ext/ripper/lib/ripper/sexp.rb
|
1038
|
+
# - sexp_raw(src, filename = '-', lineno = 1, raise_errors: false)
|
1039
|
+
# -->
|
1040
|
+
# EXPERIMENTAL
|
1041
|
+
# : Parses `src` and create S-exp tree. This method is mainly for developer
|
1042
|
+
# use. The `filename` argument is mostly ignored. By default, this method
|
1043
|
+
# does not handle syntax errors in `src`, returning `nil` in such cases. Use
|
1044
|
+
# the `raise_errors` keyword to raise a SyntaxError for an error in `src`.
|
1045
|
+
#
|
1046
|
+
# require 'ripper'
|
1047
|
+
# require 'pp'
|
1048
|
+
#
|
1049
|
+
# pp Ripper.sexp_raw("def m(a) nil end")
|
1050
|
+
# #=> [:program,
|
1051
|
+
# [:stmts_add,
|
1052
|
+
# [:stmts_new],
|
1053
|
+
# [:def,
|
1054
|
+
# [:@ident, "m", [1, 4]],
|
1055
|
+
# [:paren, [:params, [[:@ident, "a", [1, 6]]], nil, nil, nil]],
|
1056
|
+
# [:bodystmt,
|
1057
|
+
# [:stmts_add, [:stmts_new], [:var_ref, [:@kw, "nil", [1, 9]]]],
|
1058
|
+
# nil,
|
1059
|
+
# nil,
|
1060
|
+
# nil]]]]
|
1061
|
+
#
|
1062
|
+
def self.sexp_raw: (File | _Gets | String src, ?String filename, ?Integer lineno, ?raise_errors: boolish) -> Array[untyped]
|
1063
|
+
|
1064
|
+
# <!--
|
1065
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
1066
|
+
# - slice(src, pattern, n = 0)
|
1067
|
+
# -->
|
1068
|
+
# EXPERIMENTAL
|
1069
|
+
# : Parses `src` and return a string which was matched to `pattern`. `pattern`
|
1070
|
+
# should be described as Regexp.
|
1071
|
+
#
|
1072
|
+
# require 'ripper'
|
1073
|
+
#
|
1074
|
+
# p Ripper.slice('def m(a) nil end', 'ident') #=> "m"
|
1075
|
+
# p Ripper.slice('def m(a) nil end', '[ident lparen rparen]+') #=> "m(a)"
|
1076
|
+
# p Ripper.slice("<<EOS\nstring\nEOS",
|
1077
|
+
# 'heredoc_beg nl $(tstring_content*) heredoc_end', 1)
|
1078
|
+
# #=> "string\n"
|
1079
|
+
#
|
1080
|
+
def self.slice: (String src, String pattern, ?Integer n) -> String?
|
1081
|
+
|
1082
|
+
def self.token_match: (String src, String pattern) -> Ripper::TokenPattern::MatchData?
|
1083
|
+
|
1084
|
+
# <!--
|
1085
|
+
# rdoc-file=ext/ripper/lib/ripper/lexer.rb
|
1086
|
+
# - tokenize(src, filename = '-', lineno = 1, **kw)
|
1087
|
+
# -->
|
1088
|
+
# Tokenizes the Ruby program and returns an array of strings. The `filename` and
|
1089
|
+
# `lineno` arguments are mostly ignored, since the return value is just the
|
1090
|
+
# tokenized input. By default, this method does not handle syntax errors in
|
1091
|
+
# `src`, use the `raise_errors` keyword to raise a SyntaxError for an error in
|
1092
|
+
# `src`.
|
1093
|
+
#
|
1094
|
+
# p Ripper.tokenize("def m(a) nil end")
|
1095
|
+
# # => ["def", " ", "m", "(", "a", ")", " ", "nil", " ", "end"]
|
1096
|
+
#
|
1097
|
+
def self.tokenize: (File | _Gets | String src, ?String filename, ?Integer lineno, ?raise_errors: boolish) -> Array[String]
|
1098
|
+
|
1099
|
+
private
|
1100
|
+
|
1101
|
+
# <!--
|
1102
|
+
# rdoc-file=parse.c
|
1103
|
+
# - Ripper.new(src, filename="(ripper)", lineno=1) -> ripper
|
1104
|
+
# -->
|
1105
|
+
# Create a new Ripper object. *src* must be a String, an IO, or an Object which
|
1106
|
+
# has #gets method.
|
1107
|
+
#
|
1108
|
+
# This method does not starts parsing. See also Ripper#parse and Ripper.parse.
|
1109
|
+
#
|
1110
|
+
def initialize: (File | _Gets | String src, ?String filename, ?Integer lineno) -> void
|
1111
|
+
|
1112
|
+
public
|
1113
|
+
|
1114
|
+
# <!--
|
1115
|
+
# rdoc-file=parse.c
|
1116
|
+
# - ripper.column -> Integer
|
1117
|
+
# -->
|
1118
|
+
# Return column number of current parsing line. This number starts from 0.
|
1119
|
+
#
|
1120
|
+
def column: () -> Integer?
|
1121
|
+
|
1122
|
+
# <!--
|
1123
|
+
# rdoc-file=parse.c
|
1124
|
+
# - ripper.debug_output -> obj
|
1125
|
+
# -->
|
1126
|
+
# Get debug output.
|
1127
|
+
#
|
1128
|
+
def debug_output: () -> untyped
|
1129
|
+
|
1130
|
+
# <!--
|
1131
|
+
# rdoc-file=parse.c
|
1132
|
+
# - ripper.debug_output = obj
|
1133
|
+
# -->
|
1134
|
+
# Set debug output.
|
1135
|
+
#
|
1136
|
+
def debug_output=: (untyped) -> untyped
|
1137
|
+
|
1138
|
+
# <!--
|
1139
|
+
# rdoc-file=parse.c
|
1140
|
+
# - ripper.encoding -> encoding
|
1141
|
+
# -->
|
1142
|
+
# Return encoding of the source.
|
1143
|
+
#
|
1144
|
+
def encoding: () -> Encoding
|
1145
|
+
|
1146
|
+
# <!--
|
1147
|
+
# rdoc-file=parse.c
|
1148
|
+
# - ripper.end_seen? -> Boolean
|
1149
|
+
# -->
|
1150
|
+
# Return true if parsed source ended by +_*END*_+.
|
1151
|
+
#
|
1152
|
+
def end_seen?: () -> bool
|
1153
|
+
|
1154
|
+
# <!--
|
1155
|
+
# rdoc-file=parse.c
|
1156
|
+
# - ripper.error? -> Boolean
|
1157
|
+
# -->
|
1158
|
+
# Return true if parsed source has errors.
|
1159
|
+
#
|
1160
|
+
def error?: () -> bool
|
1161
|
+
|
1162
|
+
# <!--
|
1163
|
+
# rdoc-file=parse.c
|
1164
|
+
# - ripper.filename -> String
|
1165
|
+
# -->
|
1166
|
+
# Return current parsing filename.
|
1167
|
+
#
|
1168
|
+
def filename: () -> String
|
1169
|
+
|
1170
|
+
# <!--
|
1171
|
+
# rdoc-file=parse.c
|
1172
|
+
# - ripper.lineno -> Integer
|
1173
|
+
# -->
|
1174
|
+
# Return line number of current parsing line. This number starts from 1.
|
1175
|
+
#
|
1176
|
+
def lineno: () -> Integer?
|
1177
|
+
|
1178
|
+
alias on_BEGIN _dispatch_1
|
1179
|
+
|
1180
|
+
alias on_CHAR _dispatch_1
|
1181
|
+
|
1182
|
+
alias on_END _dispatch_1
|
1183
|
+
|
1184
|
+
alias on___end__ _dispatch_1
|
1185
|
+
|
1186
|
+
alias on_alias _dispatch_2
|
1187
|
+
|
1188
|
+
alias on_alias_error _dispatch_2
|
1189
|
+
|
1190
|
+
alias on_aref _dispatch_2
|
1191
|
+
|
1192
|
+
alias on_aref_field _dispatch_2
|
1193
|
+
|
1194
|
+
alias on_arg_ambiguous _dispatch_1
|
1195
|
+
|
1196
|
+
alias on_arg_paren _dispatch_1
|
1197
|
+
|
1198
|
+
alias on_args_add _dispatch_2
|
1199
|
+
|
1200
|
+
alias on_args_add_block _dispatch_2
|
1201
|
+
|
1202
|
+
alias on_args_add_star _dispatch_2
|
1203
|
+
|
1204
|
+
alias on_args_forward _dispatch_0
|
1205
|
+
|
1206
|
+
alias on_args_new _dispatch_0
|
1207
|
+
|
1208
|
+
alias on_array _dispatch_1
|
1209
|
+
|
1210
|
+
alias on_aryptn _dispatch_4
|
1211
|
+
|
1212
|
+
alias on_assign _dispatch_2
|
1213
|
+
|
1214
|
+
alias on_assign_error _dispatch_2
|
1215
|
+
|
1216
|
+
alias on_assoc_new _dispatch_2
|
1217
|
+
|
1218
|
+
alias on_assoc_splat _dispatch_1
|
1219
|
+
|
1220
|
+
alias on_assoclist_from_args _dispatch_1
|
1221
|
+
|
1222
|
+
alias on_backref _dispatch_1
|
1223
|
+
|
1224
|
+
alias on_backtick _dispatch_1
|
1225
|
+
|
1226
|
+
alias on_bare_assoc_hash _dispatch_1
|
1227
|
+
|
1228
|
+
alias on_begin _dispatch_1
|
1229
|
+
|
1230
|
+
alias on_binary _dispatch_3
|
1231
|
+
|
1232
|
+
alias on_block_var _dispatch_2
|
1233
|
+
|
1234
|
+
alias on_blockarg _dispatch_1
|
1235
|
+
|
1236
|
+
alias on_bodystmt _dispatch_4
|
1237
|
+
|
1238
|
+
alias on_brace_block _dispatch_2
|
1239
|
+
|
1240
|
+
alias on_break _dispatch_1
|
1241
|
+
|
1242
|
+
alias on_call _dispatch_3
|
1243
|
+
|
1244
|
+
alias on_case _dispatch_2
|
1245
|
+
|
1246
|
+
alias on_class _dispatch_3
|
1247
|
+
|
1248
|
+
alias on_class_name_error _dispatch_2
|
1249
|
+
|
1250
|
+
alias on_comma _dispatch_1
|
1251
|
+
|
1252
|
+
alias on_command _dispatch_2
|
1253
|
+
|
1254
|
+
alias on_command_call _dispatch_4
|
1255
|
+
|
1256
|
+
alias on_comment _dispatch_1
|
1257
|
+
|
1258
|
+
alias on_const _dispatch_1
|
1259
|
+
|
1260
|
+
alias on_const_path_field _dispatch_2
|
1261
|
+
|
1262
|
+
alias on_const_path_ref _dispatch_2
|
1263
|
+
|
1264
|
+
alias on_const_ref _dispatch_1
|
1265
|
+
|
1266
|
+
alias on_cvar _dispatch_1
|
1267
|
+
|
1268
|
+
alias on_def _dispatch_3
|
1269
|
+
|
1270
|
+
alias on_defined _dispatch_1
|
1271
|
+
|
1272
|
+
alias on_defs _dispatch_5
|
1273
|
+
|
1274
|
+
alias on_do_block _dispatch_2
|
1275
|
+
|
1276
|
+
alias on_dot2 _dispatch_2
|
1277
|
+
|
1278
|
+
alias on_dot3 _dispatch_2
|
1279
|
+
|
1280
|
+
alias on_dyna_symbol _dispatch_1
|
1281
|
+
|
1282
|
+
alias on_else _dispatch_1
|
1283
|
+
|
1284
|
+
alias on_elsif _dispatch_3
|
1285
|
+
|
1286
|
+
alias on_embdoc _dispatch_1
|
1287
|
+
|
1288
|
+
alias on_embdoc_beg _dispatch_1
|
1289
|
+
|
1290
|
+
alias on_embdoc_end _dispatch_1
|
1291
|
+
|
1292
|
+
alias on_embexpr_beg _dispatch_1
|
1293
|
+
|
1294
|
+
alias on_embexpr_end _dispatch_1
|
1295
|
+
|
1296
|
+
alias on_embvar _dispatch_1
|
1297
|
+
|
1298
|
+
alias on_ensure _dispatch_1
|
1299
|
+
|
1300
|
+
alias on_excessed_comma _dispatch_0
|
1301
|
+
|
1302
|
+
alias on_fcall _dispatch_1
|
1303
|
+
|
1304
|
+
alias on_field _dispatch_3
|
1305
|
+
|
1306
|
+
alias on_float _dispatch_1
|
1307
|
+
|
1308
|
+
alias on_fndptn _dispatch_4
|
1309
|
+
|
1310
|
+
alias on_for _dispatch_3
|
1311
|
+
|
1312
|
+
alias on_gvar _dispatch_1
|
1313
|
+
|
1314
|
+
alias on_hash _dispatch_1
|
1315
|
+
|
1316
|
+
alias on_heredoc_beg _dispatch_1
|
1317
|
+
|
1318
|
+
alias on_heredoc_dedent _dispatch_2
|
1319
|
+
|
1320
|
+
alias on_heredoc_end _dispatch_1
|
1321
|
+
|
1322
|
+
alias on_hshptn _dispatch_3
|
1323
|
+
|
1324
|
+
alias on_ident _dispatch_1
|
1325
|
+
|
1326
|
+
alias on_if _dispatch_3
|
1327
|
+
|
1328
|
+
alias on_if_mod _dispatch_2
|
1329
|
+
|
1330
|
+
alias on_ifop _dispatch_3
|
1331
|
+
|
1332
|
+
alias on_ignored_nl _dispatch_1
|
1333
|
+
|
1334
|
+
alias on_imaginary _dispatch_1
|
1335
|
+
|
1336
|
+
alias on_in _dispatch_3
|
1337
|
+
|
1338
|
+
alias on_int _dispatch_1
|
1339
|
+
|
1340
|
+
alias on_ivar _dispatch_1
|
1341
|
+
|
1342
|
+
alias on_kw _dispatch_1
|
1343
|
+
|
1344
|
+
alias on_kwrest_param _dispatch_1
|
1345
|
+
|
1346
|
+
alias on_label _dispatch_1
|
1347
|
+
|
1348
|
+
alias on_label_end _dispatch_1
|
1349
|
+
|
1350
|
+
alias on_lambda _dispatch_2
|
1351
|
+
|
1352
|
+
alias on_lbrace _dispatch_1
|
1353
|
+
|
1354
|
+
alias on_lbracket _dispatch_1
|
1355
|
+
|
1356
|
+
alias on_lparen _dispatch_1
|
1357
|
+
|
1358
|
+
alias on_magic_comment _dispatch_2
|
1359
|
+
|
1360
|
+
alias on_massign _dispatch_2
|
1361
|
+
|
1362
|
+
alias on_method_add_arg _dispatch_2
|
1363
|
+
|
1364
|
+
alias on_method_add_block _dispatch_2
|
1365
|
+
|
1366
|
+
alias on_mlhs_add _dispatch_2
|
1367
|
+
|
1368
|
+
alias on_mlhs_add_post _dispatch_2
|
1369
|
+
|
1370
|
+
alias on_mlhs_add_star _dispatch_2
|
1371
|
+
|
1372
|
+
alias on_mlhs_new _dispatch_0
|
1373
|
+
|
1374
|
+
alias on_mlhs_paren _dispatch_1
|
1375
|
+
|
1376
|
+
alias on_module _dispatch_2
|
1377
|
+
|
1378
|
+
alias on_mrhs_add _dispatch_2
|
1379
|
+
|
1380
|
+
alias on_mrhs_add_star _dispatch_2
|
1381
|
+
|
1382
|
+
alias on_mrhs_new _dispatch_0
|
1383
|
+
|
1384
|
+
alias on_mrhs_new_from_args _dispatch_1
|
1385
|
+
|
1386
|
+
alias on_next _dispatch_1
|
1387
|
+
|
1388
|
+
alias on_nl _dispatch_1
|
1389
|
+
|
1390
|
+
alias on_nokw_param _dispatch_1
|
1391
|
+
|
1392
|
+
alias on_op _dispatch_1
|
1393
|
+
|
1394
|
+
alias on_opassign _dispatch_3
|
1395
|
+
|
1396
|
+
alias on_operator_ambiguous _dispatch_2
|
1397
|
+
|
1398
|
+
alias on_param_error _dispatch_2
|
1399
|
+
|
1400
|
+
alias on_params _dispatch_7
|
1401
|
+
|
1402
|
+
alias on_paren _dispatch_1
|
1403
|
+
|
1404
|
+
alias on_parse_error _dispatch_1
|
1405
|
+
|
1406
|
+
alias on_period _dispatch_1
|
1407
|
+
|
1408
|
+
alias on_program _dispatch_1
|
1409
|
+
|
1410
|
+
alias on_qsymbols_add _dispatch_2
|
1411
|
+
|
1412
|
+
alias on_qsymbols_beg _dispatch_1
|
1413
|
+
|
1414
|
+
alias on_qsymbols_new _dispatch_0
|
1415
|
+
|
1416
|
+
alias on_qwords_add _dispatch_2
|
1417
|
+
|
1418
|
+
alias on_qwords_beg _dispatch_1
|
1419
|
+
|
1420
|
+
alias on_qwords_new _dispatch_0
|
1421
|
+
|
1422
|
+
alias on_rational _dispatch_1
|
1423
|
+
|
1424
|
+
alias on_rbrace _dispatch_1
|
1425
|
+
|
1426
|
+
alias on_rbracket _dispatch_1
|
1427
|
+
|
1428
|
+
alias on_redo _dispatch_0
|
1429
|
+
|
1430
|
+
alias on_regexp_add _dispatch_2
|
1431
|
+
|
1432
|
+
alias on_regexp_beg _dispatch_1
|
1433
|
+
|
1434
|
+
alias on_regexp_end _dispatch_1
|
1435
|
+
|
1436
|
+
alias on_regexp_literal _dispatch_2
|
1437
|
+
|
1438
|
+
alias on_regexp_new _dispatch_0
|
1439
|
+
|
1440
|
+
alias on_rescue _dispatch_4
|
1441
|
+
|
1442
|
+
alias on_rescue_mod _dispatch_2
|
1443
|
+
|
1444
|
+
alias on_rest_param _dispatch_1
|
1445
|
+
|
1446
|
+
alias on_retry _dispatch_0
|
1447
|
+
|
1448
|
+
alias on_return _dispatch_1
|
1449
|
+
|
1450
|
+
alias on_return0 _dispatch_0
|
1451
|
+
|
1452
|
+
alias on_rparen _dispatch_1
|
1453
|
+
|
1454
|
+
alias on_sclass _dispatch_2
|
1455
|
+
|
1456
|
+
alias on_semicolon _dispatch_1
|
1457
|
+
|
1458
|
+
alias on_sp _dispatch_1
|
1459
|
+
|
1460
|
+
alias on_stmts_add _dispatch_2
|
1461
|
+
|
1462
|
+
alias on_stmts_new _dispatch_0
|
1463
|
+
|
1464
|
+
alias on_string_add _dispatch_2
|
1465
|
+
|
1466
|
+
alias on_string_concat _dispatch_2
|
1467
|
+
|
1468
|
+
alias on_string_content _dispatch_0
|
1469
|
+
|
1470
|
+
alias on_string_dvar _dispatch_1
|
1471
|
+
|
1472
|
+
alias on_string_embexpr _dispatch_1
|
1473
|
+
|
1474
|
+
alias on_string_literal _dispatch_1
|
1475
|
+
|
1476
|
+
alias on_super _dispatch_1
|
1477
|
+
|
1478
|
+
alias on_symbeg _dispatch_1
|
1479
|
+
|
1480
|
+
alias on_symbol _dispatch_1
|
1481
|
+
|
1482
|
+
alias on_symbol_literal _dispatch_1
|
1483
|
+
|
1484
|
+
alias on_symbols_add _dispatch_2
|
1485
|
+
|
1486
|
+
alias on_symbols_beg _dispatch_1
|
1487
|
+
|
1488
|
+
alias on_symbols_new _dispatch_0
|
1489
|
+
|
1490
|
+
alias on_tlambda _dispatch_1
|
1491
|
+
|
1492
|
+
alias on_tlambeg _dispatch_1
|
1493
|
+
|
1494
|
+
alias on_top_const_field _dispatch_1
|
1495
|
+
|
1496
|
+
alias on_top_const_ref _dispatch_1
|
1497
|
+
|
1498
|
+
alias on_tstring_beg _dispatch_1
|
1499
|
+
|
1500
|
+
alias on_tstring_content _dispatch_1
|
1501
|
+
|
1502
|
+
alias on_tstring_end _dispatch_1
|
1503
|
+
|
1504
|
+
alias on_unary _dispatch_2
|
1505
|
+
|
1506
|
+
alias on_undef _dispatch_1
|
1507
|
+
|
1508
|
+
alias on_unless _dispatch_3
|
1509
|
+
|
1510
|
+
alias on_unless_mod _dispatch_2
|
1511
|
+
|
1512
|
+
alias on_until _dispatch_2
|
1513
|
+
|
1514
|
+
alias on_until_mod _dispatch_2
|
1515
|
+
|
1516
|
+
alias on_var_alias _dispatch_2
|
1517
|
+
|
1518
|
+
alias on_var_field _dispatch_1
|
1519
|
+
|
1520
|
+
alias on_var_ref _dispatch_1
|
1521
|
+
|
1522
|
+
alias on_vcall _dispatch_1
|
1523
|
+
|
1524
|
+
alias on_void_stmt _dispatch_0
|
1525
|
+
|
1526
|
+
alias on_when _dispatch_3
|
1527
|
+
|
1528
|
+
alias on_while _dispatch_2
|
1529
|
+
|
1530
|
+
alias on_while_mod _dispatch_2
|
1531
|
+
|
1532
|
+
alias on_word_add _dispatch_2
|
1533
|
+
|
1534
|
+
alias on_word_new _dispatch_0
|
1535
|
+
|
1536
|
+
alias on_words_add _dispatch_2
|
1537
|
+
|
1538
|
+
alias on_words_beg _dispatch_1
|
1539
|
+
|
1540
|
+
alias on_words_new _dispatch_0
|
1541
|
+
|
1542
|
+
alias on_words_sep _dispatch_1
|
1543
|
+
|
1544
|
+
alias on_xstring_add _dispatch_2
|
1545
|
+
|
1546
|
+
alias on_xstring_literal _dispatch_1
|
1547
|
+
|
1548
|
+
alias on_xstring_new _dispatch_0
|
1549
|
+
|
1550
|
+
alias on_yield _dispatch_1
|
1551
|
+
|
1552
|
+
alias on_yield0 _dispatch_0
|
1553
|
+
|
1554
|
+
alias on_zsuper _dispatch_0
|
1555
|
+
|
1556
|
+
# <!--
|
1557
|
+
# rdoc-file=parse.c
|
1558
|
+
# - ripper.parse
|
1559
|
+
# -->
|
1560
|
+
# Start parsing and returns the value of the root action.
|
1561
|
+
#
|
1562
|
+
def parse: () -> nil
|
1563
|
+
|
1564
|
+
# <!--
|
1565
|
+
# rdoc-file=parse.c
|
1566
|
+
# - ripper.state -> Integer
|
1567
|
+
# -->
|
1568
|
+
# Return scanner state of current token.
|
1569
|
+
#
|
1570
|
+
def state: () -> Integer?
|
1571
|
+
|
1572
|
+
# <!--
|
1573
|
+
# rdoc-file=parse.c
|
1574
|
+
# - ripper.token -> String
|
1575
|
+
# -->
|
1576
|
+
# Return the current token string.
|
1577
|
+
#
|
1578
|
+
def token: () -> String?
|
1579
|
+
|
1580
|
+
# <!--
|
1581
|
+
# rdoc-file=parse.c
|
1582
|
+
# - ripper.yydebug -> true or false
|
1583
|
+
# -->
|
1584
|
+
# Get yydebug.
|
1585
|
+
#
|
1586
|
+
def yydebug: () -> bool
|
1587
|
+
|
1588
|
+
# <!--
|
1589
|
+
# rdoc-file=parse.c
|
1590
|
+
# - ripper.yydebug = flag
|
1591
|
+
# -->
|
1592
|
+
# Set yydebug.
|
1593
|
+
#
|
1594
|
+
def yydebug=: (bool) -> bool
|
1595
|
+
|
1596
|
+
private
|
1597
|
+
|
1598
|
+
def _dispatch_0: () -> void
|
1599
|
+
|
1600
|
+
def _dispatch_1: (untyped a) -> void
|
1601
|
+
|
1602
|
+
def _dispatch_2: (untyped a, untyped b) -> void
|
1603
|
+
|
1604
|
+
def _dispatch_3: (untyped a, untyped b, untyped c) -> void
|
1605
|
+
|
1606
|
+
def _dispatch_4: (untyped a, untyped b, untyped c, untyped d) -> void
|
1607
|
+
|
1608
|
+
def _dispatch_5: (untyped a, untyped b, untyped c, untyped d, untyped e) -> void
|
1609
|
+
|
1610
|
+
def _dispatch_6: (untyped a, untyped b, untyped c, untyped d, untyped e, untyped f) -> void
|
1611
|
+
|
1612
|
+
def _dispatch_7: (untyped a, untyped b, untyped c, untyped d, untyped e, untyped f, untyped g) -> void
|
1613
|
+
|
1614
|
+
# <!--
|
1615
|
+
# rdoc-file=ext/ripper/lib/ripper/core.rb
|
1616
|
+
# - compile_error(msg)
|
1617
|
+
# -->
|
1618
|
+
# This method is called when the parser found syntax error.
|
1619
|
+
#
|
1620
|
+
def compile_error: (untyped msg) -> untyped
|
1621
|
+
|
1622
|
+
# <!--
|
1623
|
+
# rdoc-file=parse.c
|
1624
|
+
# - Ripper.dedent_string(input, width) -> Integer
|
1625
|
+
# -->
|
1626
|
+
# USE OF RIPPER LIBRARY ONLY.
|
1627
|
+
#
|
1628
|
+
# Strips up to `width` leading whitespaces from `input`, and returns the
|
1629
|
+
# stripped column width.
|
1630
|
+
#
|
1631
|
+
def dedent_string: (String input, Integer width) -> Integer
|
1632
|
+
|
1633
|
+
# <!--
|
1634
|
+
# rdoc-file=ext/ripper/lib/ripper/core.rb
|
1635
|
+
# - warn(fmt, *args)
|
1636
|
+
# -->
|
1637
|
+
# This method is called when weak warning is produced by the parser. `fmt` and
|
1638
|
+
# `args` is printf style.
|
1639
|
+
#
|
1640
|
+
def warn: (untyped fmt, *untyped args) -> untyped
|
1641
|
+
|
1642
|
+
# <!--
|
1643
|
+
# rdoc-file=ext/ripper/lib/ripper/core.rb
|
1644
|
+
# - warning(fmt, *args)
|
1645
|
+
# -->
|
1646
|
+
# This method is called when strong warning is produced by the parser. `fmt` and
|
1647
|
+
# `args` is printf style.
|
1648
|
+
#
|
1649
|
+
def warning: (untyped fmt, *untyped args) -> untyped
|
1650
|
+
end
|