expressir 2.4.62 → 2.4.63

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: 66a6350cf976e79c6d598aa239dbd2012f476b418b9068e3d8d1c52d27a2aad3
4
- data.tar.gz: cabcb127e900323d8fcbea1c846e4233d05524eb802f18eb060ffeae5cb80f06
3
+ metadata.gz: 1a6f965c957e0d311f33b6ec1736bd51c931dc514b7589ee3f6009bd7e4b3795
4
+ data.tar.gz: adba741215d339bc1f5bd5c9649878e684df7426068cfef43165cccc51c5fb64
5
5
  SHA512:
6
- metadata.gz: af9d440389f6af40d4f58f4cf72614a10facfa1bf36366e3666bd085a963e9c35bae2667f6a2e81447a6f2d02fc4567085f58e644c1aa05c31868b5b13c6dfb0
7
- data.tar.gz: 751d289260d362523fbab7227dc97e8da401139df8fbb3965c3ee72a6ba13d977fbd1f91c8650c14b874f11fd3c91a43abf28040a27e55eadbfd6b7f33ac1cf3
6
+ metadata.gz: 6c68628ce8a6f97542bfb0c89e4a5f942e5f01a7a1010c6f2730692f91ce4ed0067c068b719441c13c74e8fe4137030649fd255449d2c2c710de043ca58ee3ab
7
+ data.tar.gz: b371a0b96ccdba7e5c357c92f62e4d3fa399b445b773886807e3f1ea5c45fb9db24ce53873ee2dd400c2a70412c69eb2aa13e30bc83b5104b242938562dc634f
@@ -13,7 +13,7 @@ magnus = { version = "0.9" }
13
13
  # Pinned core release (M1, TODO.parity-ee/19): the ext never floats
14
14
  # main — bump the tag per expressir release, alongside the validation
15
15
  # run that pins it.
16
- expressir-rs = { git = "https://github.com/lutaml/expressir-rs", tag = "v0.1.32" }
16
+ expressir-rs = { git = "https://github.com/lutaml/expressir-rs", tag = "v0.1.33" }
17
17
  serde_json = "1.0"
18
18
 
19
19
 
@@ -211,7 +211,8 @@ module Expressir
211
211
 
212
212
  line_content = line_content_for(remark.line)
213
213
  if end_scope_line?(line_content)
214
- matched_node = @node_index.node_for_end_scope_at(remark.line, line_content)
214
+ matched_node = @node_index.node_for_end_scope_at(remark.line, line_content) ||
215
+ scope_owner_for_end_line(remark.line, line_content)
215
216
  if matched_node
216
217
  add_remark(matched_node, remark.text, format: remark.format, tag: nil,
217
218
  source_offset: remark.position)
@@ -241,6 +242,34 @@ module Expressir
241
242
  line_content =~ /END_(SCHEMA|ENTITY|TYPE|FUNCTION|PROCEDURE|RULE)/i
242
243
  end
243
244
 
245
+ # A comment on an END_XXX line belongs to the scope that XXX closes.
246
+ # Spans can miss on the grammar lane — source strings there are
247
+ # reconstructions whose lengths undershoot the node's real extent,
248
+ # so neither the end-window nor containment reaches the END line
249
+ # (expressir#609 drift) — so this falls back to the scope walk: the
250
+ # construct open at the START of the END line is the scope being
251
+ # closed, by construction of the map.
252
+ def scope_owner_for_end_line(line, line_content)
253
+ type = case line_content
254
+ when /END_SCHEMA/i then Model::Declarations::Schema
255
+ when /END_ENTITY/i then Model::Declarations::Entity
256
+ when /END_TYPE/i then Model::Declarations::Type
257
+ when /END_FUNCTION/i then Model::Declarations::Function
258
+ when /END_PROCEDURE/i then Model::Declarations::Procedure
259
+ when /END_RULE/i then Model::Declarations::Rule
260
+ end
261
+ active = active_scope_map[line]
262
+ return nil unless type.is_a?(Class) && active.is_a?(Array)
263
+
264
+ klass, opener_line = active
265
+ # ENTITY/TYPE openers are tracked as :other — the walk is
266
+ # line-accurate, so trust it for those ends.
267
+ return nil unless klass == type || (klass == :other && [Model::Declarations::Entity, Model::Declarations::Type].include?(type))
268
+
269
+ @node_index.starting_at(opener_line)
270
+ .find { |n| n[:node].is_a?(type) }&.dig(:node)
271
+ end
272
+
244
273
  # Own-line body comments belong to the next statement in the same
245
274
  # statement region (Function body, THEN branch, ELSE branch, loop body):
246
275
  # attached there with LEADING placement. A comment with no following
@@ -559,6 +588,19 @@ module Expressir
559
588
  # from its closing keyword by an empty line still closes that body.
560
589
  while probe <= source_line_count
561
590
  content = line_content_for(probe).to_s.strip
591
+ # Embedded remark blocks (`(*"tag" ... *)`) that the renderer
592
+ # emits between a trailing comment and the closing keyword:
593
+ # skip the whole block, the keyword lies beyond it (#609).
594
+ if content.start_with?("(*")
595
+ # A single-line block carries its own "*)": only hunt for a
596
+ # closer when the start line does not have one.
597
+ unless content.include?("*)")
598
+ probe += 1
599
+ probe += 1 while probe <= source_line_count && !line_content_for(probe).to_s.include?("*)")
600
+ end
601
+ probe += 1
602
+ next
603
+ end
562
604
  break unless content.empty? || content.start_with?("--")
563
605
 
564
606
  probe += 1
@@ -3,6 +3,6 @@ module Expressir
3
3
  # autoload it (Ruby autoload only works for module/class constants, not
4
4
  # for string constants like `Expressir::VERSION`).
5
5
  module Version
6
- VERSION = "2.4.62".freeze
6
+ VERSION = "2.4.63".freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expressir
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.62
4
+ version: 2.4.63
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.