unparser 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Rakefile +1 -1
- data/lib/unparser.rb +1 -0
- data/lib/unparser/emitter.rb +3 -3
- data/lib/unparser/emitter/class.rb +1 -11
- data/lib/unparser/emitter/match.rb +51 -0
- data/lib/unparser/emitter/module.rb +0 -10
- 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: 213c690e6dae589a2d99f816fcb7a663c2e5b557
|
4
|
+
data.tar.gz: ff3c326def1c6da82fd4f7d85e8fd8cb8ae8b4f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fd4fd4dfb549045719c944e5c696f51678a475dac3ab80be179bf632884bde20c137948a822069788cc76ec7474d6e8e6548e6c7468e8e4c2b3549b3dc52a75
|
7
|
+
data.tar.gz: 09ea9e85f869c3e9d9a829b05e52389204278116abf5417f98f223d311ce2e1b3e0bcb54a78ff942e4bd124d80abb0518c767776506ff35d3f983f78cc8d9d5f
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ Rake::Task['metrics:mutant'].overwrite do
|
|
15
15
|
require 'mutant'
|
16
16
|
rescue LoadError
|
17
17
|
end
|
18
|
-
if defined?(Mutant)
|
18
|
+
if defined?(Mutant) and !ENV.key?('CI')
|
19
19
|
status = Mutant::CLI.run(%W(--rspec-full -r ./spec/spec_helper.rb ::Unparser))
|
20
20
|
unless status.zero?
|
21
21
|
fail "Not mutation covered :("
|
data/lib/unparser.rb
CHANGED
data/lib/unparser/emitter.rb
CHANGED
@@ -278,12 +278,12 @@ module Unparser
|
|
278
278
|
#
|
279
279
|
# @api private
|
280
280
|
#
|
281
|
-
def
|
282
|
-
|
281
|
+
def emit_body
|
282
|
+
unless body
|
283
283
|
nl
|
284
284
|
return
|
285
285
|
end
|
286
|
-
indented { visit(
|
286
|
+
indented { visit(body) }
|
287
287
|
end
|
288
288
|
|
289
289
|
# Emitter that fully relies on parser source maps
|
@@ -35,16 +35,6 @@ module Unparser
|
|
35
35
|
visit(superclass)
|
36
36
|
end
|
37
37
|
|
38
|
-
# Emit body
|
39
|
-
#
|
40
|
-
# @return [undefined]
|
41
|
-
#
|
42
|
-
# @api private
|
43
|
-
#
|
44
|
-
def emit_body
|
45
|
-
emit_non_nil_body(body)
|
46
|
-
end
|
47
|
-
|
48
38
|
end # Class
|
49
39
|
|
50
40
|
# Emitter for sclass nodes
|
@@ -63,7 +53,7 @@ module Unparser
|
|
63
53
|
def dispatch
|
64
54
|
write(K_CLASS, WS, O_DLT, WS)
|
65
55
|
visit(object)
|
66
|
-
|
56
|
+
emit_body
|
67
57
|
k_end
|
68
58
|
end
|
69
59
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Unparser
|
2
|
+
class Emitter
|
3
|
+
|
4
|
+
# Base class for special match node emitters
|
5
|
+
class Match < self
|
6
|
+
|
7
|
+
OPERATOR = '=~'.freeze
|
8
|
+
|
9
|
+
# Emitter for match with local variable assignment
|
10
|
+
class Lvasgn < self
|
11
|
+
handle :match_with_lvasgn
|
12
|
+
|
13
|
+
children :regexp, :lvasgn
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
# Perform dispatch
|
18
|
+
#
|
19
|
+
# @return [undefined]
|
20
|
+
#
|
21
|
+
# @api private
|
22
|
+
#
|
23
|
+
def dispatch
|
24
|
+
visit(regexp)
|
25
|
+
write(WS, OPERATOR, WS)
|
26
|
+
visit(lvasgn)
|
27
|
+
end
|
28
|
+
|
29
|
+
end # Lvasgn
|
30
|
+
|
31
|
+
# Emitter for match current line
|
32
|
+
class CurrentLine < self
|
33
|
+
handle :match_current_line
|
34
|
+
|
35
|
+
children :regexp
|
36
|
+
|
37
|
+
# Perform dispatch
|
38
|
+
#
|
39
|
+
# @return [undefined]
|
40
|
+
#
|
41
|
+
# @api private
|
42
|
+
#
|
43
|
+
def dispatch
|
44
|
+
visit(regexp)
|
45
|
+
end
|
46
|
+
|
47
|
+
end # CurrentLine
|
48
|
+
|
49
|
+
end # Match
|
50
|
+
end # Emitter
|
51
|
+
end # Unparser
|
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.2'
|
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.beta6')
|
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.2
|
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-17 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.beta6
|
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.beta6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: concord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/unparser/emitter/literal/range.rb
|
133
133
|
- lib/unparser/emitter/literal/regexp.rb
|
134
134
|
- lib/unparser/emitter/literal/singleton.rb
|
135
|
+
- lib/unparser/emitter/match.rb
|
135
136
|
- lib/unparser/emitter/module.rb
|
136
137
|
- lib/unparser/emitter/next.rb
|
137
138
|
- lib/unparser/emitter/not.rb
|