expressir 0.2.18-arm64-darwin → 0.2.26-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +7 -1
  3. data/.github/workflows/release.yml +31 -3
  4. data/README.adoc +3 -3
  5. data/exe/format +2 -49
  6. data/exe/format-test +81 -0
  7. data/lib/expressir/express_exp/2.4/express_parser.bundle +0 -0
  8. data/lib/expressir/express_exp/2.5/express_parser.bundle +0 -0
  9. data/lib/expressir/express_exp/2.6/express_parser.bundle +0 -0
  10. data/lib/expressir/express_exp/2.7/express_parser.bundle +0 -0
  11. data/lib/expressir/express_exp/3.0/express_parser.bundle +0 -0
  12. data/lib/expressir/express_exp/cache.rb +48 -0
  13. data/lib/expressir/express_exp/formatter.rb +2 -2
  14. data/lib/expressir/express_exp/hyperlink_formatter.rb +10 -15
  15. data/lib/expressir/express_exp/model_visitor.rb +23 -0
  16. data/lib/expressir/express_exp/parser.rb +14 -6
  17. data/lib/expressir/express_exp/resolve_references_model_visitor.rb +29 -0
  18. data/lib/expressir/express_exp/visitor.rb +19 -18
  19. data/lib/expressir/model.rb +3 -1
  20. data/lib/expressir/model/attribute.rb +12 -5
  21. data/lib/expressir/model/cache.rb +13 -0
  22. data/lib/expressir/model/constant.rb +9 -2
  23. data/lib/expressir/model/entity.rb +10 -8
  24. data/lib/expressir/model/enumeration_item.rb +7 -0
  25. data/lib/expressir/model/expressions/aggregate_initializer.rb +1 -1
  26. data/lib/expressir/model/expressions/aggregate_item.rb +2 -2
  27. data/lib/expressir/model/expressions/attribute_reference.rb +2 -2
  28. data/lib/expressir/model/expressions/binary_expression.rb +3 -3
  29. data/lib/expressir/model/expressions/call.rb +2 -2
  30. data/lib/expressir/model/expressions/entity_constructor.rb +2 -2
  31. data/lib/expressir/model/expressions/group_reference.rb +2 -2
  32. data/lib/expressir/model/expressions/index_reference.rb +3 -3
  33. data/lib/expressir/model/expressions/interval.rb +5 -5
  34. data/lib/expressir/model/expressions/query_expression.rb +5 -3
  35. data/lib/expressir/model/expressions/simple_reference.rb +5 -1
  36. data/lib/expressir/model/expressions/unary_expression.rb +2 -2
  37. data/lib/expressir/model/function.rb +13 -11
  38. data/lib/expressir/model/identifier.rb +6 -3
  39. data/lib/expressir/model/interface.rb +3 -3
  40. data/lib/expressir/model/interface_item.rb +2 -2
  41. data/lib/expressir/model/interfaced_item.rb +9 -8
  42. data/lib/expressir/model/literals/binary.rb +1 -1
  43. data/lib/expressir/model/literals/integer.rb +1 -1
  44. data/lib/expressir/model/literals/logical.rb +1 -1
  45. data/lib/expressir/model/literals/real.rb +1 -1
  46. data/lib/expressir/model/literals/string.rb +2 -2
  47. data/lib/expressir/model/model_element.rb +47 -26
  48. data/lib/expressir/model/parameter.rb +9 -2
  49. data/lib/expressir/model/procedure.rb +12 -10
  50. data/lib/expressir/model/{informal_proposition.rb → remark_item.rb} +3 -6
  51. data/lib/expressir/model/repository.rb +1 -1
  52. data/lib/expressir/model/rule.rb +14 -12
  53. data/lib/expressir/model/schema.rb +15 -11
  54. data/lib/expressir/model/statements/alias.rb +5 -3
  55. data/lib/expressir/model/statements/assignment.rb +2 -2
  56. data/lib/expressir/model/statements/call.rb +2 -2
  57. data/lib/expressir/model/statements/case.rb +3 -3
  58. data/lib/expressir/model/statements/case_action.rb +2 -2
  59. data/lib/expressir/model/statements/compound.rb +1 -1
  60. data/lib/expressir/model/statements/if.rb +3 -3
  61. data/lib/expressir/model/statements/repeat.rb +9 -7
  62. data/lib/expressir/model/statements/return.rb +1 -1
  63. data/lib/expressir/model/subtype_constraint.rb +11 -4
  64. data/lib/expressir/model/type.rb +6 -4
  65. data/lib/expressir/model/types/aggregate.rb +8 -1
  66. data/lib/expressir/model/types/array.rb +5 -5
  67. data/lib/expressir/model/types/bag.rb +3 -3
  68. data/lib/expressir/model/types/binary.rb +2 -2
  69. data/lib/expressir/model/types/enumeration.rb +4 -4
  70. data/lib/expressir/model/types/generic.rb +7 -0
  71. data/lib/expressir/model/types/generic_entity.rb +7 -0
  72. data/lib/expressir/model/types/list.rb +4 -4
  73. data/lib/expressir/model/types/real.rb +1 -1
  74. data/lib/expressir/model/types/select.rb +5 -5
  75. data/lib/expressir/model/types/set.rb +3 -3
  76. data/lib/expressir/model/types/string.rb +2 -2
  77. data/lib/expressir/model/unique.rb +8 -1
  78. data/lib/expressir/model/variable.rb +9 -2
  79. data/lib/expressir/model/where.rb +8 -1
  80. data/lib/expressir/version.rb +1 -1
  81. data/original/examples/syntax/multiple.exp +1 -1
  82. data/original/examples/syntax/multiple.yaml +19 -5
  83. data/original/examples/syntax/multiple_formatted.exp +1 -1
  84. data/original/examples/syntax/multiple_hyperlink_formatted.exp +4 -4
  85. data/original/examples/syntax/multiple_schema_head_hyperlink_formatted.exp +1 -1
  86. data/original/examples/syntax/remark.exp +12 -10
  87. data/original/examples/syntax/remark.yaml +24 -4
  88. data/original/examples/syntax/remark_formatted.exp +3 -1
  89. data/original/examples/syntax/single.exp +1 -0
  90. data/original/examples/syntax/single.yaml +7 -1
  91. data/original/examples/syntax/single_formatted.exp +4 -0
  92. data/original/examples/syntax/single_formatted.yaml +15 -1
  93. data/original/examples/syntax/syntax.yaml +82 -1
  94. data/original/examples/syntax/syntax_hyperlink_formatted.exp +902 -0
  95. data/spec/expressir/express_exp/cache_spec.rb +64 -0
  96. data/spec/expressir/express_exp/formatter_spec.rb +16 -0
  97. data/spec/expressir/express_exp/parser_spec.rb +10 -33
  98. data/spec/expressir/model/model_element_spec.rb +82 -44
  99. metadata +10 -4
  100. data/original/examples/syntax/single_root_path.yaml +0 -9
@@ -0,0 +1,64 @@
1
+ require "yaml"
2
+ require "tempfile"
3
+ require "spec_helper"
4
+ require "expressir/express_exp/parser"
5
+ require "expressir/express_exp/cache"
6
+
7
+ RSpec.describe Expressir::ExpressExp::Cache do
8
+ TEST_VERSION = "0.0.0"
9
+
10
+ describe ".to_file" do
11
+ it "exports an object" do
12
+ temp_file = Tempfile.new
13
+
14
+ repository = Expressir::Model::Repository.new
15
+
16
+ begin
17
+ Expressir::ExpressExp::Cache.to_file(temp_file, repository, test_overwrite_version: TEST_VERSION)
18
+
19
+ size = File.size(temp_file)
20
+
21
+ expect(size).to be > 0
22
+ ensure
23
+ temp_file.close
24
+ temp_file.unlink
25
+ end
26
+ end
27
+ end
28
+
29
+ describe ".from_file" do
30
+ it "parses a file" do
31
+ temp_file = Tempfile.new
32
+
33
+ repository = Expressir::Model::Repository.new
34
+
35
+ begin
36
+ Expressir::ExpressExp::Cache.to_file(temp_file, repository, test_overwrite_version: TEST_VERSION)
37
+
38
+ result = Expressir::ExpressExp::Cache.from_file(temp_file, test_overwrite_version: TEST_VERSION)
39
+
40
+ expect(result).to be_instance_of(Expressir::Model::Repository)
41
+ ensure
42
+ temp_file.close
43
+ temp_file.unlink
44
+ end
45
+ end
46
+
47
+ it "fails parsing a file from a different Expressir version" do
48
+ temp_file = Tempfile.new
49
+
50
+ repository = Expressir::Model::Repository.new
51
+
52
+ begin
53
+ Expressir::ExpressExp::Cache.to_file(temp_file, repository, test_overwrite_version: TEST_VERSION)
54
+
55
+ expect do
56
+ Expressir::ExpressExp::Cache.from_file(temp_file)
57
+ end.to raise_error(Expressir::ExpressExp::CacheLoadError)
58
+ ensure
59
+ temp_file.close
60
+ temp_file.unlink
61
+ end
62
+ end
63
+ end
64
+ end
@@ -75,6 +75,22 @@ RSpec.describe Expressir::ExpressExp::Formatter do
75
75
  expect(result).to eq(expected_result)
76
76
  end
77
77
 
78
+ it "exports an object with hyperlink formatter (syntax.exp)" do
79
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
80
+ formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax_hyperlink_formatted.exp")
81
+
82
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
83
+
84
+ formatter = Class.new(Expressir::ExpressExp::Formatter) do
85
+ include Expressir::ExpressExp::HyperlinkFormatter
86
+ end
87
+ result = formatter.format(repo)
88
+ # File.write(formatted_exp_file, result)
89
+ expected_result = File.read(formatted_exp_file)
90
+
91
+ expect(result).to eq(expected_result)
92
+ end
93
+
78
94
  it "exports an object with hyperlink formatter (multiple.exp)" do
79
95
  exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
80
96
  formatted_exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple_hyperlink_formatted.exp")
@@ -9,7 +9,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
9
9
  yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single.yaml")
10
10
 
11
11
  repo = Expressir::ExpressExp::Parser.from_file(exp_file)
12
- result = YAML.dump(repo.to_hash(skip_empty: true))
12
+ result = YAML.dump(repo.to_hash(root_path: Expressir.root_path, skip_empty: true))
13
13
  # File.write(yaml_file, result)
14
14
  expected_result = File.read(yaml_file)
15
15
 
@@ -21,7 +21,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
21
21
  yaml_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.yaml")
22
22
 
23
23
  repo = Expressir::ExpressExp::Parser.from_file(exp_file)
24
- result = YAML.dump(repo.to_hash(skip_empty: true))
24
+ result = YAML.dump(repo.to_hash(root_path: Expressir.root_path, skip_empty: true))
25
25
  # File.write(yaml_file, result)
26
26
  expected_result = File.read(yaml_file)
27
27
 
@@ -33,7 +33,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
33
33
  yaml_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.yaml")
34
34
 
35
35
  repo = Expressir::ExpressExp::Parser.from_file(exp_file)
36
- result = YAML.dump(repo.to_hash(skip_empty: true))
36
+ result = YAML.dump(repo.to_hash(root_path: Expressir.root_path, skip_empty: true))
37
37
  # File.write(yaml_file, result)
38
38
  expected_result = File.read(yaml_file)
39
39
 
@@ -45,7 +45,7 @@ RSpec.describe Expressir::ExpressExp::Parser do
45
45
  yaml_file = Expressir.root_path.join("original", "examples", "syntax", "remark.yaml")
46
46
 
47
47
  repo = Expressir::ExpressExp::Parser.from_file(exp_file)
48
- result = YAML.dump(repo.to_hash(skip_empty: true))
48
+ result = YAML.dump(repo.to_hash(root_path: Expressir.root_path, skip_empty: true))
49
49
  # File.write(yaml_file, result)
50
50
  expected_result = File.read(yaml_file)
51
51
 
@@ -83,38 +83,15 @@ RSpec.describe Expressir::ExpressExp::Parser do
83
83
 
84
84
  schemas = repo.schemas
85
85
  expect(schemas.count).to eq(5)
86
- expect(schemas[0].file).to eq(exp_files[0].basename.to_s)
86
+ expect(schemas[0].file).to eq(exp_files[0].to_s)
87
87
  expect(schemas[0].id).to eq("single_schema")
88
- expect(schemas[1].file).to eq(exp_files[1].basename.to_s)
89
- expect(schemas[1].id).to eq("multiple_schema1")
90
- expect(schemas[2].file).to eq(exp_files[1].basename.to_s)
88
+ expect(schemas[1].file).to eq(exp_files[1].to_s)
89
+ expect(schemas[1].id).to eq("multiple_schema")
90
+ expect(schemas[2].file).to eq(exp_files[1].to_s)
91
91
  expect(schemas[2].id).to eq("multiple_schema2")
92
- expect(schemas[3].file).to eq(exp_files[1].basename.to_s)
92
+ expect(schemas[3].file).to eq(exp_files[1].to_s)
93
93
  expect(schemas[3].id).to eq("multiple_schema3")
94
- expect(schemas[4].file).to eq(exp_files[1].basename.to_s)
95
- expect(schemas[4].id).to eq("multiple_schema4")
96
- end
97
-
98
- it "parses multiple files with a root path (single.exp, multiple.exp)" do
99
- exp_files = [
100
- Expressir.root_path.join("original", "examples", "syntax", "single.exp"),
101
- Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
102
- ]
103
- root_path = Expressir.root_path
104
-
105
- repo = Expressir::ExpressExp::Parser.from_files(exp_files, root_path: root_path)
106
-
107
- schemas = repo.schemas
108
- expect(schemas.count).to eq(5)
109
- expect(schemas[0].file).to eq(exp_files[0].relative_path_from(root_path).to_s)
110
- expect(schemas[0].id).to eq("single_schema")
111
- expect(schemas[1].file).to eq(exp_files[1].relative_path_from(root_path).to_s)
112
- expect(schemas[1].id).to eq("multiple_schema1")
113
- expect(schemas[2].file).to eq(exp_files[1].relative_path_from(root_path).to_s)
114
- expect(schemas[2].id).to eq("multiple_schema2")
115
- expect(schemas[3].file).to eq(exp_files[1].relative_path_from(root_path).to_s)
116
- expect(schemas[3].id).to eq("multiple_schema3")
117
- expect(schemas[4].file).to eq(exp_files[1].relative_path_from(root_path).to_s)
94
+ expect(schemas[4].file).to eq(exp_files[1].to_s)
118
95
  expect(schemas[4].id).to eq("multiple_schema4")
119
96
  end
120
97
  end
@@ -6,27 +6,13 @@ require "expressir/express_exp/formatter"
6
6
 
7
7
  RSpec.describe Expressir::Model::ModelElement do
8
8
  describe ".to_hash" do
9
- it "exports an object with a root path (single.exp)" do
10
- exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
11
- yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single_root_path.yaml")
12
- root_path = Expressir.root_path
13
-
14
- repo = Expressir::ExpressExp::Parser.from_file(exp_file, root_path: root_path)
15
-
16
- result = YAML.dump(repo.to_hash(skip_empty: true))
17
- # File.write(yaml_file, result)
18
- expected_result = File.read(yaml_file)
19
-
20
- expect(result).to eq(expected_result)
21
- end
22
-
23
9
  it "exports an object with a formatter (single.exp)" do
24
10
  exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
25
11
  yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single_formatted.yaml")
26
12
 
27
13
  repo = Expressir::ExpressExp::Parser.from_file(exp_file)
28
14
 
29
- result = YAML.dump(repo.to_hash(formatter: Expressir::ExpressExp::Formatter, skip_empty: true))
15
+ result = YAML.dump(repo.to_hash(root_path: Expressir.root_path, formatter: Expressir::ExpressExp::Formatter, skip_empty: true))
30
16
  # File.write(yaml_file, result)
31
17
  expected_result = File.read(yaml_file)
32
18
 
@@ -39,9 +25,9 @@ RSpec.describe Expressir::Model::ModelElement do
39
25
  yaml_file = Expressir.root_path.join("original", "examples", "syntax", "single.yaml")
40
26
 
41
27
  input = YAML.load(File.read(yaml_file))
42
- repo = Expressir::Model::ModelElement.from_hash(input)
28
+ repo = Expressir::Model::ModelElement.from_hash(input, root_path: Expressir.root_path)
43
29
 
44
- result = YAML.dump(repo.to_hash(skip_empty: true))
30
+ result = YAML.dump(repo.to_hash(root_path: Expressir.root_path, skip_empty: true))
45
31
  expected_result = File.read(yaml_file)
46
32
 
47
33
  expect(result).to eq(expected_result)
@@ -51,9 +37,9 @@ RSpec.describe Expressir::Model::ModelElement do
51
37
  yaml_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.yaml")
52
38
 
53
39
  input = YAML.load(File.read(yaml_file))
54
- repo = Expressir::Model::ModelElement.from_hash(input)
40
+ repo = Expressir::Model::ModelElement.from_hash(input, root_path: Expressir.root_path)
55
41
 
56
- result = YAML.dump(repo.to_hash(skip_empty: true))
42
+ result = YAML.dump(repo.to_hash(root_path: Expressir.root_path, skip_empty: true))
57
43
  expected_result = File.read(yaml_file)
58
44
 
59
45
  expect(result).to eq(expected_result)
@@ -63,9 +49,9 @@ RSpec.describe Expressir::Model::ModelElement do
63
49
  yaml_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.yaml")
64
50
 
65
51
  input = YAML.load(File.read(yaml_file))
66
- repo = Expressir::Model::ModelElement.from_hash(input)
52
+ repo = Expressir::Model::ModelElement.from_hash(input, root_path: Expressir.root_path)
67
53
 
68
- result = YAML.dump(repo.to_hash(skip_empty: true))
54
+ result = YAML.dump(repo.to_hash(root_path: Expressir.root_path, skip_empty: true))
69
55
  expected_result = File.read(yaml_file)
70
56
 
71
57
  expect(result).to eq(expected_result)
@@ -75,9 +61,9 @@ RSpec.describe Expressir::Model::ModelElement do
75
61
  yaml_file = Expressir.root_path.join("original", "examples", "syntax", "remark.yaml")
76
62
 
77
63
  input = YAML.load(File.read(yaml_file))
78
- repo = Expressir::Model::ModelElement.from_hash(input)
64
+ repo = Expressir::Model::ModelElement.from_hash(input, root_path: Expressir.root_path)
79
65
 
80
- result = YAML.dump(repo.to_hash(skip_empty: true))
66
+ result = YAML.dump(repo.to_hash(root_path: Expressir.root_path, skip_empty: true))
81
67
  expected_result = File.read(yaml_file)
82
68
 
83
69
  expect(result).to eq(expected_result)
@@ -85,7 +71,57 @@ RSpec.describe Expressir::Model::ModelElement do
85
71
  end
86
72
 
87
73
  describe ".find" do
88
- it "finds an object" do
74
+ it "finds an object (single.exp)" do
75
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "single.exp")
76
+
77
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
78
+
79
+ # universal scope
80
+ expect(repo.find('single_schema')).to be_instance_of(Expressir::Model::Schema)
81
+ expect(repo.find('single_schema.empty_entity')).to be_instance_of(Expressir::Model::Entity)
82
+
83
+ # schema scope
84
+ schema = repo.schemas.first
85
+ expect(schema.find('empty_entity')).to be_instance_of(Expressir::Model::Entity)
86
+ end
87
+
88
+ it "finds an object (multiple.exp)" do
89
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "multiple.exp")
90
+
91
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
92
+
93
+ # universal scope
94
+ expect(repo.find('multiple_schema')).to be_instance_of(Expressir::Model::Schema)
95
+ expect(repo.find('multiple_schema.empty_entity')).to be_instance_of(Expressir::Model::Entity)
96
+ expect(repo.find('multiple_schema.attribute_entity')).to be_instance_of(Expressir::Model::Entity)
97
+ expect(repo.find('multiple_schema.attribute_entity2')).to be_instance_of(Expressir::Model::Entity)
98
+ expect(repo.find('multiple_schema.attribute_entity3')).to be_instance_of(Expressir::Model::Entity)
99
+ expect(repo.find('multiple_schema.attribute_entity4')).to be_instance_of(Expressir::Model::Entity)
100
+
101
+ # schema scope
102
+ schema = repo.schemas.first
103
+ expect(schema.find('empty_entity')).to be_instance_of(Expressir::Model::Entity)
104
+ expect(schema.find('attribute_entity')).to be_instance_of(Expressir::Model::Entity)
105
+ expect(schema.find('attribute_entity2')).to be_instance_of(Expressir::Model::Entity)
106
+ expect(schema.find('attribute_entity3')).to be_instance_of(Expressir::Model::Entity)
107
+ expect(schema.find('attribute_entity4')).to be_instance_of(Expressir::Model::Entity)
108
+ end
109
+
110
+ it "finds an object (syntax.exp)" do
111
+ exp_file = Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
112
+
113
+ repo = Expressir::ExpressExp::Parser.from_file(exp_file)
114
+
115
+ # universal scope
116
+ expect(repo.find('syntax_schema')).to be_instance_of(Expressir::Model::Schema)
117
+ expect(repo.find('syntax_schema.empty_entity')).to be_instance_of(Expressir::Model::Entity)
118
+
119
+ # schema scope
120
+ schema = repo.schemas.first
121
+ expect(schema.find('empty_entity')).to be_instance_of(Expressir::Model::Entity)
122
+ end
123
+
124
+ it "finds an object (remark.exp)" do
89
125
  exp_file = Expressir.root_path.join("original", "examples", "syntax", "remark.exp")
90
126
 
91
127
  repo = Expressir::ExpressExp::Parser.from_file(exp_file)
@@ -96,8 +132,8 @@ RSpec.describe Expressir::Model::ModelElement do
96
132
  expect(repo.find('remark_schema.remark_type')).to be_instance_of(Expressir::Model::Type)
97
133
  expect(repo.find('remark_schema.remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
98
134
  expect(repo.find('remark_schema.remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
99
- expect(repo.find('remark_schema.remark_type.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
100
- expect(repo.find('remark_schema.remark_type.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
135
+ expect(repo.find('remark_schema.remark_type.IP1')).to be_instance_of(Expressir::Model::RemarkItem)
136
+ expect(repo.find('remark_schema.remark_type.ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
101
137
  expect(repo.find('remark_schema.remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
102
138
  expect(repo.find('remark_schema.remark_entity')).to be_instance_of(Expressir::Model::Entity)
103
139
  expect(repo.find('remark_schema.remark_entity.remark_attribute')).to be_instance_of(Expressir::Model::Attribute)
@@ -106,8 +142,8 @@ RSpec.describe Expressir::Model::ModelElement do
106
142
  expect(repo.find('remark_schema.remark_entity.UR1')).to be_instance_of(Expressir::Model::Unique)
107
143
  expect(repo.find('remark_schema.remark_entity.WR1')).to be_instance_of(Expressir::Model::Where)
108
144
  expect(repo.find('remark_schema.remark_entity.wr:WR1')).to be_instance_of(Expressir::Model::Where)
109
- expect(repo.find('remark_schema.remark_entity.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
110
- expect(repo.find('remark_schema.remark_entity.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
145
+ expect(repo.find('remark_schema.remark_entity.IP1')).to be_instance_of(Expressir::Model::RemarkItem)
146
+ expect(repo.find('remark_schema.remark_entity.ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
111
147
  expect(repo.find('remark_schema.remark_subtype_constraint')).to be_instance_of(Expressir::Model::SubtypeConstraint)
112
148
  expect(repo.find('remark_schema.remark_function')).to be_instance_of(Expressir::Model::Function)
113
149
  expect(repo.find('remark_schema.remark_function.remark_parameter')).to be_instance_of(Expressir::Model::Parameter)
@@ -128,8 +164,9 @@ RSpec.describe Expressir::Model::ModelElement do
128
164
  expect(repo.find('remark_schema.remark_rule.remark_variable')).to be_instance_of(Expressir::Model::Variable)
129
165
  expect(repo.find('remark_schema.remark_rule.WR1')).to be_instance_of(Expressir::Model::Where)
130
166
  expect(repo.find('remark_schema.remark_rule.wr:WR1')).to be_instance_of(Expressir::Model::Where)
131
- expect(repo.find('remark_schema.remark_rule.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
132
- expect(repo.find('remark_schema.remark_rule.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
167
+ expect(repo.find('remark_schema.remark_rule.IP1')).to be_instance_of(Expressir::Model::RemarkItem)
168
+ expect(repo.find('remark_schema.remark_rule.ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
169
+ expect(repo.find('remark_schema.remark_item')).to be_instance_of(Expressir::Model::RemarkItem)
133
170
 
134
171
  # schema scope
135
172
  schema = repo.schemas.first
@@ -137,8 +174,8 @@ RSpec.describe Expressir::Model::ModelElement do
137
174
  expect(schema.find('remark_type')).to be_instance_of(Expressir::Model::Type)
138
175
  expect(schema.find('remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
139
176
  expect(schema.find('remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
140
- expect(schema.find('remark_type.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
141
- expect(schema.find('remark_type.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
177
+ expect(schema.find('remark_type.IP1')).to be_instance_of(Expressir::Model::RemarkItem)
178
+ expect(schema.find('remark_type.ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
142
179
  expect(schema.find('remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
143
180
  expect(schema.find('remark_entity')).to be_instance_of(Expressir::Model::Entity)
144
181
  expect(schema.find('remark_entity.remark_attribute')).to be_instance_of(Expressir::Model::Attribute)
@@ -147,8 +184,8 @@ RSpec.describe Expressir::Model::ModelElement do
147
184
  expect(schema.find('remark_entity.UR1')).to be_instance_of(Expressir::Model::Unique)
148
185
  expect(schema.find('remark_entity.WR1')).to be_instance_of(Expressir::Model::Where)
149
186
  expect(schema.find('remark_entity.wr:WR1')).to be_instance_of(Expressir::Model::Where)
150
- expect(schema.find('remark_entity.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
151
- expect(schema.find('remark_entity.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
187
+ expect(schema.find('remark_entity.IP1')).to be_instance_of(Expressir::Model::RemarkItem)
188
+ expect(schema.find('remark_entity.ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
152
189
  expect(schema.find('remark_subtype_constraint')).to be_instance_of(Expressir::Model::SubtypeConstraint)
153
190
  expect(schema.find('remark_function')).to be_instance_of(Expressir::Model::Function)
154
191
  expect(schema.find('remark_function.remark_parameter')).to be_instance_of(Expressir::Model::Parameter)
@@ -169,15 +206,16 @@ RSpec.describe Expressir::Model::ModelElement do
169
206
  expect(schema.find('remark_rule.remark_variable')).to be_instance_of(Expressir::Model::Variable)
170
207
  expect(schema.find('remark_rule.WR1')).to be_instance_of(Expressir::Model::Where)
171
208
  expect(schema.find('remark_rule.wr:WR1')).to be_instance_of(Expressir::Model::Where)
172
- expect(schema.find('remark_rule.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
173
- expect(schema.find('remark_rule.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
209
+ expect(schema.find('remark_rule.IP1')).to be_instance_of(Expressir::Model::RemarkItem)
210
+ expect(schema.find('remark_rule.ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
211
+ expect(schema.find('remark_item')).to be_instance_of(Expressir::Model::RemarkItem)
174
212
 
175
213
  # type scope
176
214
  type = schema.types.first
177
215
  expect(type.find('WR1')).to be_instance_of(Expressir::Model::Where)
178
216
  expect(type.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
179
- expect(type.find('IP1')).to be_instance_of(Expressir::Model::InformalProposition)
180
- expect(type.find('ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
217
+ expect(type.find('IP1')).to be_instance_of(Expressir::Model::RemarkItem)
218
+ expect(type.find('ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
181
219
 
182
220
  # entity scope
183
221
  entity = schema.entities.first
@@ -187,8 +225,8 @@ RSpec.describe Expressir::Model::ModelElement do
187
225
  expect(entity.find('UR1')).to be_instance_of(Expressir::Model::Unique)
188
226
  expect(entity.find('WR1')).to be_instance_of(Expressir::Model::Where)
189
227
  expect(entity.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
190
- expect(entity.find('IP1')).to be_instance_of(Expressir::Model::InformalProposition)
191
- expect(entity.find('ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
228
+ expect(entity.find('IP1')).to be_instance_of(Expressir::Model::RemarkItem)
229
+ expect(entity.find('ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
192
230
 
193
231
  # function scope
194
232
  function = schema.functions.first
@@ -214,15 +252,15 @@ RSpec.describe Expressir::Model::ModelElement do
214
252
  expect(rule.find('remark_variable')).to be_instance_of(Expressir::Model::Variable)
215
253
  expect(rule.find('WR1')).to be_instance_of(Expressir::Model::Where)
216
254
  expect(rule.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
217
- expect(rule.find('IP1')).to be_instance_of(Expressir::Model::InformalProposition)
218
- expect(rule.find('ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
255
+ expect(rule.find('IP1')).to be_instance_of(Expressir::Model::RemarkItem)
256
+ expect(rule.find('ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
219
257
 
220
258
  # retry search in parent scope
221
259
  expect(entity.find('remark_type')).to be_instance_of(Expressir::Model::Type)
222
260
  expect(entity.find('remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
223
261
  expect(entity.find('remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
224
- expect(entity.find('remark_type.IP1')).to be_instance_of(Expressir::Model::InformalProposition)
225
- expect(entity.find('remark_type.ip:IP1')).to be_instance_of(Expressir::Model::InformalProposition)
262
+ expect(entity.find('remark_type.IP1')).to be_instance_of(Expressir::Model::RemarkItem)
263
+ expect(entity.find('remark_type.ip:IP1')).to be_instance_of(Expressir::Model::RemarkItem)
226
264
  end
227
265
  end
228
266
  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: 0.2.18
4
+ version: 0.2.26
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-10 00:00:00.000000000 Z
11
+ date: 2021-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -175,6 +175,7 @@ files:
175
175
  - docs/development.md
176
176
  - exe/expressir
177
177
  - exe/format
178
+ - exe/format-test
178
179
  - exe/generate-parser
179
180
  - expressir.gemspec
180
181
  - lib/expressir.rb
@@ -215,14 +216,18 @@ files:
215
216
  - lib/expressir/express_exp/2.6/express_parser.bundle
216
217
  - lib/expressir/express_exp/2.7/express_parser.bundle
217
218
  - lib/expressir/express_exp/3.0/express_parser.bundle
219
+ - lib/expressir/express_exp/cache.rb
218
220
  - lib/expressir/express_exp/formatter.rb
219
221
  - lib/expressir/express_exp/hyperlink_formatter.rb
222
+ - lib/expressir/express_exp/model_visitor.rb
220
223
  - lib/expressir/express_exp/parser.rb
224
+ - lib/expressir/express_exp/resolve_references_model_visitor.rb
221
225
  - lib/expressir/express_exp/schema_head_formatter.rb
222
226
  - lib/expressir/express_exp/visitor.rb
223
227
  - lib/expressir/express_parser.rb
224
228
  - lib/expressir/model.rb
225
229
  - lib/expressir/model/attribute.rb
230
+ - lib/expressir/model/cache.rb
226
231
  - lib/expressir/model/constant.rb
227
232
  - lib/expressir/model/entity.rb
228
233
  - lib/expressir/model/enumeration_item.rb
@@ -240,7 +245,6 @@ files:
240
245
  - lib/expressir/model/expressions/unary_expression.rb
241
246
  - lib/expressir/model/function.rb
242
247
  - lib/expressir/model/identifier.rb
243
- - lib/expressir/model/informal_proposition.rb
244
248
  - lib/expressir/model/interface.rb
245
249
  - lib/expressir/model/interface_item.rb
246
250
  - lib/expressir/model/interfaced_item.rb
@@ -252,6 +256,7 @@ files:
252
256
  - lib/expressir/model/model_element.rb
253
257
  - lib/expressir/model/parameter.rb
254
258
  - lib/expressir/model/procedure.rb
259
+ - lib/expressir/model/remark_item.rb
255
260
  - lib/expressir/model/repository.rb
256
261
  - lib/expressir/model/rule.rb
257
262
  - lib/expressir/model/schema.rb
@@ -332,10 +337,10 @@ files:
332
337
  - original/examples/syntax/single.yaml
333
338
  - original/examples/syntax/single_formatted.exp
334
339
  - original/examples/syntax/single_formatted.yaml
335
- - original/examples/syntax/single_root_path.yaml
336
340
  - original/examples/syntax/syntax.exp
337
341
  - original/examples/syntax/syntax.yaml
338
342
  - original/examples/syntax/syntax_formatted.exp
343
+ - original/examples/syntax/syntax_hyperlink_formatted.exp
339
344
  - original/examples/syntax/syntax_schema_head_formatted.exp
340
345
  - original/exp2ruby.rb
341
346
  - original/expsm.rb
@@ -348,6 +353,7 @@ files:
348
353
  - spec/acceptance/express_to_owl_spec.rb
349
354
  - spec/acceptance/version_spec.rb
350
355
  - spec/expressir/express/repository_spec.rb
356
+ - spec/expressir/express_exp/cache_spec.rb
351
357
  - spec/expressir/express_exp/formatter_spec.rb
352
358
  - spec/expressir/express_exp/parser_spec.rb
353
359
  - spec/expressir/model/model_element_spec.rb