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 +4 -4
- data/lib/rubocop/ast/node_pattern/parser.racc.rb +42 -40
- data/lib/rubocop/ast/processed_source.rb +2 -36
- data/lib/rubocop/ast/version.rb +1 -1
- data/lib/rubocop/ast.rb +2 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 724e2118bf289e457d58db38594035fb1888100577cbc82ca6e7352b2d952d24
|
4
|
+
data.tar.gz: 0f957ba53af55775cfa988490b2ea07db0022d9b3dba3d28c48a95aff64552ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
# 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,
|
18
|
-
28, 23, 56, 50,
|
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,
|
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,
|
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,
|
51
|
-
|
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,
|
56
|
-
42, 42, 42, 30,
|
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,
|
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,
|
89
|
-
|
88
|
+
61, 61, 25, 25, 25, 26, 26, 26, 29, 29,
|
89
|
+
29 ]
|
90
90
|
|
91
91
|
racc_action_pointer = [
|
92
|
-
|
93
|
-
|
94
|
-
nil, nil, nil, nil,
|
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,
|
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,
|
111
|
-
|
112
|
-
nil, nil, nil, nil, nil, nil,
|
113
|
-
nil, nil, nil, 53,
|
114
|
-
55,
|
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,
|
120
|
-
|
121
|
-
nil, nil, nil, nil, nil, nil,
|
122
|
-
nil, nil, nil, 1,
|
123
|
-
1,
|
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,
|
129
|
-
-
|
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
|
-
|
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.
|
384
|
+
if ruby_version >= 3.4
|
419
385
|
:parser_prism
|
420
386
|
else
|
421
387
|
:parser_whitequark
|
data/lib/rubocop/ast/version.rb
CHANGED
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.
|
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: []
|