rhoella 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/reference/ruby/rhoella.rb +25 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cabe842828afe35586f02d32d80a7b7e5a5eefcfe9da35176c191ccf1a2e59f
4
- data.tar.gz: ce4987fac00cfcc1d95af79b23d274599489a33d14dd48d4bbe86abc89c51c79
3
+ metadata.gz: f4268ebe7c3d7f85cd4d23ccc5df3229ded41799f8e09b0e0b9113186520cfb2
4
+ data.tar.gz: 232c9978bd4c082c80274ca1711cbfba525060e22f3d6eb779a8186cdfa56131
5
5
  SHA512:
6
- metadata.gz: f773001af95380cd77757d4ba035078e64797c3e65c0b6ac9c763cce1b3c8f83009b6ea616dc4cc90c8af04f720a937e2df482ff03bf64c559d720447ef6b15d
7
- data.tar.gz: bb61cf65f79cbebca2e40187d2543bb29f9937876d2174604df81ad2723e40206d02ada389a45d5226566a69c31c61e9658b6ddb34667054ab485c6b462e3045
6
+ metadata.gz: ae894840496f0c5f2c7e387b182332aed5c510d398d3b208e98346ffc55d045ae2d0439e341bfbb5eed6531e45b9cf16526b8a2565d15941bfddfe607cc8e01e
7
+ data.tar.gz: 0e31d8b619ef7412ec99d1b6a7d41cd1b0402b892ae4fa523e6ecd45fc1cea07972e44f7201868c0c559dd256637582ba5f32508fb570f699c537f6210e0e7ff
@@ -215,6 +215,31 @@ module Rhoella
215
215
  @pos = 0
216
216
  end
217
217
 
218
+ # Static analysis: the message and term ids this pattern references
219
+ # (message ids bare, term ids with their leading dash, member
220
+ # attributes stripped), including selectors. Strict hosts walk this
221
+ # against their catalog to fail loudly on unknown references — the
222
+ # engine itself renders unknown references softly, per the upstream
223
+ # fallback fixtures.
224
+ def references
225
+ refs = []
226
+ walk_references = lambda do |elements|
227
+ elements.each do |element|
228
+ case element[0]
229
+ when :message_ref then refs << element[1]
230
+ when :message_attr, :term_attr then refs << element[1]
231
+ when :term_ref then refs << element[1]
232
+ when :select
233
+ walk_references.call([element[1]])
234
+ element[2].each { |(_, arm_elements)| walk_references.call(arm_elements) }
235
+ walk_references.call(element[3])
236
+ end
237
+ end
238
+ end
239
+ walk_references.call(parse_elements(stop: nil))
240
+ refs.uniq
241
+ end
242
+
218
243
  def parse_elements(stop:)
219
244
  elements = []
220
245
  buffer = +""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhoella
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Metanorma