synvert-core 2.0.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +40 -32
- data/lib/synvert/core/rewriter/instance.rb +8 -7
- data/lib/synvert/core/version.rb +1 -1
- data/synvert-core-ruby.gemspec +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 666eb48f4d58bd41854a7f48e9aadf201321023f546b5682abe21e56ed80a204
|
4
|
+
data.tar.gz: b6a555693e36b13806d156761a7003e06a6be8104c6102fd11ac5e920a687dd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24b42ba9dd6ba2e16fc4218fbae4f333d8ac193fa4c58de8781836f4b3c7189a342a15088364071b52edf955365f0920bc4773d62f7d36e88c69b50e03f6df60
|
7
|
+
data.tar.gz: '081411c60033db6c980fe7204e0e7dde12c7110a5839c545bb59943e3da3e881a0f505cc521284f6753e8f34d47319a9e1bc582126ea27cf82e4b696b170ce3f'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 2.0.2 (2024-05-30)
|
4
|
+
|
5
|
+
* Do not raise error for prism
|
6
|
+
* Update `node_query` to 1.15.3
|
7
|
+
|
8
|
+
## 2.0.1 (2024-05-04)
|
9
|
+
|
10
|
+
* Rescue Prism and SyntaxTree parser error
|
11
|
+
* Unlock activesupport version
|
12
|
+
|
3
13
|
## 2.0.0 (2024-04-28)
|
4
14
|
|
5
15
|
* Add instance variable `Instance#current_parser`
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert-core (2.0.
|
5
|
-
activesupport
|
4
|
+
synvert-core (2.0.2)
|
5
|
+
activesupport
|
6
6
|
node_mutation (>= 1.24.4)
|
7
|
-
node_query (>= 1.15.
|
7
|
+
node_query (>= 1.15.3)
|
8
8
|
node_visitor (>= 1.0.1)
|
9
9
|
parallel
|
10
10
|
parser
|
@@ -17,20 +17,28 @@ PATH
|
|
17
17
|
GEM
|
18
18
|
remote: https://rubygems.org/
|
19
19
|
specs:
|
20
|
-
activesupport (
|
20
|
+
activesupport (7.1.3.3)
|
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.8)
|
27
33
|
coderay (1.1.3)
|
28
|
-
concurrent-ruby (1.
|
29
|
-
|
34
|
+
concurrent-ruby (1.3.1)
|
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.
|
39
|
+
ffi (1.16.3)
|
32
40
|
formatador (1.1.0)
|
33
|
-
guard (2.18.
|
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)
|
@@ -44,17 +52,18 @@ GEM
|
|
44
52
|
guard (~> 2.1)
|
45
53
|
guard-compat (~> 1.1)
|
46
54
|
rspec (>= 2.99.0, < 4.0)
|
47
|
-
i18n (1.14.
|
55
|
+
i18n (1.14.5)
|
48
56
|
concurrent-ruby (~> 1.0)
|
49
|
-
listen (3.
|
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.
|
53
|
-
method_source (1.
|
54
|
-
minitest (5.
|
60
|
+
lumberjack (1.2.10)
|
61
|
+
method_source (1.1.0)
|
62
|
+
minitest (5.23.1)
|
63
|
+
mutex_m (0.2.0)
|
55
64
|
nenv (0.3.0)
|
56
65
|
node_mutation (1.24.4)
|
57
|
-
node_query (1.15.
|
66
|
+
node_query (1.15.3)
|
58
67
|
node_visitor (1.0.1)
|
59
68
|
notiffany (0.1.3)
|
60
69
|
nenv (~> 0.1)
|
@@ -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.
|
78
|
+
prism (0.29.0)
|
70
79
|
prism_ext (0.3.2)
|
71
80
|
prism
|
72
|
-
pry (0.14.
|
81
|
+
pry (0.14.2)
|
73
82
|
coderay (~> 1.1)
|
74
83
|
method_source (~> 1.0)
|
75
|
-
racc (1.
|
84
|
+
racc (1.8.0)
|
76
85
|
rake (13.0.6)
|
77
|
-
rb-fsevent (0.11.
|
86
|
+
rb-fsevent (0.11.2)
|
78
87
|
rb-inotify (0.10.1)
|
79
88
|
ffi (~> 1.0)
|
80
|
-
rspec (3.
|
81
|
-
rspec-core (~> 3.
|
82
|
-
rspec-expectations (~> 3.
|
83
|
-
rspec-mocks (~> 3.
|
84
|
-
rspec-core (3.
|
85
|
-
rspec-support (~> 3.
|
86
|
-
rspec-expectations (3.
|
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.
|
89
|
-
rspec-mocks (3.
|
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.
|
92
|
-
rspec-support (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.
|
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 [
|
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 [
|
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 [
|
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
|
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,8 @@ 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)
|
539
|
+
result = Prism.parse(encoded_source)
|
540
|
+
result.value.statements
|
540
541
|
end
|
541
542
|
end
|
542
543
|
end
|
data/lib/synvert/core/version.rb
CHANGED
data/synvert-core-ruby.gemspec
CHANGED
@@ -19,8 +19,8 @@ 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"
|
23
|
-
spec.add_runtime_dependency "node_query", ">= 1.15.
|
22
|
+
spec.add_runtime_dependency "activesupport"
|
23
|
+
spec.add_runtime_dependency "node_query", ">= 1.15.3"
|
24
24
|
spec.add_runtime_dependency "node_mutation", ">= 1.24.4"
|
25
25
|
spec.add_runtime_dependency "node_visitor", ">= 1.0.1"
|
26
26
|
spec.add_runtime_dependency "parser"
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
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-
|
11
|
+
date: 2024-05-30 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:
|
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:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: node_query
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.15.
|
33
|
+
version: 1.15.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.15.
|
40
|
+
version: 1.15.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: node_mutation
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|