unparser 0.2.8 → 0.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 +4 -4
- data/.circleci/config.yml +17 -0
- data/.rubocop.yml +1 -0
- data/Changelog.md +4 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +70 -64
- data/Rakefile +1 -0
- data/bin/unparser +2 -0
- data/config/devtools.yml +1 -1
- data/config/flay.yml +1 -1
- data/config/reek.yml +136 -136
- data/config/rubocop.yml +14 -1
- data/lib/unparser.rb +2 -0
- data/lib/unparser/ast.rb +8 -6
- data/lib/unparser/ast/local_variable_scope.rb +3 -1
- data/lib/unparser/buffer.rb +5 -1
- data/lib/unparser/cli.rb +8 -1
- data/lib/unparser/cli/color.rb +2 -0
- data/lib/unparser/cli/differ.rb +2 -0
- data/lib/unparser/cli/source.rb +7 -1
- data/lib/unparser/comments.rb +5 -0
- data/lib/unparser/constants.rb +8 -6
- data/lib/unparser/dsl.rb +2 -0
- data/lib/unparser/emitter.rb +18 -9
- data/lib/unparser/emitter/alias.rb +2 -0
- data/lib/unparser/emitter/argument.rb +3 -0
- data/lib/unparser/emitter/assignment.rb +5 -2
- data/lib/unparser/emitter/begin.rb +3 -1
- data/lib/unparser/emitter/binary.rb +2 -0
- data/lib/unparser/emitter/block.rb +3 -0
- data/lib/unparser/emitter/case.rb +4 -0
- data/lib/unparser/emitter/cbase.rb +2 -0
- data/lib/unparser/emitter/class.rb +3 -0
- data/lib/unparser/emitter/def.rb +3 -0
- data/lib/unparser/emitter/defined.rb +2 -0
- data/lib/unparser/emitter/empty.rb +2 -0
- data/lib/unparser/emitter/ensure.rb +2 -0
- data/lib/unparser/emitter/flipflop.rb +2 -0
- data/lib/unparser/emitter/flow_modifier.rb +3 -1
- data/lib/unparser/emitter/for.rb +2 -0
- data/lib/unparser/emitter/hookexe.rb +2 -0
- data/lib/unparser/emitter/if.rb +5 -0
- data/lib/unparser/emitter/literal.rb +2 -0
- data/lib/unparser/emitter/literal/array.rb +5 -4
- data/lib/unparser/emitter/literal/dynamic.rb +2 -0
- data/lib/unparser/emitter/literal/dynamic_body.rb +2 -0
- data/lib/unparser/emitter/literal/execute_string.rb +2 -0
- data/lib/unparser/emitter/literal/hash.rb +3 -2
- data/lib/unparser/emitter/literal/primitive.rb +3 -1
- data/lib/unparser/emitter/literal/range.rb +2 -0
- data/lib/unparser/emitter/literal/regexp.rb +2 -0
- data/lib/unparser/emitter/literal/singleton.rb +2 -0
- data/lib/unparser/emitter/match.rb +2 -0
- data/lib/unparser/emitter/meta.rb +2 -0
- data/lib/unparser/emitter/module.rb +2 -0
- data/lib/unparser/emitter/op_assign.rb +2 -0
- data/lib/unparser/emitter/redo.rb +2 -0
- data/lib/unparser/emitter/repetition.rb +4 -1
- data/lib/unparser/emitter/resbody.rb +4 -24
- data/lib/unparser/emitter/rescue.rb +5 -2
- data/lib/unparser/emitter/retry.rb +2 -0
- data/lib/unparser/emitter/root.rb +2 -0
- data/lib/unparser/emitter/send.rb +3 -0
- data/lib/unparser/emitter/send/arguments.rb +2 -0
- data/lib/unparser/emitter/send/attribute_assignment.rb +2 -0
- data/lib/unparser/emitter/send/binary.rb +2 -0
- data/lib/unparser/emitter/send/conditional.rb +2 -0
- data/lib/unparser/emitter/send/index.rb +2 -0
- data/lib/unparser/emitter/send/regular.rb +3 -0
- data/lib/unparser/emitter/send/unary.rb +5 -3
- data/lib/unparser/emitter/splat.rb +2 -0
- data/lib/unparser/emitter/super.rb +2 -0
- data/lib/unparser/emitter/undef.rb +2 -0
- data/lib/unparser/emitter/variable.rb +3 -0
- data/lib/unparser/emitter/yield.rb +3 -0
- data/lib/unparser/finalize.rb +2 -0
- data/lib/unparser/node_helpers.rb +6 -0
- data/lib/unparser/preprocessor.rb +3 -0
- data/spec/integrations.yml +3 -1
- data/spec/unit/unparser_spec.rb +3 -7
- data/unparser.gemspec +3 -3
- metadata +6 -6
- data/circle.yml +0 -6
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Unparser
|
2
4
|
class Emitter
|
3
5
|
class Send
|
@@ -8,8 +10,8 @@ module Unparser
|
|
8
10
|
private
|
9
11
|
|
10
12
|
MAP = IceNine.deep_freeze(
|
11
|
-
|
12
|
-
|
13
|
+
'-@': '-',
|
14
|
+
'+@': '+'
|
13
15
|
)
|
14
16
|
|
15
17
|
# Perform dispatch
|
@@ -21,7 +23,7 @@ module Unparser
|
|
21
23
|
def dispatch
|
22
24
|
name = selector
|
23
25
|
write(MAP.fetch(name, name).to_s)
|
24
|
-
if receiver.type.equal?(:int) && selector.equal?(:'+@')
|
26
|
+
if receiver.type.equal?(:int) && selector.equal?(:'+@')
|
25
27
|
write('+')
|
26
28
|
end
|
27
29
|
|
data/lib/unparser/finalize.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Unparser
|
2
4
|
module NodeHelpers
|
3
5
|
|
@@ -9,6 +11,8 @@ module Unparser
|
|
9
11
|
#
|
10
12
|
# @api private
|
11
13
|
#
|
14
|
+
# ignore :reek:UncommunicativeMethodName
|
15
|
+
# ignore :reek:UtilityFunction
|
12
16
|
def s(type, *children)
|
13
17
|
Parser::AST::Node.new(type, children)
|
14
18
|
end
|
@@ -21,6 +25,8 @@ module Unparser
|
|
21
25
|
#
|
22
26
|
# @api private
|
23
27
|
#
|
28
|
+
# ignore :reek:UncommunicativeMethodName
|
29
|
+
# ignore :reek:UtilityFunction
|
24
30
|
def n(type, children = [])
|
25
31
|
Parser::AST::Node.new(type, children)
|
26
32
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Unparser
|
2
4
|
# Preprocessor to normalize AST generated by parser
|
3
5
|
class Preprocessor
|
@@ -23,6 +25,7 @@ module Unparser
|
|
23
25
|
#
|
24
26
|
def self.run(node, parent_type = nil)
|
25
27
|
return EMPTY if node.nil?
|
28
|
+
|
26
29
|
REGISTRY.fetch(node.type, [Noop]).reduce(node) do |current, processor|
|
27
30
|
processor.call(current, parent_type)
|
28
31
|
end
|
data/spec/integrations.yml
CHANGED
@@ -57,9 +57,9 @@
|
|
57
57
|
- core/string/shared/succ.rb
|
58
58
|
- core/string/shared/to_sym.rb
|
59
59
|
- core/string/squeeze_spec.rb
|
60
|
-
- core/string/unpack/{b,c,h,m}_spec.rb
|
61
60
|
- core/string/unpack/shared/float.rb
|
62
61
|
- core/string/unpack/shared/integer.rb
|
62
|
+
- core/string/unpack/{b,c,h,m}_spec.rb
|
63
63
|
- core/string/unpack/{u,w}_spec.rb
|
64
64
|
- core/symbol/casecmp_spec.rb
|
65
65
|
- core/time/_dump_spec.rb
|
@@ -69,6 +69,7 @@
|
|
69
69
|
- language/for_spec.rb
|
70
70
|
- language/regexp/encoding_spec.rb
|
71
71
|
- language/regexp/escapes_spec.rb
|
72
|
+
- language/source_encoding_spec.rb
|
72
73
|
- language/string_spec.rb
|
73
74
|
- library/digest/md5/shared/constants.rb
|
74
75
|
- library/digest/md5/shared/sample.rb
|
@@ -83,3 +84,4 @@
|
|
83
84
|
- library/stringscanner/shared/get_byte.rb
|
84
85
|
- library/zlib/inflate/set_dictionary_spec.rb
|
85
86
|
- optional/capi/integer_spec.rb
|
87
|
+
- security/cve_2010_1330_spec.rb
|
data/spec/unit/unparser_spec.rb
CHANGED
@@ -6,9 +6,7 @@ describe Unparser, mutant_expression: 'Unparser::Emitter*' do
|
|
6
6
|
describe '.unparse' do
|
7
7
|
|
8
8
|
RUBY_VERSION_PARSERS = IceNine.deep_freeze(
|
9
|
-
'2.
|
10
|
-
'2.2' => Parser::Ruby22,
|
11
|
-
'2.3' => Parser::Ruby23
|
9
|
+
'2.5' => Parser::Ruby25
|
12
10
|
)
|
13
11
|
|
14
12
|
RUBY_VERSIONS = RUBY_VERSION_PARSERS.keys.freeze
|
@@ -468,10 +466,8 @@ describe Unparser, mutant_expression: 'Unparser::Emitter*' do
|
|
468
466
|
end
|
469
467
|
|
470
468
|
context 'conditional send (csend)' do
|
471
|
-
|
472
|
-
|
473
|
-
assert_terminated 'a&.b(c)'
|
474
|
-
end
|
469
|
+
assert_terminated 'a&.b'
|
470
|
+
assert_terminated 'a&.b(c)'
|
475
471
|
end
|
476
472
|
|
477
473
|
context 'send' do
|
data/unparser.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'unparser'
|
3
|
-
gem.version = '0.
|
3
|
+
gem.version = '0.3.0'
|
4
4
|
|
5
5
|
gem.authors = ['Markus Schirp']
|
6
6
|
gem.email = 'mbj@schirp-dso.com'
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.extra_rdoc_files = %w[README.md]
|
17
17
|
gem.executables = %w[unparser]
|
18
18
|
|
19
|
-
gem.required_ruby_version = '>= 2.
|
19
|
+
gem.required_ruby_version = '>= 2.5'
|
20
20
|
|
21
21
|
gem.add_dependency('abstract_type', '~> 0.0.7')
|
22
22
|
gem.add_dependency('adamantium', '~> 0.2.0')
|
@@ -27,6 +27,6 @@ Gem::Specification.new do |gem|
|
|
27
27
|
gem.add_dependency('procto', '~> 0.0.2')
|
28
28
|
|
29
29
|
gem.add_development_dependency('anima', '~> 0.3.0')
|
30
|
-
gem.add_development_dependency('devtools', '~> 0.1.
|
30
|
+
gem.add_development_dependency('devtools', '~> 0.1.21')
|
31
31
|
gem.add_development_dependency('morpher', '~> 0.2.6')
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: abstract_type
|
@@ -134,14 +134,14 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: 0.1.
|
137
|
+
version: 0.1.21
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 0.1.
|
144
|
+
version: 0.1.21
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: morpher
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +164,7 @@ extensions: []
|
|
164
164
|
extra_rdoc_files:
|
165
165
|
- README.md
|
166
166
|
files:
|
167
|
+
- ".circleci/config.yml"
|
167
168
|
- ".gitignore"
|
168
169
|
- ".rspec"
|
169
170
|
- ".rubocop.yml"
|
@@ -174,7 +175,6 @@ files:
|
|
174
175
|
- README.md
|
175
176
|
- Rakefile
|
176
177
|
- bin/unparser
|
177
|
-
- circle.yml
|
178
178
|
- config/devtools.yml
|
179
179
|
- config/flay.yml
|
180
180
|
- config/flog.yml
|
@@ -279,7 +279,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
279
279
|
requirements:
|
280
280
|
- - ">="
|
281
281
|
- !ruby/object:Gem::Version
|
282
|
-
version: '2.
|
282
|
+
version: '2.5'
|
283
283
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
284
284
|
requirements:
|
285
285
|
- - ">="
|