synvert-core 2.0.0 → 2.0.1

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: 8e5f40c698306314082157a4b976ff37e9adf84bb81e1915b7ffd319cbac227a
4
- data.tar.gz: 326fd1445561b81a70c9ed88ccd710c9103985f31e3349dccbc12688734b6630
3
+ metadata.gz: 4b4d94b7a468dff6d9a4d67bd45cef5414c764bc6b600dc9721f41195826d4f9
4
+ data.tar.gz: 201884db7550acfda6b6c3d29fa64b1e19109b65cc2efda03f10c2505a489a89
5
5
  SHA512:
6
- metadata.gz: a296c2ea8fa640b117d409361dd7148bffaf63bf5ac7e7d90f636a83b40f6d32b2294a3bfd185b86bdc6a242179eed0ebf8325e78e9c6b90965932f97ed8358a
7
- data.tar.gz: 5bfd5bf3f26f8a13dd595bb4428fa6c6a76a04e4d148cb1b45b286d2a437ca93ba608075edcafa8355f88fec7d7483e19ea0a312157c22bb007d320a0a50fb15
6
+ metadata.gz: 675fdcfbc851c74fa5e4e3b93aefeabe2d762c88fc70a1871e270b1dc18950388f19a80b1674145d34cdd96516e49aa67a265ccf7145d734002a2c58c7a26710
7
+ data.tar.gz: c0075e8fa2c2fa313b22a0db9021d4ea7cb31794beb9a5d913be9161eff9e120e7a8b76d33dbf68afbad4c00c6f564e1613d5e820069b5d0ae71ec8997c174c0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.0.1 (2024-05-04)
4
+
5
+ * Rescue Prism and SyntaxTree parser error
6
+ * Unlock activesupport version
7
+
3
8
  ## 2.0.0 (2024-04-28)
4
9
 
5
10
  * Add instance variable `Instance#current_parser`
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert-core (2.0.0)
5
- activesupport (< 7.0.0)
4
+ synvert-core (2.0.1)
5
+ activesupport
6
6
  node_mutation (>= 1.24.4)
7
7
  node_query (>= 1.15.2)
8
8
  node_visitor (>= 1.0.1)
@@ -17,20 +17,28 @@ PATH
17
17
  GEM
18
18
  remote: https://rubygems.org/
19
19
  specs:
20
- activesupport (6.1.7.7)
20
+ activesupport (7.1.3.2)
21
+ base64
22
+ bigdecimal
21
23
  concurrent-ruby (~> 1.0, >= 1.0.2)
24
+ connection_pool (>= 2.2.5)
25
+ drb
22
26
  i18n (>= 1.6, < 2)
23
27
  minitest (>= 5.1)
28
+ mutex_m
24
29
  tzinfo (~> 2.0)
25
- zeitwerk (~> 2.3)
26
30
  ast (2.4.2)
31
+ base64 (0.2.0)
32
+ bigdecimal (3.1.7)
27
33
  coderay (1.1.3)
28
34
  concurrent-ruby (1.2.3)
29
- diff-lcs (1.5.0)
35
+ connection_pool (2.4.1)
36
+ diff-lcs (1.5.1)
37
+ drb (2.2.1)
30
38
  fakefs (2.4.0)
31
- ffi (1.15.5)
39
+ ffi (1.16.3)
32
40
  formatador (1.1.0)
33
- guard (2.18.0)
41
+ guard (2.18.1)
34
42
  formatador (>= 0.2.4)
35
43
  listen (>= 2.7, < 4.0)
36
44
  lumberjack (>= 1.0.12, < 2.0)
@@ -46,12 +54,13 @@ GEM
46
54
  rspec (>= 2.99.0, < 4.0)
47
55
  i18n (1.14.4)
48
56
  concurrent-ruby (~> 1.0)
49
- listen (3.7.1)
57
+ listen (3.9.0)
50
58
  rb-fsevent (~> 0.10, >= 0.10.3)
51
59
  rb-inotify (~> 0.9, >= 0.9.10)
52
- lumberjack (1.2.8)
53
- method_source (1.0.0)
60
+ lumberjack (1.2.10)
61
+ method_source (1.1.0)
54
62
  minitest (5.22.3)
63
+ mutex_m (0.2.0)
55
64
  nenv (0.3.0)
56
65
  node_mutation (1.24.4)
57
66
  node_query (1.15.2)
@@ -66,39 +75,38 @@ GEM
66
75
  parser_node_ext (1.3.2)
67
76
  parser
68
77
  prettier_print (1.2.1)
69
- prism (0.27.0)
78
+ prism (0.28.0)
70
79
  prism_ext (0.3.2)
71
80
  prism
72
- pry (0.14.1)
81
+ pry (0.14.2)
73
82
  coderay (~> 1.1)
74
83
  method_source (~> 1.0)
75
84
  racc (1.7.3)
76
85
  rake (13.0.6)
77
- rb-fsevent (0.11.1)
86
+ rb-fsevent (0.11.2)
78
87
  rb-inotify (0.10.1)
79
88
  ffi (~> 1.0)
80
- rspec (3.10.0)
81
- rspec-core (~> 3.10.0)
82
- rspec-expectations (~> 3.10.0)
83
- rspec-mocks (~> 3.10.0)
84
- rspec-core (3.10.2)
85
- rspec-support (~> 3.10.0)
86
- rspec-expectations (3.10.2)
89
+ rspec (3.13.0)
90
+ rspec-core (~> 3.13.0)
91
+ rspec-expectations (~> 3.13.0)
92
+ rspec-mocks (~> 3.13.0)
93
+ rspec-core (3.13.0)
94
+ rspec-support (~> 3.13.0)
95
+ rspec-expectations (3.13.0)
87
96
  diff-lcs (>= 1.2.0, < 2.0)
88
- rspec-support (~> 3.10.0)
89
- rspec-mocks (3.10.2)
97
+ rspec-support (~> 3.13.0)
98
+ rspec-mocks (3.13.0)
90
99
  diff-lcs (>= 1.2.0, < 2.0)
91
- rspec-support (~> 3.10.0)
92
- rspec-support (3.10.3)
100
+ rspec-support (~> 3.13.0)
101
+ rspec-support (3.13.1)
93
102
  shellany (0.0.1)
94
103
  syntax_tree (6.2.0)
95
104
  prettier_print (>= 1.2.0)
96
105
  syntax_tree_ext (0.8.2)
97
106
  syntax_tree
98
- thor (1.2.1)
107
+ thor (1.3.1)
99
108
  tzinfo (2.0.6)
100
109
  concurrent-ruby (~> 1.0)
101
- zeitwerk (2.6.13)
102
110
 
103
111
  PLATFORMS
104
112
  ruby
@@ -73,7 +73,7 @@ module Synvert::Core
73
73
  write_source(absolute_file_path, result.new_source)
74
74
  end
75
75
  break unless result.conflicted?
76
- rescue Parser::SyntaxError => e
76
+ rescue Parser::SyntaxError, Prism::ParseError, SyntaxTree::Parser::ParseError => e
77
77
  if ENV['DEBUG'] == 'true'
78
78
  puts "[Warn] file #{file_path} was not parsed correctly."
79
79
  puts e.message
@@ -104,7 +104,7 @@ module Synvert::Core
104
104
  result = Configuration.test_result == 'new_source' ? @current_mutation.process : @current_mutation.test
105
105
  result.file_path = file_path
106
106
  result
107
- rescue Parser::SyntaxError => e
107
+ rescue Parser::SyntaxError, Prism::ParseError, SyntaxTree::Parser::ParseError => e
108
108
  if ENV['DEBUG'] == 'true'
109
109
  puts "[Warn] file #{file_path} was not parsed correctly."
110
110
  puts e.message
@@ -114,7 +114,7 @@ module Synvert::Core
114
114
 
115
115
  # Gets current node, it allows to get current node in block code.
116
116
  #
117
- # @return [Parser::AST::Node]
117
+ # @return [Node]
118
118
  def node
119
119
  @current_node
120
120
  end
@@ -128,7 +128,7 @@ module Synvert::Core
128
128
 
129
129
  # Set current_node to node and process.
130
130
  #
131
- # @param node [Parser::AST::Node] node set to current_node
131
+ # @param node [Node] node set to current_node
132
132
  # @yield process
133
133
  def process_with_node(node)
134
134
  self.current_node = node
@@ -138,7 +138,7 @@ module Synvert::Core
138
138
 
139
139
  # Set current_node properly, process and set current_node back to original current_node.
140
140
  #
141
- # @param node [Parser::AST::Node] node set to other_node
141
+ # @param node [Node] node set to other_node
142
142
  # @yield process
143
143
  def process_with_other_node(node)
144
144
  original_node = current_node
@@ -168,7 +168,7 @@ module Synvert::Core
168
168
  # @yield run on the matching nodes.
169
169
  def within_node(nql_or_rules, options = {}, &block)
170
170
  Rewriter::WithinScope.new(self, nql_or_rules, options, &block).process
171
- rescue NodeQueryLexer::ScanError, Racc::ParseError => e
171
+ rescue NodeQueryLexer::ScanError, Racc::ParseError
172
172
  raise NodeQuery::Compiler::ParseError, "Invalid query string: #{nql_or_rules}"
173
173
  end
174
174
 
@@ -536,7 +536,10 @@ module Synvert::Core
536
536
  # @param encoded_source [String] encoded source code
537
537
  # @return [Node] ast node for file
538
538
  def parse_code_by_prism(_file_path, encoded_source)
539
- Prism.parse(encoded_source).value.statements
539
+ result = Prism.parse(encoded_source)
540
+ return result.value.statements if result.errors.empty?
541
+
542
+ raise result.errors.last
540
543
  end
541
544
  end
542
545
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '2.0.0'
5
+ VERSION = '2.0.1'
6
6
  end
7
7
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency "activesupport", "< 7.0.0"
22
+ spec.add_runtime_dependency "activesupport"
23
23
  spec.add_runtime_dependency "node_query", ">= 1.15.2"
24
24
  spec.add_runtime_dependency "node_mutation", ">= 1.24.4"
25
25
  spec.add_runtime_dependency "node_visitor", ">= 1.0.1"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synvert-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-28 00:00:00.000000000 Z
11
+ date: 2024-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "<"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 7.0.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: node_query
29
29
  requirement: !ruby/object:Gem::Requirement