unparser 0.0.4 → 0.0.5
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/Gemfile.devtools +13 -13
- data/LICENSE +20 -0
- data/README.md +25 -5
- data/Rakefile +1 -1
- data/config/flog.yml +1 -1
- data/lib/unparser/emitter/begin.rb +5 -1
- data/spec/integration/unparser/spike_spec.rb +10 -3
- data/unparser.gemspec +2 -2
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 542027219be6631d4a41c34550f0b6cbf0c1335b
|
4
|
+
data.tar.gz: 622b9928d15fd69b03532eca141ea7e13e2f606f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94566c0a67b0b1f47fc0a80248b2bcac686ec2e63f07e36ea258f034190e989cebde63c332a620caa42269556c7de4504f5225670d38c973f4b62f5e59f2b246
|
7
|
+
data.tar.gz: 633ec7ea22ade4ed28dd99796de71ac8088b94d389aa6edff71ae1934f2dff93576ab36b9681b2f15ddd2755d3bd9683d03efb69ceee7699f4be37f027823273
|
data/Gemfile.devtools
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
group :development do
|
4
|
-
gem 'rake', '~> 10.0
|
4
|
+
gem 'rake', '~> 10.1.0'
|
5
5
|
gem 'rspec', '~> 2.13.0'
|
6
6
|
gem 'yard', '~> 0.8.6.1'
|
7
7
|
end
|
@@ -11,12 +11,12 @@ group :yard do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
group :guard do
|
14
|
-
gem 'guard', '~> 1.8.
|
14
|
+
gem 'guard', '~> 1.8.1'
|
15
15
|
gem 'guard-bundler', '~> 1.0.0'
|
16
|
-
gem 'guard-rspec', '~>
|
16
|
+
gem 'guard-rspec', '~> 3.0.2'
|
17
17
|
|
18
18
|
# file system change event handling
|
19
|
-
gem 'listen', '~> 1.
|
19
|
+
gem 'listen', '~> 1.2.2'
|
20
20
|
gem 'rb-fchange', '~> 0.0.6', :require => false
|
21
21
|
gem 'rb-fsevent', '~> 0.9.3', :require => false
|
22
22
|
gem 'rb-inotify', '~> 0.9.0', :require => false
|
@@ -28,20 +28,20 @@ group :guard do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
group :metrics do
|
31
|
-
gem 'backports',
|
32
|
-
gem 'coveralls',
|
33
|
-
gem 'flay',
|
34
|
-
gem 'flog',
|
35
|
-
gem 'reek',
|
36
|
-
gem 'simplecov',
|
37
|
-
gem 'yardstick',
|
31
|
+
gem 'backports', '~> 3.3', '>= 3.3.2'
|
32
|
+
gem 'coveralls', '~> 0.6.7'
|
33
|
+
gem 'flay', '~> 2.3.0'
|
34
|
+
gem 'flog', '~> 4.1.0'
|
35
|
+
gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git'
|
36
|
+
gem 'simplecov', '~> 0.7.1'
|
37
|
+
gem 'yardstick', '~> 0.9.6'
|
38
38
|
|
39
39
|
platforms :ruby_19 do
|
40
40
|
gem 'yard-spellcheck', '~> 0.1.5'
|
41
41
|
end
|
42
42
|
|
43
|
-
platforms :
|
44
|
-
gem 'mutant', '~> 0.
|
43
|
+
platforms :ruby_19, :ruby_20 do
|
44
|
+
gem 'mutant', '~> 0.3.beta4'
|
45
45
|
end
|
46
46
|
|
47
47
|
platforms :rbx do
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Markus Schirp
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -5,19 +5,39 @@ unparser
|
|
5
5
|
[](https://gemnasium.com/mbj/unparser)
|
6
6
|
[](https://codeclimate.com/github/mbj/unparser)
|
7
7
|
|
8
|
-
Generate equivalent
|
8
|
+
Generate equivalent source for ASTs from whitequarks awesome [parser](https://github.com/whitequark/parser).
|
9
9
|
|
10
10
|
Usage
|
11
11
|
-----
|
12
12
|
|
13
|
-
|
13
|
+
```ruby
|
14
|
+
require 'unparser'
|
15
|
+
Unparser.unparse(your_ast) # => "the code"
|
16
|
+
```
|
17
|
+
|
18
|
+
Equivalent vs identical:
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
require 'unparser'
|
22
|
+
|
23
|
+
code = <<-RUBY
|
24
|
+
%w(foo bar)
|
25
|
+
RUBY
|
26
|
+
|
27
|
+
node = Parser::CurrentRuby.parse(code)
|
28
|
+
|
29
|
+
generated = Unparser.unparse(node) # ["foo", "bar"], NOT %w(foo bar) !
|
30
|
+
|
31
|
+
code == generated # false, not identical code
|
32
|
+
Parser::CurrentRuby.parse(generated) == node # true, but identical AST
|
33
|
+
```
|
34
|
+
|
35
|
+
Summary: unparser does not reproduce your source! It produces equivalent source.
|
14
36
|
|
15
37
|
Installation
|
16
38
|
------------
|
17
39
|
|
18
|
-
|
19
|
-
|
20
|
-
```gem 'unparser', :git => 'https://github.com/mbj/unparser'```
|
40
|
+
Install the gem `unparser` via your prefered method.
|
21
41
|
|
22
42
|
Credits
|
23
43
|
-------
|
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ Rake::Task['metrics:mutant'].overwrite do
|
|
16
16
|
rescue LoadError
|
17
17
|
end
|
18
18
|
if defined?(Mutant) and !ENV.key?('CI')
|
19
|
-
status = Mutant::CLI.run(%W(--rspec-full
|
19
|
+
status = Mutant::CLI.run(%W(--rspec-full ::Unparser))
|
20
20
|
unless status.zero?
|
21
21
|
fail "Not mutation covered :("
|
22
22
|
end
|
data/config/flog.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
---
|
2
|
-
threshold:
|
2
|
+
threshold: 11.8
|
@@ -418,6 +418,13 @@ describe Unparser, 'spike' do
|
|
418
418
|
end
|
419
419
|
RUBY
|
420
420
|
|
421
|
+
assert_source <<-RUBY
|
422
|
+
begin
|
423
|
+
bar
|
424
|
+
rescue LoadError
|
425
|
+
end
|
426
|
+
RUBY
|
427
|
+
|
421
428
|
assert_source <<-RUBY
|
422
429
|
begin
|
423
430
|
bar
|
@@ -822,7 +829,7 @@ describe Unparser, 'spike' do
|
|
822
829
|
RUBY
|
823
830
|
end
|
824
831
|
|
825
|
-
context 'binary
|
832
|
+
context 'binary operator methods' do
|
826
833
|
%w(+ - * / & | << >> == === != <= < <=> > >= =~ !~ ^ **).each do |operator|
|
827
834
|
rubies = RUBIES - (%w(!= !~).include?(operator) ? %w(1.8) : [])
|
828
835
|
assert_source "1 #{operator} 2", rubies
|
@@ -834,12 +841,12 @@ describe Unparser, 'spike' do
|
|
834
841
|
end
|
835
842
|
end
|
836
843
|
|
837
|
-
|
844
|
+
context 'binary operator' do
|
838
845
|
assert_source '((a) || (break(foo)))'
|
839
846
|
assert_source '((break(foo)) || (a))'
|
840
847
|
assert_source '((a) || (b)).foo'
|
841
848
|
assert_source '((a) || (((b) || (c))))'
|
842
|
-
|
849
|
+
end
|
843
850
|
|
844
851
|
{ :or => :'||', :and => :'&&' }.each do |word, symbol|
|
845
852
|
assert_generates "a #{word} break foo", "((a) #{symbol} (break(foo)))"
|
data/unparser.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'unparser'
|
5
|
-
s.version = '0.0.
|
5
|
+
s.version = '0.0.5'
|
6
6
|
|
7
7
|
s.authors = ['Markus Schirp']
|
8
8
|
s.email = 'mbj@schir-dso.com'
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.require_paths = %w(lib)
|
17
17
|
s.extra_rdoc_files = %w(README.md)
|
18
18
|
|
19
|
-
s.add_dependency('parser', '~> 2.0.0.
|
19
|
+
s.add_dependency('parser', '~> 2.0.0.beta9')
|
20
20
|
s.add_dependency('concord', '~> 0.1.0')
|
21
21
|
s.add_dependency('adamantium', '~> 0.0.7')
|
22
22
|
s.add_dependency('equalizer', '~> 0.0.5')
|
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.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.0.
|
19
|
+
version: 2.0.0.beta9
|
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: 2.0.0.
|
26
|
+
version: 2.0.0.beta9
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: concord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- Gemfile
|
96
96
|
- Gemfile.devtools
|
97
97
|
- Guardfile
|
98
|
+
- LICENSE
|
98
99
|
- README.md
|
99
100
|
- Rakefile
|
100
101
|
- TODO
|