expressir 2.4.19 → 2.4.21
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 +4 -4
- data/expressir.gemspec +6 -0
- data/ext/expressir_core/extconf.rb +10 -0
- data/lib/expressir/mapping/refpath.rb +43 -3
- data/lib/expressir/mapping.rb +10 -2
- data/lib/expressir/version.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 135dc464431342c0d2cb4e9099aa340900fc3233017279a512dd3c8836cbb2ef
|
|
4
|
+
data.tar.gz: 16dd1c39605154033d2c531d06ad457087a8c1207b65747d293b69abff15cd09
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0198679d1aaca04bb6291ebea7eec331d4c63e1b2a04da7d37e47ee68bc438b35162728ac48f8c319bc3ef5e4112cfb5eb491e687d24641b49b46f9ab7273b2f'
|
|
7
|
+
data.tar.gz: fb9f8447d7cf92dec90d73d486c3118ccbf6d265646a1e03eec9c44e45ab31b48a75169fae9cc8c7908a342053c21f4453ff856f4676f1d0eb4e479cdf9c45f6
|
data/expressir.gemspec
CHANGED
|
@@ -31,6 +31,12 @@ Gem::Specification.new do |spec|
|
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
+
# Build the Rust core extension at install time. extconf.rb fails
|
|
35
|
+
# soft (dummy Makefile) wherever cargo is unavailable, so installs
|
|
36
|
+
# without a Rust toolchain fall back to the pure-Ruby parser.
|
|
37
|
+
spec.extensions = ["ext/expressir_core/extconf.rb"]
|
|
38
|
+
spec.add_dependency "rb_sys", "~> 0.9.130"
|
|
39
|
+
|
|
34
40
|
spec.add_dependency "base64"
|
|
35
41
|
spec.add_dependency "benchmark"
|
|
36
42
|
spec.add_dependency "benchmark-ips"
|
|
@@ -10,6 +10,16 @@ if RUBY_ENGINE != "ruby" || ENV["EXPRESSIR_CORE"] == "0"
|
|
|
10
10
|
exit 0
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
# Windows rubies are mingw-built while rustup defaults to the msvc
|
|
14
|
+
# toolchain; rb-sys cannot bridge the two, so skip there too (windows
|
|
15
|
+
# installs fall back to the pure-Ruby parser).
|
|
16
|
+
if Gem::Platform.local.os == "mingw32"
|
|
17
|
+
File.write("Makefile", dummy_makefile("").to_s)
|
|
18
|
+
warn "expressir: skipping the Rust core extension on mingw (msvc " \
|
|
19
|
+
"toolchain mismatch)"
|
|
20
|
+
exit 0
|
|
21
|
+
end
|
|
22
|
+
|
|
13
23
|
# Pure-Ruby fallback when no Rust toolchain is available: the gem must
|
|
14
24
|
# install and keep working without the native core
|
|
15
25
|
# (Expressir::Core::NATIVE_AVAILABLE stays false). Prebuilt platform
|
|
@@ -15,6 +15,10 @@ module Expressir
|
|
|
15
15
|
# link := "->" | "<-" | "<=" | "=>" | "=" NAME
|
|
16
16
|
# (relation to the previous node)
|
|
17
17
|
# node := NAME ["." ATTRIBUTE]
|
|
18
|
+
# | LINK (<<express:SCHEMA.ITEM,ITEM>>,
|
|
19
|
+
# #460: a link may stand
|
|
20
|
+
# wherever a declaration
|
|
21
|
+
# is referenced)
|
|
18
22
|
# index := "[" ("i" | DIGITS) "]"
|
|
19
23
|
# MARKER := "{" | "}" | "[" | "]" | "(" | ")" | ":" | "|" | "!"
|
|
20
24
|
# | "," | "/" | "*" (grouping/annotation; no
|
|
@@ -42,6 +46,8 @@ module Expressir
|
|
|
42
46
|
attribute :attribute, :string
|
|
43
47
|
attribute :index, :string
|
|
44
48
|
attribute :literal, :string
|
|
49
|
+
# annotated EXPRESS link form: <<express:SCHEMA.ITEM,ITEM>>
|
|
50
|
+
attribute :link, :string
|
|
45
51
|
|
|
46
52
|
key_value do
|
|
47
53
|
map "operator", to: :operator
|
|
@@ -49,6 +55,7 @@ module Expressir
|
|
|
49
55
|
map "attribute", to: :attribute
|
|
50
56
|
map "index", to: :index
|
|
51
57
|
map "literal", to: :literal
|
|
58
|
+
map "link", to: :link
|
|
52
59
|
end
|
|
53
60
|
end
|
|
54
61
|
|
|
@@ -62,7 +69,10 @@ module Expressir
|
|
|
62
69
|
end
|
|
63
70
|
end
|
|
64
71
|
|
|
65
|
-
|
|
72
|
+
EXPRESS_LINK_PATH = /\A<<express:([^,>]+)(?:,[^>]+)?>>\z/
|
|
73
|
+
private_constant :EXPRESS_LINK_PATH
|
|
74
|
+
|
|
75
|
+
TOKEN = /<<express:[^,>]+(?:,[^>]+)?>>|->|<-|<=|=>|[{}\[\]()=:|!,*\/]|'(?:''|[^'])*'|\w+(?:\.\w+)?/
|
|
66
76
|
MARKERS = ["{", "}", "[", "]", "(", ")", ":", "|", "!", ",", "/",
|
|
67
77
|
"*", "MAPPING_OF"].freeze
|
|
68
78
|
LINKS = ["->", "<-", "<=", "=>"].freeze
|
|
@@ -109,6 +119,10 @@ module Expressir
|
|
|
109
119
|
end
|
|
110
120
|
when *MARKERS
|
|
111
121
|
steps << Step.new(operator: token)
|
|
122
|
+
when /\A<<express:/
|
|
123
|
+
steps << Step.new(operator: pending_link, link: token)
|
|
124
|
+
pending_link = nil
|
|
125
|
+
pending_type_assign = false
|
|
112
126
|
else
|
|
113
127
|
name, _, attribute = token.partition(".")
|
|
114
128
|
operator = pending_link || ("=" if pending_type_assign)
|
|
@@ -152,8 +166,12 @@ module Expressir
|
|
|
152
166
|
# markers never break the running link, mirroring parse
|
|
153
167
|
next if MARKERS.include?(step.operator)
|
|
154
168
|
|
|
155
|
-
|
|
156
|
-
|
|
169
|
+
if step.link
|
|
170
|
+
issues.concat(check_link_step(step, pos, repository))
|
|
171
|
+
else
|
|
172
|
+
issues.concat(check_step(step, pos, prev, last_qualified, by_name))
|
|
173
|
+
end
|
|
174
|
+
prev = step if step.name || step.link
|
|
157
175
|
last_qualified = step if step.name && step.attribute
|
|
158
176
|
end
|
|
159
177
|
issues
|
|
@@ -175,6 +193,28 @@ module Expressir
|
|
|
175
193
|
index
|
|
176
194
|
end
|
|
177
195
|
|
|
196
|
+
# Annotated EXPRESS link node: <<express:SCHEMA.ITEM,ITEM>>
|
|
197
|
+
# (item part optional) resolves against the repository (#460).
|
|
198
|
+
def check_link_step(step, pos, repository)
|
|
199
|
+
parts = step.link.match(EXPRESS_LINK_PATH)
|
|
200
|
+
return [Issue.new(step: pos, message: "malformed link '#{step.link}'")] unless parts
|
|
201
|
+
|
|
202
|
+
schema_id, item_id = parts[1].split(".", 2).compact
|
|
203
|
+
schema = repository.schemas
|
|
204
|
+
.find { |s| s.id&.safe_downcase == schema_id&.safe_downcase }
|
|
205
|
+
unless schema
|
|
206
|
+
return [Issue.new(step: pos,
|
|
207
|
+
message: "unknown schema '#{schema_id}' in #{step.link}")]
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
return [] if item_id.nil?
|
|
211
|
+
return [] if Expressir::Mapping.item_declared?(schema, item_id)
|
|
212
|
+
|
|
213
|
+
[Issue.new(step: pos,
|
|
214
|
+
message: "schema '#{schema_id}' does not declare " \
|
|
215
|
+
"'#{item_id}' (#{step.link})")]
|
|
216
|
+
end
|
|
217
|
+
|
|
178
218
|
def check_step(step, pos, prev, last_qualified, by_name)
|
|
179
219
|
found = by_name[step.name&.safe_downcase]
|
|
180
220
|
return [Issue.new(step: pos, message: "unknown type '#{step.name}'")] unless found
|
data/lib/expressir/mapping.rb
CHANGED
|
@@ -136,8 +136,16 @@ module Expressir
|
|
|
136
136
|
def values(document)
|
|
137
137
|
document.ae.to_a.flat_map do |element|
|
|
138
138
|
[element.entity, element.aimelt] +
|
|
139
|
-
element.aa.to_a.flat_map
|
|
140
|
-
|
|
139
|
+
element.aa.to_a.flat_map do |aa|
|
|
140
|
+
[aa.attribute, aa.aimelt, aa.assertion_to]
|
|
141
|
+
end
|
|
142
|
+
end.compact + subtype_constraint_values(document)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Every declaration reference in the sc entries (#460): the
|
|
146
|
+
# constraint name and the entity it constrains.
|
|
147
|
+
def subtype_constraint_values(document)
|
|
148
|
+
document.sc.to_a.flat_map { |sc| [sc.constraint, sc.entity] }.compact
|
|
141
149
|
end
|
|
142
150
|
|
|
143
151
|
# Every reference path in the document as [location, content]
|
data/lib/expressir/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: expressir
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.4.
|
|
4
|
+
version: 2.4.21
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rb_sys
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.9.130
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.9.130
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: base64
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -232,7 +246,8 @@ email:
|
|
|
232
246
|
- open.source@ribose.com
|
|
233
247
|
executables:
|
|
234
248
|
- expressir
|
|
235
|
-
extensions:
|
|
249
|
+
extensions:
|
|
250
|
+
- ext/expressir_core/extconf.rb
|
|
236
251
|
extra_rdoc_files: []
|
|
237
252
|
files:
|
|
238
253
|
- ".cargo/config.toml"
|