unparser 0.6.2 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/unparser/emitter/argument.rb +1 -1
- data/lib/unparser/emitter/block.rb +1 -1
- data/lib/unparser/emitter/find_pattern.rb +18 -0
- data/lib/unparser/emitter/match_pattern.rb +11 -3
- data/lib/unparser/emitter/match_pattern_p.rb +20 -0
- data/lib/unparser/emitter/match_rest.rb +7 -0
- data/lib/unparser.rb +2 -0
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd425c8abea3ba512e8652c7f913b5ed09b5254fa868358f000f3af1fcd3ed82
|
4
|
+
data.tar.gz: caf2e58c2f862bd94f63d3290876b61620cf100a22c88a07d3916d87f253c0c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f45782eed90b778fbde30cdbd90f388a4b9f649e0080c26618e9243014618774d3afd9eb2076c7a47d0a0d43e137d1940382c85d0dea0915afa232f87d9e950d
|
7
|
+
data.tar.gz: 2fda013558e05453f9ea1540b64bb51a9bd9269f6166395bd92f775aed3523abc5878b1c92c5ba4f0352842b6b4fb532f317f8a5d54aa108822f94dfcb7d9e9a
|
data/README.md
CHANGED
@@ -15,8 +15,8 @@ module Unparser
|
|
15
15
|
emit_target
|
16
16
|
ws
|
17
17
|
write_open
|
18
|
-
target_writer.emit_heredoc_reminders if n_send?(target)
|
19
18
|
emit_block_arguments unless n_lambda?(target)
|
19
|
+
target_writer.emit_heredoc_reminders if n_send?(target)
|
20
20
|
emit_optional_body_ensure_rescue(body)
|
21
21
|
write_close
|
22
22
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Unparser
|
4
|
+
class Emitter
|
5
|
+
# Emitter for in pattern nodes
|
6
|
+
class FindPattern < self
|
7
|
+
handle :find_pattern
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def dispatch
|
12
|
+
write('[')
|
13
|
+
delimited(children)
|
14
|
+
write(']')
|
15
|
+
end
|
16
|
+
end # FindPattern
|
17
|
+
end # Emitter
|
18
|
+
end # Unparser
|
@@ -6,17 +6,25 @@ module Unparser
|
|
6
6
|
class MatchPattern < self
|
7
7
|
|
8
8
|
handle :match_pattern
|
9
|
-
handle :match_pattern_p
|
10
9
|
|
11
10
|
children :target, :pattern
|
12
11
|
|
12
|
+
# Modern ast format emits `match_pattern`
|
13
|
+
# node on single line pre 3.0, but 3.0+ uses `match_pattern_p`
|
14
|
+
SYMBOL =
|
15
|
+
if RUBY_VERSION < '3.0'
|
16
|
+
' in '
|
17
|
+
else
|
18
|
+
' => '
|
19
|
+
end
|
20
|
+
|
13
21
|
private
|
14
22
|
|
15
23
|
def dispatch
|
16
24
|
visit(target)
|
17
|
-
write(
|
25
|
+
write(SYMBOL)
|
18
26
|
visit(pattern)
|
19
27
|
end
|
20
|
-
end #
|
28
|
+
end # MatchPattern
|
21
29
|
end # Emitter
|
22
30
|
end # Unparser
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Unparser
|
4
|
+
class Emitter
|
5
|
+
class MatchPatternP < self
|
6
|
+
|
7
|
+
handle :match_pattern_p
|
8
|
+
|
9
|
+
children :target, :pattern
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def dispatch
|
14
|
+
visit(target)
|
15
|
+
write(' in ')
|
16
|
+
visit(pattern)
|
17
|
+
end
|
18
|
+
end # MatchPatternP
|
19
|
+
end # Emitter
|
20
|
+
end # Unparser
|
@@ -4,8 +4,15 @@ module Unparser
|
|
4
4
|
class Emitter
|
5
5
|
# Emiter for match rest nodes
|
6
6
|
class MatchRest < self
|
7
|
+
handle :match_rest
|
8
|
+
|
7
9
|
children :match_var
|
8
10
|
|
11
|
+
def dispatch
|
12
|
+
write('*')
|
13
|
+
visit(match_var) if match_var
|
14
|
+
end
|
15
|
+
|
9
16
|
def emit_array_pattern
|
10
17
|
write('*')
|
11
18
|
emit_match_var
|
data/lib/unparser.rb
CHANGED
@@ -218,7 +218,9 @@ require 'unparser/emitter/xstr'
|
|
218
218
|
require 'unparser/emitter/yield'
|
219
219
|
require 'unparser/emitter/kwargs'
|
220
220
|
require 'unparser/emitter/pair'
|
221
|
+
require 'unparser/emitter/find_pattern'
|
221
222
|
require 'unparser/emitter/match_pattern'
|
223
|
+
require 'unparser/emitter/match_pattern_p'
|
222
224
|
require 'unparser/writer'
|
223
225
|
require 'unparser/writer/binary'
|
224
226
|
require 'unparser/writer/dynamic_string'
|
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.6.
|
4
|
+
version: 0.6.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:
|
11
|
+
date: 2022-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: 3.1.0
|
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: 3.
|
40
|
+
version: 3.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mutant
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.11.
|
47
|
+
version: 0.11.4
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.11.
|
54
|
+
version: 0.11.4
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mutant-rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.11.
|
61
|
+
version: 0.11.4
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.11.
|
68
|
+
version: 0.11.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- lib/unparser/emitter/defined.rb
|
185
185
|
- lib/unparser/emitter/dstr.rb
|
186
186
|
- lib/unparser/emitter/dsym.rb
|
187
|
+
- lib/unparser/emitter/find_pattern.rb
|
187
188
|
- lib/unparser/emitter/flipflop.rb
|
188
189
|
- lib/unparser/emitter/float.rb
|
189
190
|
- lib/unparser/emitter/flow_modifier.rb
|
@@ -203,6 +204,7 @@ files:
|
|
203
204
|
- lib/unparser/emitter/match_alt.rb
|
204
205
|
- lib/unparser/emitter/match_as.rb
|
205
206
|
- lib/unparser/emitter/match_pattern.rb
|
207
|
+
- lib/unparser/emitter/match_pattern_p.rb
|
206
208
|
- lib/unparser/emitter/match_rest.rb
|
207
209
|
- lib/unparser/emitter/match_var.rb
|
208
210
|
- lib/unparser/emitter/mlhs.rb
|
@@ -257,7 +259,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
257
259
|
requirements:
|
258
260
|
- - ">="
|
259
261
|
- !ruby/object:Gem::Version
|
260
|
-
version: '2.
|
262
|
+
version: '2.7'
|
261
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
264
|
requirements:
|
263
265
|
- - ">="
|