node_query 1.13.0 → 1.13.1

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: a2e54cf10c098ebfaff54d05d36f482c2766b5308f4b8389b2b6a86c1bfb6363
4
- data.tar.gz: 4d0b3f4ece89c3d4184c9b8159b924a2e321bafde7b598ee1789f17a41b73ee4
3
+ metadata.gz: 9f0ea7e92fbee3e2c0c28554dd021b1e2a07fd4c64b9dd7f1a6b5acbc7d8385f
4
+ data.tar.gz: cc317efc39dd07bc30c1cd54cd03eded67c82a92a37b809340add4c8372e77ea
5
5
  SHA512:
6
- metadata.gz: 0a0245239a1a6739dc8a9c51ddc507ddec1fba5e11820678d002af9572e4ed3e810b4ff4835bf6c6c36019e750f252da6a1fbbe08aa2abf00374d7010d6e7e36
7
- data.tar.gz: e5ae500ad6d17776a1c2becc86f451fa7cc222e731a309dcb86be654930e1b3d038ad649319fa7805e03c4ea54320959898413bbde79a07dfeb09a50831a897d
6
+ metadata.gz: b7bb08d7bacc6da4232f7e16a9397e565ae4b4523b8d177068672441aecdcaa49a01be8b3e614aeef138e365ad210bd1e121857690061324f889e8486105c79a
7
+ data.tar.gz: 2736927c6b34ee327b02e4230bc4b8879f8582f8a9840740c99bd122a9d53eecd5c099dc2e3b2407629047a88e3477e253d878fe56e835264e38a405ede78bc2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.13.1 (2023-05-16)
4
+
5
+ * Require `parser` and `syntax_tree` in adapter
6
+ * `SyntaxTreeParser#get_node_type` returns a symbol
7
+ * Node type can be upcase
8
+
3
9
  ## 1.13.0 (2023-05-15)
4
10
 
5
11
  * Add `SyntaxTreeParser`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- node_query (1.13.0)
4
+ node_query (1.13.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'parser'
4
+ require 'parser_node_ext'
5
+
3
6
  class NodeQuery::ParserAdapter
4
7
  def is_node?(node)
5
8
  node.is_a?(Parser::AST::Node)
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'syntax_tree'
4
+ require 'syntax_tree_ext'
5
+
3
6
  class NodeQuery::SyntaxTreeAdapter
4
7
  def is_node?(node)
5
8
  node.is_a?(SyntaxTree::Node)
6
9
  end
7
10
 
8
11
  def get_node_type(node)
9
- node.class.name.split('::').last
12
+ node.class.name.split('::').last.to_sym
10
13
  end
11
14
 
12
15
  def get_source(node)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class NodeQuery
4
- VERSION = "1.13.0"
4
+ VERSION = "1.13.1"
5
5
  end
data/lib/node_query.rb CHANGED
@@ -18,7 +18,7 @@ class NodeQuery
18
18
  # @param [Hash] options options to configure
19
19
  # @option options [NodeQuery::Adapter] :adapter the adpater
20
20
  def self.configure(options)
21
- @adapter = options.adapter
21
+ @adapter = options[:adapter]
22
22
  end
23
23
 
24
24
  # Get the adapter
@@ -7,7 +7,7 @@ macros
7
7
  CLOSE_ARRAY /\)/
8
8
  OPEN_SELECTOR /\(/
9
9
  CLOSE_SELECTOR /\)/
10
- NODE_TYPE /\.[a-z]+/
10
+ NODE_TYPE /\.[a-zA-Z]+/
11
11
  IDENTIFIER /[@\*\-\.\w]*\w/
12
12
  IDENTIFIER_VALUE /[@\.\w!&:\?<>=]+/
13
13
  FALSE /false/
@@ -20,7 +20,7 @@ class NodeQueryLexer
20
20
  CLOSE_ARRAY = /\)/
21
21
  OPEN_SELECTOR = /\(/
22
22
  CLOSE_SELECTOR = /\)/
23
- NODE_TYPE = /\.[a-z]+/
23
+ NODE_TYPE = /\.[a-zA-Z]+/
24
24
  IDENTIFIER = /[@\*\-\.\w]*\w/
25
25
  IDENTIFIER_VALUE = /[@\.\w!&:\?<>=]+/
26
26
  FALSE = /false/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: node_query
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang