expressir 2.4.36-x86_64-linux → 2.4.37-x86_64-linux

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: 562234e66991852131024e0be0ba5b648391aa42c2600bf30a2b87cdcee87ed7
4
- data.tar.gz: 49c531fb45fe7cb41444a377a44c8e4c86c549dd32bd8daaf3fe2852425f7941
3
+ metadata.gz: b7aa98d223c3f4823fa7f1b79ef313aebc361a9f588091d269d5af0c6a18c350
4
+ data.tar.gz: 296f5b2d8c2ed8b208c8da5197fdd1200ca2bf60d5c76e6b8cfaf15c86d4e2f6
5
5
  SHA512:
6
- metadata.gz: 0d9c63f577f8997f4107e644ddd0d3c3a1900fd7ef8a1285dcb1403fd356d161d12506c58480a747f68c8cf27d567d2a23983eae083b8be4794c14ffedda1fa0
7
- data.tar.gz: f49f9d19130b52a44ac5486c4f0e29ad5a6549a61c3344d78681b5cf830c6af84b5d75a98acdfe16564b4b0fe5c89d8bda666a981cb7fed0052bc433ef7d0e9a
6
+ metadata.gz: 13d757f8c90ea30c5f9a6eb7c4e2c5ae42412fe18e9b885edd63eb721013ea06df86d0a4b4e2909e19cba004371d08f487a05c857659f563f881ebec78386493
7
+ data.tar.gz: b154d88d35bf0a80c635d9000d7490d1a597d9175b41ad55a6d7c4ce5270ef427eafd947ddef5b6bb787b5c37498ba1d601821e21747219bec112adf425b17ae
@@ -24,10 +24,16 @@ module Expressir
24
24
  # is referenced)
25
25
  # index := "[" ("i" | DIGITS) "]"
26
26
  # constraint := ["!"] "{" NAME [NAME "."] "=" STRING "}"
27
+ # supertype := "||" NAME "||" (§5 supertype entity marker)
28
+ # tree := "*" NAME "*" (§5 relationship tree marker)
27
29
  # MARKER := "{" | "}" | "[" | "]" | "(" | ")" | ":" | "|" | "!"
28
30
  # | "," | "/" | "*" | "<" | ">" (grouping/annotation;
29
31
  # never breaks a
30
- # pending link)
32
+ # pending link; the §5
33
+ # required-path marker
34
+ # "<path>" is transparent
35
+ # — its contents validate
36
+ # in the running context)
31
37
  #
32
38
  # Validation (ELF 5006 §8): a running path context tracks the
33
39
  # entity a path is "at"; each step must connect to it, attribute
@@ -104,7 +110,7 @@ module Expressir
104
110
  EXPRESS_LINK_PATH = /\A<<express:([^,>]+)(?:,[^>]+)?>>\z/
105
111
  private_constant :EXPRESS_LINK_PATH
106
112
 
107
- TOKEN = /<<express:[^,>]+(?:,[^>]+)?>>|->|<-|<=|=>|\*>|<\*|!?\{|[{}\[\]()=:|!,*\/<>]|'(?:''|[^'])*'|\w+(?:\.\w+)?/
113
+ TOKEN = /<<express:[^,>]+(?:,[^>]+)?>>|->|<-|<=|=>|\*>|<\*|\|\||!?\{|[{}\[\]()=:|!,*\/<>]|'(?:''|[^'])*'|\w+(?:\.\w+)?/
108
114
  MARKERS = ["{", "}", "[", "]", "(", ")", ":", "|", "!", ",", "/",
109
115
  "*", "<", ">", "MAPPING_OF", "!{"].freeze
110
116
  LINKS = ["->", "<-", "<=", "=>", "*>", "<*"].freeze
@@ -140,13 +146,19 @@ module Expressir
140
146
  errors = []
141
147
  pending_link = nil
142
148
  pending_type_assign = false
143
- false
144
149
  i = 0
145
150
  while i < tokens.length
146
151
  token = tokens[i]
147
152
  case token
153
+ when "||"
154
+ name_token = tokens[i + 1]
155
+ if name_token&.match?(/\A\w+\z/) && tokens[i + 2] == "||"
156
+ steps << Step.new(operator: "||", name: name_token)
157
+ i += 2
158
+ else
159
+ errors << "supertype marker '||' without an entity name"
160
+ end
148
161
  when "!{"
149
- true
150
162
  step, consumed = parse_constraint(tokens[i..], negated: true)
151
163
  steps << step
152
164
  i += consumed
@@ -182,6 +194,14 @@ module Expressir
182
194
  else
183
195
  steps << Step.new(operator: "[")
184
196
  end
197
+ when "*"
198
+ name_token = tokens[i + 1]
199
+ if name_token&.match?(/\A\w+\z/) && tokens[i + 2] == "*"
200
+ steps << Step.new(operator: "*", name: name_token)
201
+ i += 2
202
+ else
203
+ steps << Step.new(operator: token)
204
+ end
185
205
  when *MARKERS
186
206
  steps << Step.new(operator: token)
187
207
  when /\A<<express:/
@@ -302,6 +322,14 @@ module Expressir
302
322
  when "*>", "<*"
303
323
  issues.concat(select_extension_issues(step, pos, ctx, by_name))
304
324
  ctx = step.name&.safe_downcase
325
+ when "||"
326
+ issues.concat(supertype_marker_issues(step, pos, ctx, by_name))
327
+ if step.name
328
+ seen[step.name.safe_downcase] = true
329
+ ctx = step.name.safe_downcase
330
+ end
331
+ when "*"
332
+ issues.concat(tree_marker_issues(step, pos, by_name))
305
333
  else
306
334
  issues.concat(check_step(step, pos, ctx, last_qualified, by_name))
307
335
  if step.name
@@ -495,6 +523,39 @@ module Expressir
495
523
  end
496
524
  end
497
525
 
526
+ # ELF 5006 §5 supertype entity marker: `||supertype||` names an
527
+ # entity that must exist and, when the path has a running
528
+ # context, be a supertype of (or equal to) that context entity.
529
+ def supertype_marker_issues(step, pos, ctx, by_name)
530
+ issues = []
531
+ entity = step.name
532
+ check_exists(issues, pos, entity, by_name)
533
+ return issues if entity.nil?
534
+
535
+ decl = by_name[entity.safe_downcase]&.last
536
+ return issues unless decl.is_a?(Model::Declarations::Entity)
537
+
538
+ context_decl = ctx && by_name[ctx]&.last
539
+ if context_decl.is_a?(Model::Declarations::Entity) &&
540
+ !entity_reaches?(context_decl, entity.safe_downcase, by_name,
541
+ {}.compare_by_identity)
542
+ issues << Issue.new(step: pos,
543
+ message: "'#{entity}' is not a supertype of " \
544
+ "'#{ctx}'")
545
+ end
546
+ issues
547
+ end
548
+
549
+ # ELF 5006 §5 relationship tree marker: `*relationship*` names an
550
+ # entity whose instances may assemble into a tree; the path
551
+ # between it and the related entities is implied, so only the
552
+ # entity's existence is checkable.
553
+ def tree_marker_issues(step, pos, by_name)
554
+ issues = []
555
+ check_exists(issues, pos, step.name, by_name)
556
+ issues
557
+ end
558
+
498
559
  # ELF 5006 §8 navigation validation with a running context: the
499
560
  # attribute must exist on the context entity, and its type must
500
561
  # be able to reference the step's target entity.
@@ -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.36".freeze
6
+ VERSION = "2.4.37".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.36
4
+ version: 2.4.37
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - Ribose Inc.