optimistic-json 0.1.2 → 0.1.3

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +6 -0
  4. data/Rakefile +5 -1
  5. data/lib/optimistic/json/parser.rb +28 -7
  6. data/lib/optimistic/json/version.rb +2 -1
  7. data/lib/optimistic/json.rb +1 -0
  8. data/sorbet/config +4 -0
  9. data/sorbet/rbi/annotations/.gitattributes +1 -0
  10. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  11. data/sorbet/rbi/gems/.gitattributes +1 -0
  12. data/sorbet/rbi/gems/ast@2.4.2.rbi +550 -0
  13. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +621 -0
  14. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1068 -0
  15. data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
  16. data/sorbet/rbi/gems/gem-release@2.2.2.rbi +1335 -0
  17. data/sorbet/rbi/gems/io-console@0.6.0.rbi +9 -0
  18. data/sorbet/rbi/gems/json@2.7.0.rbi +1797 -0
  19. data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +12986 -0
  20. data/sorbet/rbi/gems/logger@1.6.0.rbi +845 -0
  21. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +218 -0
  22. data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
  23. data/sorbet/rbi/gems/parallel@1.28.0.rbi +270 -0
  24. data/sorbet/rbi/gems/parser@3.2.2.4.rbi +5154 -0
  25. data/sorbet/rbi/gems/prism@1.9.0.rbi +42224 -0
  26. data/sorbet/rbi/gems/psych@5.1.1.1.rbi +2321 -0
  27. data/sorbet/rbi/gems/racc@1.7.3.rbi +169 -0
  28. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
  29. data/sorbet/rbi/gems/rake@13.1.0.rbi +3025 -0
  30. data/sorbet/rbi/gems/rbi@0.3.11.rbi +5505 -0
  31. data/sorbet/rbi/gems/rbs@4.0.2.rbi +6908 -0
  32. data/sorbet/rbi/gems/rdoc@6.6.0.rbi +9 -0
  33. data/sorbet/rbi/gems/regexp_parser@2.8.2.rbi +3268 -0
  34. data/sorbet/rbi/gems/reline@0.4.1.rbi +9 -0
  35. data/sorbet/rbi/gems/require-hooks@0.4.0.rbi +152 -0
  36. data/sorbet/rbi/gems/rexml@3.2.6.rbi +4798 -0
  37. data/sorbet/rbi/gems/rspec-core@3.12.2.rbi +9405 -0
  38. data/sorbet/rbi/gems/rspec-expectations@3.12.3.rbi +6013 -0
  39. data/sorbet/rbi/gems/rspec-mocks@3.12.6.rbi +4750 -0
  40. data/sorbet/rbi/gems/rspec-support@3.12.1.rbi +1261 -0
  41. data/sorbet/rbi/gems/rspec@3.12.0.rbi +15 -0
  42. data/sorbet/rbi/gems/rubocop-ast@1.30.0.rbi +6750 -0
  43. data/sorbet/rbi/gems/rubocop-capybara@2.19.0.rbi +1058 -0
  44. data/sorbet/rbi/gems/rubocop-factory_bot@2.24.0.rbi +875 -0
  45. data/sorbet/rbi/gems/rubocop-rspec@2.25.0.rbi +7696 -0
  46. data/sorbet/rbi/gems/rubocop@1.58.0.rbi +53790 -0
  47. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  48. data/sorbet/rbi/gems/rubydex@0.2.3.rbi +787 -0
  49. data/sorbet/rbi/gems/spoom@1.7.14.rbi +6151 -0
  50. data/sorbet/rbi/gems/stringio@3.1.0.rbi +9 -0
  51. data/sorbet/rbi/gems/tapioca@0.19.1.rbi +3558 -0
  52. data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
  53. data/sorbet/rbi/gems/tsort@0.2.0.rbi +387 -0
  54. data/sorbet/rbi/gems/unicode-display_width@2.5.0.rbi +64 -0
  55. data/sorbet/tapioca/config.yml +13 -0
  56. data/sorbet/tapioca/require.rb +4 -0
  57. metadata +54 -22
  58. data/sig/optimistic/json.rbs +0 -6
@@ -0,0 +1,550 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `ast` gem.
5
+ # Please instead update this file by running `bin/tapioca gem ast`.
6
+
7
+
8
+ # {AST} is a library for manipulating abstract syntax trees.
9
+ #
10
+ # It embraces immutability; each AST node is inherently frozen at
11
+ # creation, and updating a child node requires recreating that node
12
+ # and its every parent, recursively.
13
+ # This is a design choice. It does create some pressure on
14
+ # garbage collector, but completely eliminates all concurrency
15
+ # and aliasing problems.
16
+ #
17
+ # See also {AST::Node}, {AST::Processor::Mixin} and {AST::Sexp} for
18
+ # additional recommendations and design patterns.
19
+ #
20
+ # pkg:gem/ast#lib/ast.rb:13
21
+ module AST; end
22
+
23
+ # Node is an immutable class, instances of which represent abstract
24
+ # syntax tree nodes. It combines semantic information (i.e. anything
25
+ # that affects the algorithmic properties of a program) with
26
+ # meta-information (line numbers or compiler intermediates).
27
+ #
28
+ # Notes on inheritance
29
+ # ====================
30
+ #
31
+ # The distinction between semantics and metadata is important. Complete
32
+ # semantic information should be contained within just the {#type} and
33
+ # {#children} of a Node instance; in other words, if an AST was to be
34
+ # stripped of all meta-information, it should remain a valid AST which
35
+ # could be successfully processed to yield a result with the same
36
+ # algorithmic properties.
37
+ #
38
+ # Thus, Node should never be inherited in order to define methods which
39
+ # affect or return semantic information, such as getters for `class_name`,
40
+ # `superclass` and `body` in the case of a hypothetical `ClassNode`. The
41
+ # correct solution is to use a generic Node with a {#type} of `:class`
42
+ # and three children. See also {Processor} for tips on working with such
43
+ # ASTs.
44
+ #
45
+ # On the other hand, Node can and should be inherited to define
46
+ # application-specific metadata (see also {#initialize}) or customize the
47
+ # printing format. It is expected that an application would have one or two
48
+ # such classes and use them across the entire codebase.
49
+ #
50
+ # The rationale for this pattern is extensibility and maintainability.
51
+ # Unlike static ones, dynamic languages do not require the presence of a
52
+ # predefined, rigid structure, nor does it improve dispatch efficiency,
53
+ # and while such a structure can certainly be defined, it does not add
54
+ # any value but incurs a maintaining cost.
55
+ # For example, extending the AST even with a transformation-local
56
+ # temporary node type requires making globally visible changes to
57
+ # the codebase.
58
+ #
59
+ # pkg:gem/ast#lib/ast/node.rb:40
60
+ class AST::Node
61
+ # Constructs a new instance of Node.
62
+ #
63
+ # The arguments `type` and `children` are converted with `to_sym` and
64
+ # `to_a` respectively. Additionally, the result of converting `children`
65
+ # is frozen. While mutating the arguments is generally considered harmful,
66
+ # the most common case is to pass an array literal to the constructor. If
67
+ # your code does not expect the argument to be frozen, use `#dup`.
68
+ #
69
+ # The `properties` hash is passed to {#assign_properties}.
70
+ #
71
+ # pkg:gem/ast#lib/ast/node.rb:72
72
+ def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end
73
+
74
+ # pkg:gem/ast#lib/ast/node.rb:172
75
+ def +(array); end
76
+
77
+ # pkg:gem/ast#lib/ast/node.rb:181
78
+ def <<(element); end
79
+
80
+ # Compares `self` to `other`, possibly converting with `to_ast`. Only
81
+ # `type` and `children` are compared; metadata is deliberately ignored.
82
+ #
83
+ # @return [Boolean]
84
+ #
85
+ # pkg:gem/ast#lib/ast/node.rb:153
86
+ def ==(other); end
87
+
88
+ # Appends `element` to `children` and returns the resulting node.
89
+ #
90
+ # @return [AST::Node]
91
+ #
92
+ # pkg:gem/ast#lib/ast/node.rb:177
93
+ def append(element); end
94
+
95
+ # Returns the children of this node.
96
+ # The returned value is frozen.
97
+ # The to_a alias is useful for decomposing nodes concisely.
98
+ # For example:
99
+ #
100
+ # node = s(:gasgn, :$foo, s(:integer, 1))
101
+ # var_name, value = *node
102
+ # p var_name # => :$foo
103
+ # p value # => (integer 1)
104
+ #
105
+ # @return [Array]
106
+ #
107
+ # pkg:gem/ast#lib/ast/node.rb:56
108
+ def children; end
109
+
110
+ # pkg:gem/ast#lib/ast/node.rb:118
111
+ def clone; end
112
+
113
+ # Concatenates `array` with `children` and returns the resulting node.
114
+ #
115
+ # @return [AST::Node]
116
+ #
117
+ # pkg:gem/ast#lib/ast/node.rb:168
118
+ def concat(array); end
119
+
120
+ # Enables matching for Node, where type is the first element
121
+ # and the children are remaining items.
122
+ #
123
+ # @return [Array]
124
+ #
125
+ # pkg:gem/ast#lib/ast/node.rb:253
126
+ def deconstruct; end
127
+
128
+ # Nodes are already frozen, so there is no harm in returning the
129
+ # current node as opposed to initializing from scratch and freezing
130
+ # another one.
131
+ #
132
+ # @return self
133
+ #
134
+ # pkg:gem/ast#lib/ast/node.rb:115
135
+ def dup; end
136
+
137
+ # Test if other object is equal to
138
+ # @param [Object] other
139
+ # @return [Boolean]
140
+ #
141
+ # pkg:gem/ast#lib/ast/node.rb:85
142
+ def eql?(other); end
143
+
144
+ # Returns the precomputed hash value for this node
145
+ # @return [Fixnum]
146
+ #
147
+ # pkg:gem/ast#lib/ast/node.rb:61
148
+ def hash; end
149
+
150
+ # Converts `self` to a s-expression ruby string.
151
+ # The code return will recreate the node, using the sexp module s()
152
+ #
153
+ # @param [Integer] indent Base indentation level.
154
+ # @return [String]
155
+ #
156
+ # pkg:gem/ast#lib/ast/node.rb:211
157
+ def inspect(indent = T.unsafe(nil)); end
158
+
159
+ # pkg:gem/ast#lib/ast/node.rb:57
160
+ def to_a; end
161
+
162
+ # @return [AST::Node] self
163
+ #
164
+ # pkg:gem/ast#lib/ast/node.rb:229
165
+ def to_ast; end
166
+
167
+ # pkg:gem/ast#lib/ast/node.rb:204
168
+ def to_s(indent = T.unsafe(nil)); end
169
+
170
+ # Converts `self` to a pretty-printed s-expression.
171
+ #
172
+ # @param [Integer] indent Base indentation level.
173
+ # @return [String]
174
+ #
175
+ # pkg:gem/ast#lib/ast/node.rb:187
176
+ def to_sexp(indent = T.unsafe(nil)); end
177
+
178
+ # Converts `self` to an Array where the first element is the type as a Symbol,
179
+ # and subsequent elements are the same representation of its children.
180
+ #
181
+ # @return [Array<Symbol, [...Array]>]
182
+ #
183
+ # pkg:gem/ast#lib/ast/node.rb:237
184
+ def to_sexp_array; end
185
+
186
+ # Returns the type of this node.
187
+ # @return [Symbol]
188
+ #
189
+ # pkg:gem/ast#lib/ast/node.rb:43
190
+ def type; end
191
+
192
+ # Returns a new instance of Node where non-nil arguments replace the
193
+ # corresponding fields of `self`.
194
+ #
195
+ # For example, `Node.new(:foo, [ 1, 2 ]).updated(:bar)` would yield
196
+ # `(bar 1 2)`, and `Node.new(:foo, [ 1, 2 ]).updated(nil, [])` would
197
+ # yield `(foo)`.
198
+ #
199
+ # If the resulting node would be identical to `self`, does nothing.
200
+ #
201
+ # @param [Symbol, nil] type
202
+ # @param [Array, nil] children
203
+ # @param [Hash, nil] properties
204
+ # @return [AST::Node]
205
+ #
206
+ # pkg:gem/ast#lib/ast/node.rb:133
207
+ def updated(type = T.unsafe(nil), children = T.unsafe(nil), properties = T.unsafe(nil)); end
208
+
209
+ protected
210
+
211
+ # By default, each entry in the `properties` hash is assigned to
212
+ # an instance variable in this instance of Node. A subclass should define
213
+ # attribute readers for such variables. The values passed in the hash
214
+ # are not frozen or whitelisted; such behavior can also be implemented
215
+ # by subclassing Node and overriding this method.
216
+ #
217
+ # @return [nil]
218
+ #
219
+ # pkg:gem/ast#lib/ast/node.rb:98
220
+ def assign_properties(properties); end
221
+
222
+ # Returns `@type` with all underscores replaced by dashes. This allows
223
+ # to write symbol literals without quotes in Ruby sources and yet have
224
+ # nicely looking s-expressions.
225
+ #
226
+ # @return [String]
227
+ #
228
+ # pkg:gem/ast#lib/ast/node.rb:264
229
+ def fancy_type; end
230
+
231
+ private
232
+
233
+ # pkg:gem/ast#lib/ast/node.rb:107
234
+ def original_dup; end
235
+ end
236
+
237
+ # This class includes {AST::Processor::Mixin}; however, it is
238
+ # deprecated, since the module defines all of the behaviors that
239
+ # the processor includes. Any new libraries should use
240
+ # {AST::Processor::Mixin} instead of subclassing this.
241
+ #
242
+ # @deprecated Use {AST::Processor::Mixin} instead.
243
+ #
244
+ # pkg:gem/ast#lib/ast/processor.rb:8
245
+ class AST::Processor
246
+ include ::AST::Processor::Mixin
247
+ end
248
+
249
+ # The processor module is a module which helps transforming one
250
+ # AST into another. In a nutshell, the {#process} method accepts
251
+ # a {Node} and dispatches it to a handler corresponding to its
252
+ # type, and returns a (possibly) updated variant of the node.
253
+ #
254
+ # The processor module has a set of associated design patterns.
255
+ # They are best explained with a concrete example. Let's define a
256
+ # simple arithmetic language and an AST format for it:
257
+ #
258
+ # Terminals (AST nodes which do not have other AST nodes inside):
259
+ #
260
+ # * `(integer <int-literal>)`,
261
+ #
262
+ # Nonterminals (AST nodes with other nodes as children):
263
+ #
264
+ # * `(add <node> <node>)`,
265
+ # * `(multiply <node> <node>)`,
266
+ # * `(divide <node> <node>)`,
267
+ # * `(negate <node>)`,
268
+ # * `(store <node> <string-literal>)`: stores value of `<node>`
269
+ # into a variable named `<string-literal>`,
270
+ # * `(load <string-literal>)`: loads value of a variable named
271
+ # `<string-literal>`,
272
+ # * `(each <node> ...)`: computes each of the `<node>`s and
273
+ # prints the result.
274
+ #
275
+ # All AST nodes have the same Ruby class, and therefore they don't
276
+ # know how to traverse themselves. (A solution which dynamically
277
+ # checks the type of children is possible, but is slow and
278
+ # error-prone.) So, a class including the module which knows how
279
+ # to traverse the entire tree should be defined. Such classes
280
+ # have a handler for each nonterminal node which recursively
281
+ # processes children nodes:
282
+ #
283
+ # require 'ast'
284
+ #
285
+ # class ArithmeticsProcessor
286
+ # include AST::Processor::Mixin
287
+ # # This method traverses any binary operators such as (add)
288
+ # # or (multiply).
289
+ # def process_binary_op(node)
290
+ # # Children aren't decomposed automatically; it is
291
+ # # suggested to use Ruby multiple assignment expansion,
292
+ # # as it is very convenient here.
293
+ # left_expr, right_expr = *node
294
+ #
295
+ # # AST::Node#updated won't change node type if nil is
296
+ # # passed as a first argument, which allows to reuse the
297
+ # # same handler for multiple node types using `alias'
298
+ # # (below).
299
+ # node.updated(nil, [
300
+ # process(left_expr),
301
+ # process(right_expr)
302
+ # ])
303
+ # end
304
+ # alias_method :on_add, :process_binary_op
305
+ # alias_method :on_multiply, :process_binary_op
306
+ # alias_method :on_divide, :process_binary_op
307
+ #
308
+ # def on_negate(node)
309
+ # # It is also possible to use #process_all for more
310
+ # # compact code if every child is a Node.
311
+ # node.updated(nil, process_all(node))
312
+ # end
313
+ #
314
+ # def on_store(node)
315
+ # expr, variable_name = *node
316
+ #
317
+ # # Note that variable_name is not a Node and thus isn't
318
+ # # passed to #process.
319
+ # node.updated(nil, [
320
+ # process(expr),
321
+ # variable_name
322
+ # ])
323
+ # end
324
+ #
325
+ # # (load) is effectively a terminal node, and so it does
326
+ # # not need an explicit handler, as the following is the
327
+ # # default behavior. Essentially, for any nodes that don't
328
+ # # have a defined handler, the node remains unchanged.
329
+ # def on_load(node)
330
+ # nil
331
+ # end
332
+ #
333
+ # def on_each(node)
334
+ # node.updated(nil, process_all(node))
335
+ # end
336
+ # end
337
+ #
338
+ # Let's test our ArithmeticsProcessor:
339
+ #
340
+ # include AST::Sexp
341
+ # expr = s(:add, s(:integer, 2), s(:integer, 2))
342
+ #
343
+ # p ArithmeticsProcessor.new.process(expr) == expr # => true
344
+ #
345
+ # As expected, it does not change anything at all. This isn't
346
+ # actually very useful, so let's now define a Calculator, which
347
+ # will compute the expression values:
348
+ #
349
+ # # This Processor folds nonterminal nodes and returns an
350
+ # # (integer) terminal node.
351
+ # class ArithmeticsCalculator < ArithmeticsProcessor
352
+ # def compute_op(node)
353
+ # # First, node children are processed and then unpacked
354
+ # # to local variables.
355
+ # nodes = process_all(node)
356
+ #
357
+ # if nodes.all? { |node| node.type == :integer }
358
+ # # If each of those nodes represents a literal, we can
359
+ # # fold this node!
360
+ # values = nodes.map { |node| node.children.first }
361
+ # AST::Node.new(:integer, [
362
+ # yield(values)
363
+ # ])
364
+ # else
365
+ # # Otherwise, we can just leave the current node in the
366
+ # # tree and only update it with processed children
367
+ # # nodes, which can be partially folded.
368
+ # node.updated(nil, nodes)
369
+ # end
370
+ # end
371
+ #
372
+ # def on_add(node)
373
+ # compute_op(node) { |left, right| left + right }
374
+ # end
375
+ #
376
+ # def on_multiply(node)
377
+ # compute_op(node) { |left, right| left * right }
378
+ # end
379
+ # end
380
+ #
381
+ # Let's check:
382
+ #
383
+ # p ArithmeticsCalculator.new.process(expr) # => (integer 4)
384
+ #
385
+ # Excellent, the calculator works! Now, a careful reader could
386
+ # notice that the ArithmeticsCalculator does not know how to
387
+ # divide numbers. What if we pass an expression with division to
388
+ # it?
389
+ #
390
+ # expr_with_division = \
391
+ # s(:add,
392
+ # s(:integer, 1),
393
+ # s(:divide,
394
+ # s(:add, s(:integer, 8), s(:integer, 4)),
395
+ # s(:integer, 3))) # 1 + (8 + 4) / 3
396
+ #
397
+ # folded_expr_with_division = ArithmeticsCalculator.new.process(expr_with_division)
398
+ # p folded_expr_with_division
399
+ # # => (add
400
+ # # (integer 1)
401
+ # # (divide
402
+ # # (integer 12)
403
+ # # (integer 3)))
404
+ #
405
+ # As you can see, the expression was folded _partially_: the inner
406
+ # `(add)` node which could be computed was folded to
407
+ # `(integer 12)`, the `(divide)` node is left as-is because there
408
+ # is no computing handler for it, and the root `(add)` node was
409
+ # also left as it is because some of its children were not
410
+ # literals.
411
+ #
412
+ # Note that this partial folding is only possible because the
413
+ # _data_ format, i.e. the format in which the computed values of
414
+ # the nodes are represented, is the same as the AST itself.
415
+ #
416
+ # Let's extend our ArithmeticsCalculator class further.
417
+ #
418
+ # class ArithmeticsCalculator
419
+ # def on_divide(node)
420
+ # compute_op(node) { |left, right| left / right }
421
+ # end
422
+ #
423
+ # def on_negate(node)
424
+ # # Note how #compute_op works regardless of the operator
425
+ # # arity.
426
+ # compute_op(node) { |value| -value }
427
+ # end
428
+ # end
429
+ #
430
+ # Now, let's apply our renewed ArithmeticsCalculator to a partial
431
+ # result of previous evaluation:
432
+ #
433
+ # p ArithmeticsCalculator.new.process(expr_with_division) # => (integer 5)
434
+ #
435
+ # Five! Excellent. This is also pretty much how CRuby 1.8 executed
436
+ # its programs.
437
+ #
438
+ # Now, let's do some automated bug searching. Division by zero is
439
+ # an error, right? So if we could detect that someone has divided
440
+ # by zero before the program is even run, that could save some
441
+ # debugging time.
442
+ #
443
+ # class DivisionByZeroVerifier < ArithmeticsProcessor
444
+ # class VerificationFailure < Exception; end
445
+ #
446
+ # def on_divide(node)
447
+ # # You need to process the children to handle nested divisions
448
+ # # such as:
449
+ # # (divide
450
+ # # (integer 1)
451
+ # # (divide (integer 1) (integer 0))
452
+ # left, right = process_all(node)
453
+ #
454
+ # if right.type == :integer &&
455
+ # right.children.first == 0
456
+ # raise VerificationFailure, "Ouch! This code divides by zero."
457
+ # end
458
+ # end
459
+ #
460
+ # def divides_by_zero?(ast)
461
+ # process(ast)
462
+ # false
463
+ # rescue VerificationFailure
464
+ # true
465
+ # end
466
+ # end
467
+ #
468
+ # nice_expr = \
469
+ # s(:divide,
470
+ # s(:add, s(:integer, 10), s(:integer, 2)),
471
+ # s(:integer, 4))
472
+ #
473
+ # p DivisionByZeroVerifier.new.divides_by_zero?(nice_expr)
474
+ # # => false. Good.
475
+ #
476
+ # bad_expr = \
477
+ # s(:add, s(:integer, 10),
478
+ # s(:divide, s(:integer, 1), s(:integer, 0)))
479
+ #
480
+ # p DivisionByZeroVerifier.new.divides_by_zero?(bad_expr)
481
+ # # => true. WHOOPS. DO NOT RUN THIS.
482
+ #
483
+ # Of course, this won't detect more complex cases... unless you
484
+ # use some partial evaluation before! The possibilites are
485
+ # endless. Have fun.
486
+ #
487
+ # pkg:gem/ast#lib/ast/processor/mixin.rb:240
488
+ module AST::Processor::Mixin
489
+ # Default handler. Does nothing.
490
+ #
491
+ # @param [AST::Node] node
492
+ # @return [AST::Node, nil]
493
+ #
494
+ # pkg:gem/ast#lib/ast/processor/mixin.rb:284
495
+ def handler_missing(node); end
496
+
497
+ # Dispatches `node`. If a node has type `:foo`, then a handler
498
+ # named `on_foo` is invoked with one argument, the `node`; if
499
+ # there isn't such a handler, {#handler_missing} is invoked
500
+ # with the same argument.
501
+ #
502
+ # If the handler returns `nil`, `node` is returned; otherwise,
503
+ # the return value of the handler is passed along.
504
+ #
505
+ # @param [AST::Node, nil] node
506
+ # @return [AST::Node, nil]
507
+ #
508
+ # pkg:gem/ast#lib/ast/processor/mixin.rb:251
509
+ def process(node); end
510
+
511
+ # {#process}es each node from `nodes` and returns an array of
512
+ # results.
513
+ #
514
+ # @param [Array<AST::Node>] nodes
515
+ # @return [Array<AST::Node>]
516
+ #
517
+ # pkg:gem/ast#lib/ast/processor/mixin.rb:274
518
+ def process_all(nodes); end
519
+ end
520
+
521
+ # This simple module is very useful in the cases where one needs
522
+ # to define deeply nested ASTs from Ruby code, for example, in
523
+ # tests. It should be used like this:
524
+ #
525
+ # describe YourLanguage::AST do
526
+ # include Sexp
527
+ #
528
+ # it "should correctly parse expressions" do
529
+ # YourLanguage.parse("1 + 2 * 3").should ==
530
+ # s(:add,
531
+ # s(:integer, 1),
532
+ # s(:multiply,
533
+ # s(:integer, 2),
534
+ # s(:integer, 3)))
535
+ # end
536
+ # end
537
+ #
538
+ # This way the amount of boilerplate code is greatly reduced.
539
+ #
540
+ # pkg:gem/ast#lib/ast/sexp.rb:20
541
+ module AST::Sexp
542
+ # Creates a {Node} with type `type` and children `children`.
543
+ # Note that the resulting node is of the type AST::Node and not a
544
+ # subclass.
545
+ # This would not pose a problem with comparisons, as {Node#==}
546
+ # ignores metadata.
547
+ #
548
+ # pkg:gem/ast#lib/ast/sexp.rb:26
549
+ def s(type, *children); end
550
+ end