oppen 0.9.4 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/oppen/print_stack.rb +9 -2
- data/lib/oppen/version.rb +1 -1
- data/lib/wadler/print.rb +9 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 209072194fbb082bd25f2583b7f930e38c79ca042c21e711e18dd7295ee00e86
|
4
|
+
data.tar.gz: 6eeb620d7d3bd6599477a46a2a5b9df86db2bc8c6a0f07a619d065245393127f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2f8d7bd7b199b7ef0d5a97feebbe456fea9e557f6535760ad84b21a304d73c52ea954f392e7c07e0b682844fe86c0c8ccc4ef6786057785cba9f02f58c31c14
|
7
|
+
data.tar.gz: 31a73892d3afff56d85c60a6756d6fedbd2bce259d7ca259b662a7f7002549fcb53146f2fb1a32136ae2c8cca03b20ded90d95a814363d18d0d80192db79c39b
|
data/lib/oppen/print_stack.rb
CHANGED
@@ -53,6 +53,7 @@ module Oppen
|
|
53
53
|
else
|
54
54
|
->(n) { space * n }
|
55
55
|
end
|
56
|
+
@indent = 0
|
56
57
|
@items = []
|
57
58
|
@new_line = new_line
|
58
59
|
@width = width
|
@@ -177,7 +178,13 @@ module Oppen
|
|
177
178
|
#
|
178
179
|
# @see Token::String
|
179
180
|
def handle_string(token, token_width)
|
181
|
+
return if token.value.empty?
|
182
|
+
|
180
183
|
@space = [0, space - token_width].max
|
184
|
+
if @indent.positive?
|
185
|
+
indent @indent
|
186
|
+
@indent = 0
|
187
|
+
end
|
181
188
|
write token
|
182
189
|
end
|
183
190
|
|
@@ -223,9 +230,9 @@ module Oppen
|
|
223
230
|
write new_line
|
224
231
|
if config&.indent_anchor == Config::IndentAnchor::ON_BEGIN
|
225
232
|
@space = width - top.offset - amount
|
226
|
-
indent width - space
|
233
|
+
@indent = width - space
|
227
234
|
else
|
228
|
-
indent amount
|
235
|
+
@indent = amount
|
229
236
|
end
|
230
237
|
end
|
231
238
|
|
data/lib/oppen/version.rb
CHANGED
data/lib/wadler/print.rb
CHANGED
@@ -146,11 +146,17 @@ module Oppen
|
|
146
146
|
|
147
147
|
# Open a consistent group.
|
148
148
|
#
|
149
|
-
# @param
|
149
|
+
# @param inconsistent [Boolean]
|
150
|
+
# @param indent [Integer]
|
150
151
|
#
|
151
152
|
# @return [Nil]
|
152
|
-
def group_open(indent: 0)
|
153
|
-
tokens <<
|
153
|
+
def group_open(inconsistent: false, indent: 0)
|
154
|
+
tokens <<
|
155
|
+
if inconsistent
|
156
|
+
Oppen.begin_inconsistent(offset: indent)
|
157
|
+
else
|
158
|
+
Oppen.begin_consistent(offset: indent)
|
159
|
+
end
|
154
160
|
end
|
155
161
|
|
156
162
|
# Close a group.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oppen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amine Mike El Maalouf <amine.el-maalouf@epita.fr>
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Implementation of the Oppen's pretty printing algorithm
|
15
15
|
email:
|