expressir 2.4.53-aarch64-linux → 2.4.55-aarch64-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: 1985b5a72f18ed9569b7b3951a2f95b1a9965ff3dbe1b928cc954fdbbfa27e28
4
- data.tar.gz: 5c01254f4fb42311e4301459c963cc82408be71120263b82ff72a254c6ede819
3
+ metadata.gz: eaab094e6c26aee76e16ee0e7f496076258c49478365ce594e038488a5f928e3
4
+ data.tar.gz: 1347770cf013e87478e8e8d01fe263969d8b41d194889cee6ee6fd2121f1e33c
5
5
  SHA512:
6
- metadata.gz: f6b837ca15bf06699e7f514d247905646e19dfbde4c726811f53b17e2f1dfa48913010285b387d5675e8e54efe25d77fecf4e8e65bbaf6b1ccd2e9b4bca30caf
7
- data.tar.gz: 86779f5074b5dd72e06fb193e093adc890d57f1fc717b54afa00a02cbbc09fddef91aa89596e1cbcbcba1cfbb0d8e5ad834d3e7c6a0670a543823abbff0b6903
6
+ metadata.gz: 9b14b96b55ebef306ed464ef119e98e56e8f2e69d9913cca4e32ab85130a5baf745deb81608192d026f81685f30151256c77c2605a69e0eabf788a8ee1f22622
7
+ data.tar.gz: f72ab3b23c5b67dec70784bc899c96dfdd92dc211446ed979ab662ff05299cdc715739a2ab1b4f18586b4d6512191c51233b0e0e991484738220085ccd77b340
Binary file
Binary file
Binary file
Binary file
@@ -47,12 +47,47 @@ module Expressir
47
47
  end
48
48
  end
49
49
 
50
+ # Runs the checks. When the native extension exposes the core
51
+ # checker (issue #21), each file's model wire is checked in Rust;
52
+ # the findings are identical to this class's Ruby walk (gated by
53
+ # the checker parity suites). The Ruby walk stays as the
54
+ # fallback for non-native environments.
50
55
  def check
56
+ return check_via_core if core_check_available?
57
+
51
58
  @notes = []
52
59
  @repository.schemas.compact.each { |schema| check_schema(schema) }
53
60
  self
54
61
  end
55
62
 
63
+ def core_check_available?
64
+ Expressir::Express::Core::NATIVE_AVAILABLE &&
65
+ Expressir::Express::Core.respond_to?(:check_model_hash)
66
+ end
67
+
68
+ def check_via_core
69
+ # The Ruby Checker sees the whole repository (cross-file
70
+ # interfaces, self-schema defining schemas), so the wire keeps
71
+ # the repository shape when the model has one.
72
+ wire =
73
+ if @repository.respond_to?(:files)
74
+ {
75
+ "_class" => "Expressir::Model::Repository",
76
+ "files" => @repository.files.compact.map(&:to_hash),
77
+ }
78
+ else
79
+ @repository.to_hash
80
+ end
81
+ @notes = Expressir::Express::Core.check_model_hash(wire, @dialect)
82
+ .map do |note|
83
+ Note.new(
84
+ id: note[:id].to_sym, severity: note[:severity].to_sym,
85
+ schema: note[:schema], message: note[:message]
86
+ )
87
+ end
88
+ self
89
+ end
90
+
56
91
  def errors
57
92
  notes.select { |n| n.severity == :error }
58
93
  end
@@ -40,6 +40,14 @@ module Expressir
40
40
  JSON.parse(::Expressir::Core.parse_to_model_hash(source, path))
41
41
  end
42
42
 
43
+ # Parse EXPRESS source into the hydrated model with the remark
44
+ # attachment run in the core (issue #20): the wire carries the
45
+ # attached remarks before hydration, so the Ruby RemarkAttacher
46
+ # never runs on this lane.
47
+ def self.parse_to_model_attached(source, path)
48
+ ::Expressir::Core.parse_to_model_attached(source, path)
49
+ end
50
+
43
51
  # Scan remarks (issue #20): an Array of Hashes mirroring
44
52
  # RemarkScanner::Remark's fields (position, end_position, line,
45
53
  # text, tag, format), straight from the Rust scanner.
@@ -47,6 +55,23 @@ module Expressir
47
55
  ::Expressir::Core.scan_remarks(source)
48
56
  end
49
57
 
58
+ # Semantic checks (issue #21): the Checker's findings over one
59
+ # file's model-hash wire, as an Array of Hashes with
60
+ # id/severity/schema/message in the checker's canonical order.
61
+ # `dialect` is nil or a Dialect value; the 1994 edition is
62
+ # translated to the short form the core expects.
63
+ def self.check_model_hash(wire, dialect = nil)
64
+ raise NotImplementedError, "the native extension is unavailable" unless NATIVE_AVAILABLE
65
+
66
+ wire_json = JSON.generate(wire)
67
+ core_dialect = case dialect
68
+ when nil then nil
69
+ when Dialect::EDITION_1994, "10303-11:1994" then "1994"
70
+ else dialect.to_s
71
+ end
72
+ ::Expressir::Core.check_model_hash(wire_json, core_dialect)
73
+ end
74
+
50
75
  # Parse EXPRESS source into the hydrated model directly: the
51
76
  # extension walks the wire definition once and constructs every
52
77
  # node through Serializable.instantiate (lutaml-model's fast
@@ -208,14 +208,21 @@ module Expressir
208
208
  source = strip_bom(File.read(file))
209
209
  schema_file = root_path ? Pathname.new(file.to_s).relative_path_from(root_path).to_s : file.to_s
210
210
 
211
+ remarks_attached = false
211
212
  exp_file =
212
213
  begin
213
- Core.parse_to_model(source, schema_file).tap(&:wire_parents)
214
+ if Core.respond_to?(:parse_to_model_attached)
215
+ remarks_attached = true
216
+ Core.parse_to_model_attached(source, schema_file)
217
+ .tap(&:wire_parents)
218
+ else
219
+ Core.parse_to_model(source, schema_file).tap(&:wire_parents)
220
+ end
214
221
  rescue NotImplementedError
215
222
  begin
216
- Model::ExpFile.from_hash(
217
- Core.parse_to_model_hash(source, schema_file),
218
- )&.tap(&:wire_parents)
223
+ wire = JSON.parse(Core.parse_to_model_hash(source, schema_file))
224
+ strip_end_offsets!(wire)
225
+ Model::ExpFile.from_hash(wire)&.tap(&:wire_parents)
219
226
  rescue StandardError => e
220
227
  raise Error::SchemaParseFailure.new(schema_file, e)
221
228
  end
@@ -224,7 +231,8 @@ module Expressir
224
231
  end
225
232
 
226
233
  finalize_loaded_file(exp_file, source, schema_file,
227
- include_source: include_source)
234
+ include_source: include_source,
235
+ remarks_attached: remarks_attached)
228
236
 
229
237
  unless skip_references
230
238
  Expressir::Benchmark.measure_references do
@@ -240,8 +248,10 @@ module Expressir
240
248
  # Shared post-parse steps for every core-path file: remark
241
249
  # attachment, header-remark transfer, and path wiring.
242
250
  def self.finalize_loaded_file(exp_file, source, schema_file,
243
- include_source: nil)
244
- RemarkAttacher.new(source).attach(exp_file) if source && include_source != false
251
+ include_source: nil, remarks_attached: false)
252
+ if source && include_source != false && !remarks_attached
253
+ RemarkAttacher.new(source).attach(exp_file)
254
+ end
245
255
 
246
256
  transfer_header_to_schema(exp_file, source)
247
257
 
@@ -251,6 +261,21 @@ module Expressir
251
261
  schema.file_basename = File.basename(schema_file, ".exp")
252
262
  end
253
263
  end
264
+
265
+ # The model layer declares no source_end_offset; the wire carries
266
+ # it for the attacher, and the from_hash fallback must not see it.
267
+ def self.strip_end_offsets!(obj)
268
+ case obj
269
+ when Hash
270
+ obj.delete("source_end_offset")
271
+ obj.each_value { |value| strip_end_offsets!(value) }
272
+ when Array
273
+ obj.each { |value| strip_end_offsets!(value) }
274
+ end
275
+ obj
276
+ end
277
+ private_class_method :strip_end_offsets!
278
+
254
279
  private_class_method :finalize_loaded_file
255
280
 
256
281
  # Whether the native batch compiler is usable: the extension is
@@ -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.53".freeze
6
+ VERSION = "2.4.55".freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expressir
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.53
4
+ version: 2.4.55
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-11-03 00:00:00.000000000 Z
11
+ date: 2026-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64