rubocop-ast 1.2.0 → 1.3.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: d42f2a7ab5fe1a168c8307ffad746e21eaa3811cdb5f9236ce423f2fb829b9ae
4
- data.tar.gz: 74ca8b1fbbbb9f0a89ae61136235f9066579da11b4a056c0161a7a7a34092e19
3
+ metadata.gz: 0f538f2ba2d235b12111dfc20f5cb568ed1212310bf90f3f9abf783866153b93
4
+ data.tar.gz: 9a67f643a7b4371f6592a846664933cd56399689a3c8005ef4ef8ddfb4857341
5
5
  SHA512:
6
- metadata.gz: ffeca2200e1825749aa09f72e90b98b643617b55f4300ad9de8f34bedb59534278ebd4490d50d6e6866b055a5b5d9e28707e69c221c8da16e6c6691b83e7b162
7
- data.tar.gz: 4e7b93a612f88394024fd26d025cbca1cf3b1926ea27650a115efd89b9f8bda2aab52d55968d427d1e63a295d588407046841d00ef5823e80443bb4d73b3acd2
6
+ metadata.gz: 9df6cd1a8593620ac41fc08a9798b5c0e5c2973f62d8068605435f6d0231ab0ccd9555610645951d2550f7150753395f64d4ffd9d8fe74b40ffbce6a095f3ce1
7
+ data.tar.gz: c4d67ddff04232bead212dcc7632ac3e5195c29f0314a5137c0c2da57ba7805f386600f4a21fdd490d7a0988165974482fc1e60a7aed9227a9f37466b79e85eb
@@ -13,7 +13,8 @@ class RuboCop::AST::NodePattern::LexerRex
13
13
  macros
14
14
  CONST_NAME /[A-Z:][a-zA-Z_:]+/
15
15
  SYMBOL_NAME /[\w+@*\/?!<>=~|%^-]+|\[\]=?/
16
- IDENTIFIER /[a-zA-Z_][a-zA-Z0-9_-]*/
16
+ IDENTIFIER /[a-z][a-zA-Z0-9_]*/
17
+ NODE_TYPE /[a-z][a-zA-Z0-9_-]*/ # Same as identifier but allows '-'
17
18
  CALL /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
18
19
  REGEXP_BODY /(?:[^\/]|\\\/)*/
19
20
  REGEXP /\/(#{REGEXP_BODY})(?<!\\)\/([imxo]*)/
@@ -27,14 +28,14 @@ rules
27
28
  %w"( ) { | } [ ] < > $ ! ^ ` ... + * ? ,"
28
29
  )}/o { emit ss.matched, &:to_sym }
29
30
  /#{REGEXP}/o { emit_regexp }
30
- /%(#{CONST_NAME})/o { emit :tPARAM_CONST }
31
+ /%?(#{CONST_NAME})/o { emit :tPARAM_CONST }
31
32
  /%([a-z_]+)/ { emit :tPARAM_NAMED }
32
33
  /%(\d*)/ { emit(:tPARAM_NUMBER) { |s| s.empty? ? 1 : s.to_i } } # Map `%` to `%1`
33
34
  /_(#{IDENTIFIER})/o { emit :tUNIFY }
34
35
  /_/o { emit :tWILDCARD }
35
36
  /\#(#{CALL})/o { @state = :ARG; emit :tFUNCTION_CALL, &:to_sym }
36
37
  /#{IDENTIFIER}\?/o { @state = :ARG; emit :tPREDICATE, &:to_sym }
37
- /#{IDENTIFIER}/o { emit :tNODE_TYPE, &:to_sym }
38
+ /#{NODE_TYPE}/o { emit :tNODE_TYPE, &:to_sym }
38
39
  :ARG /\(/ { @state = nil; emit :tARG_LIST }
39
40
  :ARG // { @state = nil }
40
41
  /\#.*/ { emit_comment }
@@ -26,7 +26,8 @@ class RuboCop::AST::NodePattern::LexerRex
26
26
  # :stopdoc:
27
27
  CONST_NAME = /[A-Z:][a-zA-Z_:]+/
28
28
  SYMBOL_NAME = /[\w+@*\/?!<>=~|%^-]+|\[\]=?/
29
- IDENTIFIER = /[a-zA-Z_][a-zA-Z0-9_-]*/
29
+ IDENTIFIER = /[a-z][a-zA-Z0-9_]*/
30
+ NODE_TYPE = /[a-z][a-zA-Z0-9_-]*/
30
31
  CALL = /(?:#{CONST_NAME}\.)?#{IDENTIFIER}[!?]?/
31
32
  REGEXP_BODY = /(?:[^\/]|\\\/)*/
32
33
  REGEXP = /\/(#{REGEXP_BODY})(?<!\\)\/([imxo]*)/
@@ -134,7 +135,7 @@ class RuboCop::AST::NodePattern::LexerRex
134
135
  action { emit ss.matched, &:to_sym }
135
136
  when ss.skip(/#{REGEXP}/o) then
136
137
  action { emit_regexp }
137
- when ss.skip(/%(#{CONST_NAME})/o) then
138
+ when ss.skip(/%?(#{CONST_NAME})/o) then
138
139
  action { emit :tPARAM_CONST }
139
140
  when ss.skip(/%([a-z_]+)/) then
140
141
  action { emit :tPARAM_NAMED }
@@ -148,7 +149,7 @@ class RuboCop::AST::NodePattern::LexerRex
148
149
  action { @state = :ARG; emit :tFUNCTION_CALL, &:to_sym }
149
150
  when ss.skip(/#{IDENTIFIER}\?/o) then
150
151
  action { @state = :ARG; emit :tPREDICATE, &:to_sym }
151
- when ss.skip(/#{IDENTIFIER}/o) then
152
+ when ss.skip(/#{NODE_TYPE}/o) then
152
153
  action { emit :tNODE_TYPE, &:to_sym }
153
154
  when ss.skip(/\#.*/) then
154
155
  action { emit_comment }
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  module AST
5
5
  module Version
6
- STRING = '1.2.0'
6
+ STRING = '1.3.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.2.0
4
+ version: 1.3.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-11-24 00:00:00.000000000 Z
13
+ date: 2020-12-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: parser