expressir 2.4.82 → 2.4.83

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lane-parity.yml +6 -1
  3. data/.github/workflows/rust-ext.yml +8 -1
  4. data/README.adoc +130 -1
  5. data/docs/_guides/formatter/formatter-architecture.adoc +169 -1
  6. data/docs/_guides/ruby-api/formatting-schemas.adoc +64 -0
  7. data/lib/expressir/express/builders/entity_decl_builder.rb +3 -0
  8. data/lib/expressir/express/builders/function_decl_builder.rb +1 -0
  9. data/lib/expressir/express/builders/procedure_decl_builder.rb +1 -0
  10. data/lib/expressir/express/builders/rule_decl_builder.rb +1 -0
  11. data/lib/expressir/express/builders/subtype_constraint_builder.rb +7 -1
  12. data/lib/expressir/express/formatter.rb +4 -3
  13. data/lib/expressir/express/formatters/data_types_formatter.rb +39 -21
  14. data/lib/expressir/express/formatters/declarations_formatter.rb +69 -57
  15. data/lib/expressir/express/formatters/remark_formatter.rb +53 -1
  16. data/lib/expressir/express/formatters/statements_formatter.rb +1 -0
  17. data/lib/expressir/express/formatters/supertype_expressions_formatter.rb +66 -1
  18. data/lib/expressir/express/line_map.rb +8 -0
  19. data/lib/expressir/express/node_position_index.rb +74 -4
  20. data/lib/expressir/express/pretty_formatter.rb +22 -5
  21. data/lib/expressir/express/remark_attacher.rb +665 -29
  22. data/lib/expressir/express/schema_compare.rb +2 -1
  23. data/lib/expressir/express/shtolo.rb +3 -0
  24. data/lib/expressir/model/declarations/entity.rb +5 -0
  25. data/lib/expressir/model/declarations/function.rb +4 -0
  26. data/lib/expressir/model/declarations/procedure.rb +4 -0
  27. data/lib/expressir/model/declarations/remark_item.rb +4 -0
  28. data/lib/expressir/model/declarations/rule.rb +4 -0
  29. data/lib/expressir/model/references/simple_reference.rb +1 -0
  30. data/lib/expressir/model/remark_placement.rb +6 -0
  31. data/lib/expressir/version.rb +1 -1
  32. metadata +2 -2
@@ -20,7 +20,8 @@ module Expressir
20
20
  # Resolution artifacts and presentation metadata are not part of
21
21
  # a declaration's structure.
22
22
  SIGNATURE_IGNORE = %w[source include_source remarks remark_items
23
- ref base_path file].freeze
23
+ ref base_path file
24
+ declaration_order].freeze
24
25
 
25
26
  COLLECTIONS = %i[constants types entities subtype_constraints
26
27
  functions rules procedures].freeze
@@ -712,6 +712,9 @@ module Expressir
712
712
  next unless entity.abstract
713
713
 
714
714
  entity.abstract = true # formatter renders ABSTRACT SUPERTYPE when supertype present
715
+ # The bare `ABSTRACT` of the source is written `ABSTRACT SUPERTYPE`
716
+ # in the long form too.
717
+ entity.abstract_entity = nil
715
718
  end
716
719
  end
717
720
 
@@ -15,6 +15,10 @@ module Expressir
15
15
  :remark_items
16
16
 
17
17
  attribute :abstract, :boolean
18
+ # True when the source wrote the bare `ABSTRACT` (ISO 10303-11:2004
19
+ # abstract_entity_declaration) rather than `ABSTRACT SUPERTYPE`;
20
+ # `abstract` is true for both. Unset otherwise.
21
+ attribute :abstract_entity, :boolean
18
22
  attribute :supertype_expression, ModelElement
19
23
  attribute :subtype_of, ModelElement, collection: true, initialize_empty: true
20
24
  # Heterogeneous by design: Attribute, DerivedAttribute, and
@@ -34,6 +38,7 @@ module Expressir
34
38
  key_value do
35
39
  map "_class", to: :_class, render_default: true
36
40
  map "abstract", to: :abstract
41
+ map "abstract_entity", to: :abstract_entity, render_default: false
37
42
  map "supertype_expression", to: :supertype_expression
38
43
  map "subtype_of", to: :subtype_of
39
44
  map "attributes", to: :attributes
@@ -26,6 +26,9 @@ module Expressir
26
26
  attribute :constants, Constant, collection: true, initialize_empty: true
27
27
  attribute :variables, Variable, collection: true, initialize_empty: true
28
28
  attribute :statements, ModelElement, collection: true, initialize_empty: true
29
+ # The nested declaration ids in the order of the source (#711);
30
+ # the formatter follows it instead of the grouped-by-kind layout.
31
+ attribute :declaration_order, :string, collection: true, initialize_empty: true
29
32
  attribute :_class, :string, default: -> { self.class.name }
30
33
 
31
34
  key_value do
@@ -40,6 +43,7 @@ module Expressir
40
43
  map "constants", to: :constants
41
44
  map "variables", to: :variables
42
45
  map "statements", to: :statements
46
+ map "declaration_order", to: :declaration_order
43
47
  end
44
48
 
45
49
  # @return [Array<Declaration>]
@@ -21,6 +21,9 @@ module Expressir
21
21
  attribute :constants, Constant, collection: true, initialize_empty: true
22
22
  attribute :variables, Variable, collection: true, initialize_empty: true
23
23
  attribute :statements, ModelElement, collection: true, initialize_empty: true
24
+ # The nested declaration ids in the order of the source (#711);
25
+ # the formatter follows it instead of the grouped-by-kind layout.
26
+ attribute :declaration_order, :string, collection: true, initialize_empty: true
24
27
  attribute :_class, :string, default: -> { self.class.name }
25
28
 
26
29
  key_value do
@@ -34,6 +37,7 @@ module Expressir
34
37
  map "constants", to: :constants
35
38
  map "variables", to: :variables
36
39
  map "statements", to: :statements
40
+ map "declaration_order", to: :declaration_order
37
41
  end
38
42
 
39
43
  # @return [Array<Declaration>]
@@ -8,12 +8,16 @@ module Expressir
8
8
 
9
9
  attribute :id, :string
10
10
  attribute :remarks, :string, collection: true, initialize_empty: true
11
+ # The texts of the `--IPn:` comment lines of the source (empty for a
12
+ # bare marker); the plain form writes these and no other text.
13
+ attribute :source_remarks, :string, collection: true
11
14
  attribute :_class, :string, default: -> { self.class.name }
12
15
 
13
16
  key_value do
14
17
  map "_class", to: :_class, render_default: true
15
18
  map "id", to: :id
16
19
  map "remarks", to: :remarks
20
+ map "source_remarks", to: :source_remarks
17
21
  end
18
22
  end
19
23
  end
@@ -24,6 +24,9 @@ module Expressir
24
24
  attribute :constants, Constant, collection: true, initialize_empty: true
25
25
  attribute :variables, Variable, collection: true, initialize_empty: true
26
26
  attribute :statements, ModelElement, collection: true, initialize_empty: true
27
+ # The nested declaration ids in the order of the source (#711);
28
+ # the formatter follows it instead of the grouped-by-kind layout.
29
+ attribute :declaration_order, :string, collection: true, initialize_empty: true
27
30
  attribute :where_rules, WhereRule, collection: true, initialize_empty: true
28
31
  attribute :informal_propositions, InformalPropositionRule,
29
32
  collection: true, initialize_empty: true
@@ -40,6 +43,7 @@ module Expressir
40
43
  map "constants", to: :constants
41
44
  map "variables", to: :variables
42
45
  map "statements", to: :statements
46
+ map "declaration_order", to: :declaration_order
43
47
  map "where_rules", to: :where_rules
44
48
  map "informal_propositions", to: :informal_propositions
45
49
  end
@@ -14,6 +14,7 @@ module Expressir
14
14
  map "id", to: :id
15
15
  map "ref", to: :ref
16
16
  map "base_path", to: :base_path
17
+ map "untagged_remarks", to: :untagged_remarks
17
18
  end
18
19
  end
19
20
  end
@@ -44,6 +44,12 @@ module Expressir
44
44
  ELSE_REGION = "else"
45
45
  OTHERWISE_REGION = "otherwise"
46
46
  LABEL_REGION = "label"
47
+
48
+ # Region of a LEADING remark of a CASE action's statement that was
49
+ # written before the label of that action, between two actions or
50
+ # before the first. It is written above the label, not between the
51
+ # label and the statement.
52
+ BEFORE_LABEL_REGION = "before_label"
47
53
  end
48
54
  end
49
55
  end
@@ -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.82".freeze
6
+ VERSION = "2.4.83".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.82
4
+ version: 2.4.83
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-11-23 00:00:00.000000000 Z
11
+ date: 2026-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys