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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a2178222eed2a9789223d62624ee4d5b468ec35dbd65c602bfdea24e5e08c77
4
- data.tar.gz: 3ef37f2ad458bac064f77e7a37959fac18f33fc2d31dfc9ddbf4a4b88f527270
3
+ metadata.gz: 209072194fbb082bd25f2583b7f930e38c79ca042c21e711e18dd7295ee00e86
4
+ data.tar.gz: 6eeb620d7d3bd6599477a46a2a5b9df86db2bc8c6a0f07a619d065245393127f
5
5
  SHA512:
6
- metadata.gz: 3a83e465f4279d02b9689d58f4023c61287b5f2ba03a0f209fcfdedc55e8451e05802fa61e01c0f1c898afb3e5577b0321fd60002a1c08924130991e9769a490
7
- data.tar.gz: 11d507ea9e4f5e6b5c0fe258c478b47243fd04c1a348bd935ce4404cd56d005776f161f11d52d93326ca1ecf5739bbbed2f360d397c37a5e497ec1b1ed103bcd
6
+ metadata.gz: a2f8d7bd7b199b7ef0d5a97feebbe456fea9e557f6535760ad84b21a304d73c52ea954f392e7c07e0b682844fe86c0c8ccc4ef6786057785cba9f02f58c31c14
7
+ data.tar.gz: 31a73892d3afff56d85c60a6756d6fedbd2bce259d7ca259b662a7f7002549fcb53146f2fb1a32136ae2c8cca03b20ded90d95a814363d18d0d80192db79c39b
@@ -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
@@ -5,5 +5,5 @@ module Oppen
5
5
  # Oppen version
6
6
  #
7
7
  # @return [String] current version
8
- VERSION = '0.9.4' # managed by release.sh
8
+ VERSION = '0.9.6' # managed by release.sh
9
9
  end
data/lib/wadler/print.rb CHANGED
@@ -146,11 +146,17 @@ module Oppen
146
146
 
147
147
  # Open a consistent group.
148
148
  #
149
- # @param indent [Integer]
149
+ # @param inconsistent [Boolean]
150
+ # @param indent [Integer]
150
151
  #
151
152
  # @return [Nil]
152
- def group_open(indent: 0)
153
- tokens << Oppen.begin_consistent(offset: indent)
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
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-10-25 00:00:00.000000000 Z
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: