rubocop-ast 1.0.1 → 1.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80da9c79ffae899ecc1eea266704e35274d85ce07d3f46a9bed2a7ac573445b9
|
4
|
+
data.tar.gz: af113442d1be42f61c17b369e097c6c0ad9c5c9c49cac27c70dee3c21aa39568
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
/%(
|
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
|
-
/\#(#{
|
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(/%(
|
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(/\#(#{
|
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 }
|
data/lib/rubocop/ast/version.rb
CHANGED
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
|
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-
|
13
|
+
date: 2020-10-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: parser
|