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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c12f5981aa14eb3e5339a937e5d68d21a3336381
4
- data.tar.gz: 7050a2bb94a084b42ba4504b2151e5af033d492f
3
+ metadata.gz: 213c690e6dae589a2d99f816fcb7a663c2e5b557
4
+ data.tar.gz: ff3c326def1c6da82fd4f7d85e8fd8cb8ae8b4f1
5
5
  SHA512:
6
- metadata.gz: d935d497ba084726fb355995640849c846c7074f4a7e85fed48d4843da646b5520c7046a48b139b187ab71dd35405d728bf199ba072db463ee13044dec2b0c02
7
- data.tar.gz: 9fcf5e19768a9b56ff5baa637f45e69a3868e98957768d6a01f560bee0f62f339c05c001c94e928af3c0c67e3f7b920d3f2d3e66bd08e0906cace82d3d334d0a
6
+ metadata.gz: 8fd4fd4dfb549045719c944e5c696f51678a475dac3ab80be179bf632884bde20c137948a822069788cc76ec7474d6e8e6548e6c7468e8e4c2b3549b3dc52a75
7
+ data.tar.gz: 09ea9e85f869c3e9d9a829b05e52389204278116abf5417f98f223d311ce2e1b3e0bcb54a78ff942e4bd124d80abb0518c767776506ff35d3f983f78cc8d9d5f
data/.travis.yml CHANGED
@@ -1,7 +1,6 @@
1
1
  language: ruby
2
2
  script: 'bundle exec rake spec'
3
3
  rvm:
4
- - 1.9.2
5
4
  - 1.9.3
6
5
  - 2.0.0
7
6
  - ruby-head
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
@@ -83,5 +83,6 @@ require 'unparser/emitter/case'
83
83
  require 'unparser/emitter/for'
84
84
  require 'unparser/emitter/repetition'
85
85
  require 'unparser/emitter/root'
86
+ require 'unparser/emitter/match'
86
87
 
87
88
  Unparser::Emitter::REGISTRY.freeze
@@ -278,12 +278,12 @@ module Unparser
278
278
  #
279
279
  # @api private
280
280
  #
281
- def emit_non_nil_body(node)
282
- if node.type == :nil
281
+ def emit_body
282
+ unless body
283
283
  nl
284
284
  return
285
285
  end
286
- indented { visit(node) }
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
- emit_non_nil_body(body)
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
@@ -22,16 +22,6 @@ module Unparser
22
22
  k_end
23
23
  end
24
24
 
25
- # Emit body
26
- #
27
- # @return [undefined]
28
- #
29
- # @api private
30
- #
31
- def emit_body
32
- emit_non_nil_body(body)
33
- end
34
-
35
25
  end # Module
36
26
  end # Emitter
37
27
  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.1'
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.beta5')
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.1
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-14 00:00:00.000000000 Z
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.beta5
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.beta5
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