rubocop-ast 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8575eee0ddbed5fb9eb553bbc33346ec8dc75216403501a46a946f825e79102
4
- data.tar.gz: 5762b5f73e28c3dfd687feb0308d4248d87b90488ff99c9ddeebd49dced31941
3
+ metadata.gz: 80da9c79ffae899ecc1eea266704e35274d85ce07d3f46a9bed2a7ac573445b9
4
+ data.tar.gz: af113442d1be42f61c17b369e097c6c0ad9c5c9c49cac27c70dee3c21aa39568
5
5
  SHA512:
6
- metadata.gz: c7b6f9c6f1366ec8ddcb852ce8af9abdd0f945d41c17c9221ea27e9442b324912a1ff530e9faa36a4d48242e282b5786095cf714b38180e6b9fb121e97f4d703
7
- data.tar.gz: e43be065343ccc65a3c776b7073c6647c4cbf406121ec8e31782ced1b2d218937597f70a35b014d9c5681cdf7e76a8045755c4133394160ab3ed710e87639972
6
+ metadata.gz: d4d26dca602b849000686fa68f1b543681d8e51598741a6a4bf9e69a57ca6bab21ce8ac270b8578ad473808ed985f13ce9b080ac2259ad73fd6f87110e345305
7
+ data.tar.gz: 72d5d9852cd5286ba8d01c7f5b46b774fdfb7bae7382aebd9cf766b8bd103f22477d3ba7d47a62c3466bc35d74eba4784e6b53725aa4332669d20a8801d46936
@@ -11,8 +11,10 @@
11
11
  class RuboCop::AST::NodePattern::LexerRex
12
12
 
13
13
  macros
14
+ CONST_NAME /[A-Z:][a-zA-Z_:]+/
14
15
  SYMBOL_NAME /[\w+@*\/?!<>=~|%^-]+|\[\]=?/
15
16
  IDENTIFIER /[a-zA-Z_][a-zA-Z0-9_-]*/
17
+ CALL /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
16
18
  REGEXP_BODY /(?:[^\/]|\\\/)*/
17
19
  REGEXP /\/(#{REGEXP_BODY})(?<!\\)\/([imxo]*)/
18
20
  rules
@@ -25,12 +27,12 @@ rules
25
27
  %w"( ) { | } [ ] < > $ ! ^ ` ... + * ? ,"
26
28
  )}/o { emit ss.matched, &:to_sym }
27
29
  /#{REGEXP}/o { emit_regexp }
28
- /%([A-Z:][a-zA-Z_:]+)/ { emit :tPARAM_CONST }
30
+ /%(#{CONST_NAME})/o { emit :tPARAM_CONST }
29
31
  /%([a-z_]+)/ { emit :tPARAM_NAMED }
30
32
  /%(\d*)/ { emit(:tPARAM_NUMBER) { |s| s.empty? ? 1 : s.to_i } } # Map `%` to `%1`
31
33
  /_(#{IDENTIFIER})/o { emit :tUNIFY }
32
34
  /_/o { emit :tWILDCARD }
33
- /\#(#{IDENTIFIER}[!?]?)/o { @state = :ARG; emit :tFUNCTION_CALL, &:to_sym }
35
+ /\#(#{CALL})/o { @state = :ARG; emit :tFUNCTION_CALL, &:to_sym }
34
36
  /#{IDENTIFIER}\?/o { @state = :ARG; emit :tPREDICATE, &:to_sym }
35
37
  /#{IDENTIFIER}/o { emit :tNODE_TYPE, &:to_sym }
36
38
  :ARG /\(/ { @state = nil; emit :tARG_LIST }
@@ -24,8 +24,10 @@ class RuboCop::AST::NodePattern::LexerRex
24
24
  require 'strscan'
25
25
 
26
26
  # :stopdoc:
27
+ CONST_NAME = /[A-Z:][a-zA-Z_:]+/
27
28
  SYMBOL_NAME = /[\w+@*\/?!<>=~|%^-]+|\[\]=?/
28
29
  IDENTIFIER = /[a-zA-Z_][a-zA-Z0-9_-]*/
30
+ CALL = /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
29
31
  REGEXP_BODY = /(?:[^\/]|\\\/)*/
30
32
  REGEXP = /\/(#{REGEXP_BODY})(?<!\\)\/([imxo]*)/
31
33
  # :startdoc:
@@ -132,7 +134,7 @@ class RuboCop::AST::NodePattern::LexerRex
132
134
  action { emit ss.matched, &:to_sym }
133
135
  when ss.skip(/#{REGEXP}/o) then
134
136
  action { emit_regexp }
135
- when ss.skip(/%([A-Z:][a-zA-Z_:]+)/) then
137
+ when ss.skip(/%(#{CONST_NAME})/o) then
136
138
  action { emit :tPARAM_CONST }
137
139
  when ss.skip(/%([a-z_]+)/) then
138
140
  action { emit :tPARAM_NAMED }
@@ -142,7 +144,7 @@ class RuboCop::AST::NodePattern::LexerRex
142
144
  action { emit :tUNIFY }
143
145
  when ss.skip(/_/o) then
144
146
  action { emit :tWILDCARD }
145
- when ss.skip(/\#(#{IDENTIFIER}[!?]?)/o) then
147
+ when ss.skip(/\#(#{CALL})/o) then
146
148
  action { @state = :ARG; emit :tFUNCTION_CALL, &:to_sym }
147
149
  when ss.skip(/#{IDENTIFIER}\?/o) then
148
150
  action { @state = :ARG; emit :tPREDICATE, &:to_sym }
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module AST
5
5
  module Version
6
- STRING = '1.0.1'
6
+ STRING = '1.1.0'
7
7
  end
8
8
  end
9
9
  end
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.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-10-23 00:00:00.000000000 Z
13
+ date: 2020-10-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parser