sirop 0.4 → 0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6ffcc66301949fc52bae4b2eef554243263b06a9bdf699d6be61d9d38f1ade1
4
- data.tar.gz: 6aeba8547c161f56a20e64d7cf219489bfd0f2195063ca8b651c821134944232
3
+ metadata.gz: 30ef982b49313b55ac8b76d8886f406ee315421080e728bc1d9cdf05bcce93e7
4
+ data.tar.gz: 40c33682b5c44f10e242049041f40f20f58a2939340debb858307b5bc12b9319
5
5
  SHA512:
6
- metadata.gz: 8dde7126119287b24f05352b5c62922a5023c80ff9ffb3f258ddf8824b6ce947b7f2551bc1818202036ac152815458e3126a838b3e91d147ed413cb6fb181818
7
- data.tar.gz: 83856a27062116324228881ff61172c62234ca3ce6992ba5ef8355db3f5a823e018695eb6e9e61b61b852cfa1b497039c1ad3fcbf6e7451bb0a9b14b64801da0
6
+ metadata.gz: 9d92a9e43cfa127c5d2a8e1ccb963ea38e66b54670c0a33558a874a95e5b3ae11fc9092d5b69c0486828a8a759bb6a20c4596280e90e3f1285928badc1da9d55
7
+ data.tar.gz: e5f76b7f45f7fd5a6ddb94613aa381b7f36ecc737f1c5c62a19c3257f48398509e61df2439b6b3d2716cbc80d8605cafe349174e6c61c4b21173e6ab7f21dbd6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 0.6 2025-07-23
2
+
3
+ - Update to current version of Prism
4
+
5
+ # 2025-01-09 0.5
6
+
7
+ - Add after_body hook for lambdas
8
+
1
9
  # 2024-04-29 0.4
2
10
 
3
11
  - Improve sourcifier to support all Ruby syntax, based on Prism test fixtures
@@ -21,3 +29,4 @@
21
29
  # 2024-02-20 0.1
22
30
 
23
31
  - Find node for a given `Proc` object
32
+ -
@@ -18,6 +18,8 @@ class Prism::BlockParametersNode
18
18
  end
19
19
 
20
20
  class Prism::LambdaNode
21
+ attr_reader :after_body_proc
22
+
21
23
  # @param params [String] injected parameters
22
24
  # @return [void]
23
25
  def inject_parameters(params)
@@ -31,4 +33,8 @@ class Prism::LambdaNode
31
33
  instance_variable_set(:@parameters, Sirop::Injection.new("(#{params})"))
32
34
  end
33
35
  end
36
+
37
+ def after_body(&b)
38
+ @after_body_proc = b
39
+ end
34
40
  end
@@ -21,7 +21,7 @@ module Sirop
21
21
  class_variable_read: :emit_verbatim,
22
22
  class_variable_target: :emit_verbatim,
23
23
  class_variable_write: [:name_loc, :operator_loc, :value],
24
- constant_path: [:parent, :delimiter_loc, :child],
24
+ constant_path: [:parent, :delimiter_loc, :name_loc],
25
25
  constant_path_write: [:target, :operator_loc, :value],
26
26
  constant_read: :emit_verbatim,
27
27
  constant_write: [:name_loc, :operator_loc, :value],
@@ -49,7 +49,7 @@ module Sirop
49
49
  keyword_rest_parameter: [:operator_loc, :name_loc],
50
50
  keyword_parameter: :emit_verbatim,
51
51
  local_variable_and_write: [:name_loc, :operator_loc, :value],
52
- local_variable_operator_write: [:name_loc, :operator_loc, :value],
52
+ local_variable_operator_write: [:name_loc, :binary_operator_loc, :value],
53
53
  local_variable_or_write: [:name_loc, :operator_loc, :value],
54
54
  local_variable_read: :emit_verbatim,
55
55
  local_variable_target: :emit_verbatim,
@@ -286,7 +286,7 @@ module Sirop
286
286
  emit_code(node.predicate)
287
287
  emit_code(node.then_keyword_loc)
288
288
  emit_code(node.statements, semicolon: true)
289
- emit_code(node.consequent) if node.consequent
289
+ emit_code(node.subsequent) if node.subsequent
290
290
  emit_code(node.end_keyword_loc, semicolon: true) if node.if_keyword_loc.slice == 'if'
291
291
  end
292
292
 
@@ -294,7 +294,7 @@ module Sirop
294
294
  emit_code(node.predicate)
295
295
  emit_code(node.then_keyword_loc)
296
296
  emit_code(node.statements)
297
- emit_code(node.consequent)
297
+ emit_code(node.subsequent)
298
298
  end
299
299
 
300
300
  def visit_if_node_guard(node)
@@ -313,7 +313,7 @@ module Sirop
313
313
  emit_code(node.then_keyword_loc)
314
314
  @semicolon = true
315
315
  emit_code(node.statements)
316
- emit_code(node.consequent) if node.consequent
316
+ emit_code(node.else_clause) if node.else_clause
317
317
  emit_code(node.end_keyword_loc, semicolon: true) if node.keyword_loc.slice == 'unless'
318
318
  end
319
319
 
@@ -327,7 +327,7 @@ module Sirop
327
327
  emit_code(node.case_keyword_loc)
328
328
  emit_code(node.predicate)
329
329
  node.conditions.each { |c| emit_code(c, semicolon: true) }
330
- emit_code(node.consequent, semicolon: true)
330
+ emit_code(node.else_clause, semicolon: true)
331
331
  emit_code(node.end_keyword_loc, semicolon: true)
332
332
  end
333
333
 
@@ -492,7 +492,7 @@ module Sirop
492
492
  emit_code(node.operator_loc)
493
493
  emit_code(node.reference)
494
494
  emit_code(node.statements, semicolon: true)
495
- emit_code(node.consequent)
495
+ emit_code(node.subsequent)
496
496
  end
497
497
 
498
498
  def visit_begin_node(node)
@@ -649,6 +649,7 @@ module Sirop
649
649
  emit_code(node.parameters)
650
650
  emit_code(node.opening_loc)
651
651
  emit_code(node.body, semicolon: node.opening_loc.slice == 'do')
652
+ node.after_body_proc&.(node)
652
653
  emit_code(node.closing_loc, semicolon: node.closing_loc.slice == 'end')
653
654
  end
654
655
 
data/lib/sirop/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Sirop
2
2
  # Sirop version
3
- VERSION = '0.4'
3
+ VERSION = '0.6'
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sirop
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2024-04-29 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: prism
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.27.0
18
+ version: 1.4.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.27.0
25
+ version: 1.4.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: minitest
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubygems_version: 3.6.0.dev
79
+ rubygems_version: 3.6.8
80
80
  specification_version: 4
81
81
  summary: 'Sirop: Ruby code rewriter'
82
82
  test_files: []