rubocop-ast 1.42.0 → 1.43.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d19f7e10e7b8402e4cd47676b246f8ada988fe6039f45ce339f99e4aec065955
4
- data.tar.gz: e877a86b9566a395e5e4d8b0656d688670c051090900cc1f753922f4f285882d
3
+ metadata.gz: 724e2118bf289e457d58db38594035fb1888100577cbc82ca6e7352b2d952d24
4
+ data.tar.gz: 0f957ba53af55775cfa988490b2ea07db0022d9b3dba3d28c48a95aff64552ad
5
5
  SHA512:
6
- metadata.gz: 2eae7d51990b5b02aef754cb28ded1563712df934b1903439cb84f9d67d4c9507186112739a12aaaa7fb4bec33b9226f32c62ac128e21124f4d171a31ee263e3
7
- data.tar.gz: d7ab2ea49e961d91b556a385e77e3bc70f67168af0af26c582bd141737c22a81f1f73d4838855baa92ddb39b2751f266d2df496d279f96c44cd66c1481d5e153
6
+ metadata.gz: db7476e8bff5a7357b8722d6a48fd185ef296e10c9e69de6e8efd76e5f281e7ad8e4c18303df1415c8219359f17fe860742fd12ae3be726f8acdeacf9afed84f
7
+ data.tar.gz: c06cf9bed363772ee88102f93685993025c03886d0f68b01d139d20c128fe4d3bd66707321431d559b75801ce84613f6c0ccf3bb19fad674482a377418134e53
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  # DO NOT MODIFY!!!!
4
- # This file is automatically generated by Racc 1.5.0
5
- # from Racc grammar file "".
4
+ # This file is automatically generated by Racc 1.8.1
5
+ # from Racc grammar file "parser.y".
6
6
  #
7
7
 
8
8
  require 'racc/parser.rb'
@@ -14,15 +14,15 @@ module RuboCop
14
14
 
15
15
  racc_action_table = [
16
16
  14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
17
- 60, 22, 20, 4, 40, 5, 43, 6, 7, 8,
18
- 28, 23, 56, 50, 66, 61, 24, 51, 51, 40,
17
+ 60, 22, 20, 4, 24, 5, 40, 6, 7, 8,
18
+ 28, 23, 56, 50, 40, 61, 43, 66, 51, 51,
19
19
  58, 14, 15, 16, 21, 18, 17, 19, 10, 11,
20
20
  12, nil, 22, 20, 4, nil, 5, nil, 6, 7,
21
21
  8, 28, 23, nil, nil, -34, 14, 15, 16, 21,
22
22
  18, 17, 19, 10, 11, 12, nil, 22, 20, 4,
23
23
  nil, 5, nil, 6, 7, 8, 9, 23, 14, 15,
24
24
  16, 21, 18, 17, 19, 10, 11, 12, nil, 22,
25
- 20, 4, nil, 5, nil, 6, 7, 8, 9, 23,
25
+ 20, 4, nil, 5, nil, 6, 7, 8, 28, 23,
26
26
  14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
27
27
  nil, 22, 20, 4, nil, 5, nil, 6, 7, 8,
28
28
  9, 23, 14, 15, 16, 21, 18, 17, 19, 10,
@@ -33,7 +33,7 @@ racc_action_table = [
33
33
  18, 17, 19, 10, 11, 12, nil, 22, 20, 4,
34
34
  nil, 5, nil, 6, 7, 8, 9, 23, 14, 15,
35
35
  16, 21, 18, 17, 19, 10, 11, 12, nil, 22,
36
- 20, 4, nil, 5, nil, 6, 7, 8, 28, 23,
36
+ 20, 4, nil, 5, nil, 6, 7, 8, 9, 23,
37
37
  14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
38
38
  nil, 22, 20, 4, 44, 5, nil, 6, 7, 8,
39
39
  28, 23, 14, 15, 16, 21, 18, 17, 19, 10,
@@ -47,31 +47,31 @@ racc_action_table = [
47
47
  20, 4, nil, 5, nil, 6, 7, 8, 9, 23,
48
48
  14, 15, 16, 21, 18, 17, 19, 10, 11, 12,
49
49
  nil, 22, 20, 4, nil, 5, nil, 6, 7, 8,
50
- 9, 23, 47, 48, 49, -1, -1, -1, -2, -2,
51
- -2 ]
50
+ 9, 23, -1, -1, -1, -2, -2, -2, 47, 48,
51
+ 49 ]
52
52
 
53
53
  racc_action_check = [
54
54
  42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
55
- 54, 42, 42, 42, 11, 42, 24, 42, 42, 42,
56
- 42, 42, 42, 30, 62, 54, 1, 63, 30, 10,
55
+ 54, 42, 42, 42, 1, 42, 10, 42, 42, 42,
56
+ 42, 42, 42, 30, 11, 54, 24, 62, 30, 63,
57
57
  42, 59, 59, 59, 59, 59, 59, 59, 59, 59,
58
58
  59, nil, 59, 59, 59, nil, 59, nil, 59, 59,
59
- 59, 59, 59, nil, nil, 59, 5, 5, 5, 5,
60
- 5, 5, 5, 5, 5, 5, nil, 5, 5, 5,
61
- nil, 5, nil, 5, 5, 5, 5, 5, 6, 6,
62
- 6, 6, 6, 6, 6, 6, 6, 6, nil, 6,
63
- 6, 6, nil, 6, nil, 6, 6, 6, 6, 6,
64
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
65
- nil, 7, 7, 7, nil, 7, nil, 7, 7, 7,
66
- 7, 7, 8, 8, 8, 8, 8, 8, 8, 8,
67
- 8, 8, nil, 8, 8, 8, nil, 8, nil, 8,
68
- 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,
69
- 9, 9, 9, 9, nil, 9, 9, 9, nil, 9,
70
- nil, 9, 9, 9, 9, 9, 0, 0, 0, 0,
59
+ 59, 59, 59, nil, nil, 59, 0, 0, 0, 0,
71
60
  0, 0, 0, 0, 0, 0, nil, 0, 0, 0,
72
61
  nil, 0, nil, 0, 0, 0, 0, 0, 4, 4,
73
62
  4, 4, 4, 4, 4, 4, 4, 4, nil, 4,
74
63
  4, 4, nil, 4, nil, 4, 4, 4, 4, 4,
64
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
65
+ nil, 5, 5, 5, nil, 5, nil, 5, 5, 5,
66
+ 5, 5, 6, 6, 6, 6, 6, 6, 6, 6,
67
+ 6, 6, nil, 6, 6, 6, nil, 6, nil, 6,
68
+ 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,
69
+ 7, 7, 7, 7, nil, 7, 7, 7, nil, 7,
70
+ nil, 7, 7, 7, 7, 7, 8, 8, 8, 8,
71
+ 8, 8, 8, 8, 8, 8, nil, 8, 8, 8,
72
+ nil, 8, nil, 8, 8, 8, 8, 8, 9, 9,
73
+ 9, 9, 9, 9, 9, 9, 9, 9, nil, 9,
74
+ 9, 9, nil, 9, nil, 9, 9, 9, 9, 9,
75
75
  27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
76
76
  nil, 27, 27, 27, 27, 27, nil, 27, 27, 27,
77
77
  27, 27, 28, 28, 28, 28, 28, 28, 28, 28,
@@ -85,17 +85,17 @@ racc_action_check = [
85
85
  50, 50, nil, 50, nil, 50, 50, 50, 50, 50,
86
86
  61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
87
87
  nil, 61, 61, 61, nil, 61, nil, 61, 61, 61,
88
- 61, 61, 29, 29, 29, 25, 25, 25, 26, 26,
89
- 26 ]
88
+ 61, 61, 25, 25, 25, 26, 26, 26, 29, 29,
89
+ 29 ]
90
90
 
91
91
  racc_action_pointer = [
92
- 164, 26, nil, nil, 186, 54, 76, 98, 120, 142,
93
- 17, 2, nil, nil, nil, nil, nil, nil, nil, nil,
94
- nil, nil, nil, nil, 16, 318, 321, 208, 230, 315,
92
+ 54, 14, nil, nil, 76, 98, 120, 142, 164, 186,
93
+ 4, 12, nil, nil, nil, nil, nil, nil, nil, nil,
94
+ nil, nil, nil, nil, 26, 315, 318, 208, 230, 321,
95
95
  -2, nil, nil, 252, nil, nil, nil, nil, nil, nil,
96
96
  274, nil, -2, nil, nil, nil, nil, nil, nil, nil,
97
97
  296, nil, nil, nil, -6, nil, nil, nil, nil, 29,
98
- nil, 318, -2, -3, nil, nil, nil ]
98
+ nil, 318, 1, -1, nil, nil, nil ]
99
99
 
100
100
  racc_action_default = [
101
101
  -47, -47, -1, -2, -31, -47, -47, -47, -47, -47,
@@ -107,26 +107,26 @@ racc_action_default = [
107
107
  -37, -47, -47, -47, -35, -39, -26 ]
108
108
 
109
109
  racc_goto_table = [
110
- 1, 33, 64, 32, 25, 34, 35, 36, 37, 38,
111
- 54, 26, 39, 41, 27, 42, 46, 63, 62, nil,
112
- nil, nil, nil, nil, nil, nil, 45, 25, 38, nil,
113
- nil, nil, nil, 53, 26, nil, nil, nil, nil, nil,
114
- 55, 57, 25, nil, nil, nil, 59, nil, nil, 26,
110
+ 1, 33, 27, 25, 26, 34, 35, 36, 37, 38,
111
+ 42, 32, 39, 41, 46, 63, 62, 64, 54, nil,
112
+ nil, nil, nil, nil, nil, nil, 25, 26, 38, nil,
113
+ nil, nil, nil, 53, 45, nil, nil, nil, nil, nil,
114
+ 55, 25, 26, nil, nil, nil, 59, nil, nil, 57,
115
115
  34, nil, nil, nil, nil, nil, nil, nil, nil, 53,
116
116
  nil, 65 ]
117
117
 
118
118
  racc_goto_check = [
119
- 1, 5, 13, 9, 2, 1, 1, 1, 1, 1,
120
- 14, 3, 6, 6, 4, 8, 10, 11, 12, nil,
121
- nil, nil, nil, nil, nil, nil, 9, 2, 1, nil,
122
- nil, nil, nil, 1, 3, nil, nil, nil, nil, nil,
123
- 1, 9, 2, nil, nil, nil, 5, nil, nil, 3,
119
+ 1, 5, 4, 2, 3, 1, 1, 1, 1, 1,
120
+ 8, 9, 6, 6, 10, 11, 12, 13, 14, nil,
121
+ nil, nil, nil, nil, nil, nil, 2, 3, 1, nil,
122
+ nil, nil, nil, 1, 9, nil, nil, nil, nil, nil,
123
+ 1, 2, 3, nil, nil, nil, 5, nil, nil, 9,
124
124
  1, nil, nil, nil, nil, nil, nil, nil, nil, 1,
125
125
  nil, 1 ]
126
126
 
127
127
  racc_goto_pointer = [
128
- nil, 0, 0, 7, 10, -4, 2, nil, -8, -1,
129
- -13, -42, -41, -57, -30 ]
128
+ nil, 0, -1, 0, -2, -4, 2, nil, -13, 7,
129
+ -15, -44, -43, -42, -22 ]
130
130
 
131
131
  racc_goto_default = [
132
132
  nil, 29, 2, 3, nil, nil, nil, 13, nil, nil,
@@ -239,6 +239,7 @@ Racc_arg = [
239
239
  racc_shift_n,
240
240
  racc_reduce_n,
241
241
  racc_use_result_var ]
242
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
242
243
 
243
244
  Racc_token_to_s_table = [
244
245
  "$end",
@@ -289,6 +290,7 @@ Racc_token_to_s_table = [
289
290
  "opt_rest",
290
291
  "rest",
291
292
  "arg_list" ]
293
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
292
294
 
293
295
  Racc_debug_parser = false
294
296
 
@@ -307,8 +307,6 @@ module RuboCop
307
307
  "`parser`. Specified target Ruby version: #{ruby_version.inspect}"
308
308
  end
309
309
  when :parser_prism
310
- require_prism
311
-
312
310
  case ruby_version
313
311
  when 3.3
314
312
  require 'prism/translation/parser33'
@@ -331,49 +329,17 @@ module RuboCop
331
329
  when :parser_whitequark
332
330
  RuboCop::AST::Builder
333
331
  when :parser_prism
334
- require_prism
335
- require_relative 'builder_prism'
336
332
  RuboCop::AST::BuilderPrism
337
333
  end
338
334
  end
339
335
 
340
- # Prism is a native extension, a `LoadError` will be raised if linked to an incompatible
341
- # Ruby version. Only raise if it really was caused by Prism not being present.
342
- # rubocop:disable Metrics/MethodLength
343
- def require_prism
344
- require 'prism'
345
- required_prism_version = '1.4.0'
346
- if required_prism_version > Prism::VERSION
347
- # While Prism is not yet a dependency, users may run with outdated versions that
348
- # don't have all the parsers.
349
- warn <<~MESSAGE
350
- Error: Prism version #{Prism::VERSION} was loaded, but rubocop-ast requires #{required_prism_version}.
351
- * If you're using Bundler and don't yet have `gem 'prism'` as a dependency, add it now.
352
- * If you're using Bundler and already have `gem 'prism'` as a dependency, update it to the most recent version.
353
- * If you don't use Bundler, run `gem update prism`.
354
- MESSAGE
355
- exit!
356
- end
357
- rescue LoadError => e
358
- raise unless e.path == 'prism'
359
-
360
- warn "Error: Unable to load Prism. Add `gem 'prism'` to your Gemfile."
361
- exit!
362
- end
363
- # rubocop:enable Metrics/MethodLength
364
-
365
336
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
366
337
  def create_parser(ruby_version, parser_engine, prism_result)
367
338
  builder = builder_class(parser_engine).new
368
339
 
369
340
  parser_class = parser_class(ruby_version, parser_engine)
370
341
 
371
- # NOTE: Check if the `Prism#initialize` method has the `:parser` keyword argument.
372
- # The `:parser` keyword argument cannot be used to switch parsers because older versions of
373
- # Prism do not support it.
374
- parser_switch_available = parser_class.instance_method(:initialize).parameters.assoc(:key)
375
-
376
- parser_instance = if prism_result && parser_switch_available
342
+ parser_instance = if prism_result
377
343
  # NOTE: Since it is intended for use with Ruby LSP, it targets only Prism.
378
344
  # If there is no reuse of a pre-parsed result, such as in Ruby LSP,
379
345
  # regular parsing with Prism occurs, and `else` branch will be executed.
@@ -415,7 +381,7 @@ module RuboCop
415
381
  # It is also not fully compatible with Ruby 3.4 but for
416
382
  # now respects using parser for backwards compatibility.
417
383
  def default_parser_engine(ruby_version)
418
- if ruby_version >= 3.5
384
+ if ruby_version >= 3.4
419
385
  :parser_prism
420
386
  else
421
387
  :parser_whitequark
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module AST
5
5
  module Version
6
- STRING = '1.42.0'
6
+ STRING = '1.43.0'
7
7
  end
8
8
  end
9
9
  end
data/lib/rubocop/ast.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'parser'
4
+ require 'prism'
4
5
  require 'forwardable'
5
6
  require 'set'
6
7
 
@@ -92,6 +93,7 @@ require_relative 'ast/node/when_node'
92
93
  require_relative 'ast/node/while_node'
93
94
  require_relative 'ast/node/yield_node'
94
95
  require_relative 'ast/builder'
96
+ require_relative 'ast/builder_prism'
95
97
  require_relative 'ast/processed_source'
96
98
  require_relative 'ast/rubocop_compatibility'
97
99
  require_relative 'ast/token'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.42.0
4
+ version: 1.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 3.3.7.2
28
+ - !ruby/object:Gem::Dependency
29
+ name: prism
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.4'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.4'
28
42
  description: " RuboCop's Node and NodePattern classes.\n"
29
43
  email: rubocop@googlegroups.com
30
44
  executables: []