expressir 0.2.15-arm64-darwin → 0.2.21-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +5 -0
  3. data/.github/workflows/release.yml +16 -4
  4. data/README.adoc +3 -3
  5. data/exe/format +66 -12
  6. data/lib/expressir/express_exp/2.4/express_parser.bundle +0 -0
  7. data/lib/expressir/express_exp/2.5/express_parser.bundle +0 -0
  8. data/lib/expressir/express_exp/2.6/express_parser.bundle +0 -0
  9. data/lib/expressir/express_exp/2.7/express_parser.bundle +0 -0
  10. data/lib/expressir/express_exp/3.0/express_parser.bundle +0 -0
  11. data/lib/expressir/express_exp/cache.rb +48 -0
  12. data/lib/expressir/express_exp/formatter.rb +185 -135
  13. data/lib/expressir/express_exp/hyperlink_formatter.rb +1 -3
  14. data/lib/expressir/express_exp/parser.rb +33 -29
  15. data/lib/expressir/express_exp/schema_head_formatter.rb +2 -7
  16. data/lib/expressir/express_exp/visitor.rb +11 -30
  17. data/lib/expressir/model.rb +2 -0
  18. data/lib/expressir/model/cache.rb +13 -0
  19. data/lib/expressir/model/entity.rb +6 -6
  20. data/lib/expressir/model/expressions/query_expression.rb +3 -3
  21. data/lib/expressir/model/function.rb +15 -11
  22. data/lib/expressir/model/informal_proposition.rb +4 -1
  23. data/lib/expressir/model/interfaced_item.rb +4 -1
  24. data/lib/expressir/model/model_element.rb +43 -13
  25. data/lib/expressir/model/procedure.rb +15 -11
  26. data/lib/expressir/model/repository.rb +3 -3
  27. data/lib/expressir/model/rule.rb +16 -12
  28. data/lib/expressir/model/schema.rb +52 -48
  29. data/lib/expressir/model/statements/alias.rb +3 -3
  30. data/lib/expressir/model/statements/repeat.rb +3 -3
  31. data/lib/expressir/model/subtype_constraint.rb +1 -6
  32. data/lib/expressir/model/type.rb +9 -5
  33. data/lib/expressir/version.rb +1 -1
  34. data/original/examples/syntax/{hyperlink.exp → multiple.exp} +8 -8
  35. data/original/examples/syntax/multiple.yaml +184 -0
  36. data/original/examples/syntax/multiple_formatted.exp +71 -0
  37. data/original/examples/syntax/multiple_hyperlink_formatted.exp +71 -0
  38. data/original/examples/syntax/multiple_schema_head_hyperlink_formatted.exp +13 -0
  39. data/original/examples/syntax/remark.exp +41 -41
  40. data/original/examples/syntax/remark.yaml +446 -0
  41. data/original/examples/syntax/remark_formatted.exp +62 -50
  42. data/original/examples/syntax/{simple.exp → single.exp} +1 -1
  43. data/original/examples/syntax/single.yaml +9 -0
  44. data/original/examples/syntax/single_formatted.exp +6 -0
  45. data/original/examples/syntax/single_formatted.yaml +19 -0
  46. data/original/examples/syntax/syntax.exp +29 -19
  47. data/original/examples/syntax/syntax.yaml +3439 -0
  48. data/original/examples/syntax/syntax_formatted.exp +271 -131
  49. data/original/examples/syntax/syntax_schema_head_formatted.exp +18 -0
  50. data/spec/expressir/express_exp/cache_spec.rb +64 -0
  51. data/spec/expressir/express_exp/formatter_spec.rb +111 -0
  52. data/spec/expressir/express_exp/parser_spec.rb +98 -0
  53. data/spec/expressir/model/{model_element/find_spec.rb → model_element_spec.rb} +96 -10
  54. metadata +20 -17
  55. data/original/examples/syntax/hyperlink_formatted.exp +0 -51
  56. data/original/examples/syntax/source.exp +0 -16
  57. data/spec/expressir/express_exp/formatter/remark_spec.rb +0 -28
  58. data/spec/expressir/express_exp/formatter/syntax_spec.rb +0 -28
  59. data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +0 -24
  60. data/spec/expressir/express_exp/parser/head_source_spec.rb +0 -38
  61. data/spec/expressir/express_exp/parser/multiple_spec.rb +0 -37
  62. data/spec/expressir/express_exp/parser/remark_spec.rb +0 -411
  63. data/spec/expressir/express_exp/parser/source_spec.rb +0 -29
  64. data/spec/expressir/express_exp/parser/syntax_spec.rb +0 -3086
  65. data/spec/expressir/express_exp/schema_head_formatter_spec.rb +0 -36
  66. data/spec/expressir/model/model_element/hash_spec.rb +0 -66
@@ -1,36 +0,0 @@
1
- require "spec_helper"
2
- require "expressir/express_exp/parser"
3
- require "expressir/express_exp/schema_head_formatter"
4
-
5
- RSpec.describe Expressir::ExpressExp::SchemaHeadFormatter do
6
- describe ".format" do
7
- it "formats schema head" do
8
- repo = Expressir::ExpressExp::Parser.from_file(sample_file)
9
-
10
- result = Expressir::ExpressExp::SchemaHeadFormatter.format(repo)
11
-
12
- expect(result).to eq(<<~EXP.strip
13
- SCHEMA syntax_schema 'version';
14
- USE FROM contract_schema;
15
- USE FROM contract_schema
16
- (contract);
17
- USE FROM contract_schema
18
- (contract, contract2);
19
- USE FROM contract_schema
20
- (contract AS contract2);
21
- REFERENCE FROM contract_schema;
22
- REFERENCE FROM contract_schema
23
- (contract);
24
- REFERENCE FROM contract_schema
25
- (contract, contract2);
26
- REFERENCE FROM contract_schema
27
- (contract AS contract2);
28
- EXP
29
- )
30
- end
31
- end
32
-
33
- def sample_file
34
- @sample_file ||= Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
35
- end
36
- end
@@ -1,66 +0,0 @@
1
- require "spec_helper"
2
- require "expressir/express_exp/parser"
3
- require "expressir/express_exp/formatter"
4
-
5
- RSpec.describe Expressir::Model::ModelElement do
6
- describe ".from_hash" do
7
- it "parses an object from a hash" do
8
- input = {
9
- "_class" => "Expressir::Model::Repository",
10
- "schemas" => [{
11
- "_class" => "Expressir::Model::Schema",
12
- "id" => "simple_schema",
13
- "entities" => [{
14
- "_class" => "Expressir::Model::Entity",
15
- "id" => "empty_entity"
16
- }]
17
- }]
18
- }
19
-
20
- repo = Expressir::Model::ModelElement.from_hash(input)
21
-
22
- expect(repo).to be_instance_of(Expressir::Model::Repository)
23
- expect(repo.schemas).to be_instance_of(Array)
24
- expect(repo.schemas.count).to eq(1)
25
- expect(repo.schemas.first).to be_instance_of(Expressir::Model::Schema)
26
- expect(repo.schemas.first.id).to eq("simple_schema")
27
- expect(repo.schemas.first.entities).to be_instance_of(Array)
28
- expect(repo.schemas.first.entities.count).to eq(1)
29
- expect(repo.schemas.first.entities.first).to be_instance_of(Expressir::Model::Entity)
30
- expect(repo.schemas.first.entities.first.id).to eq("empty_entity")
31
- end
32
- end
33
-
34
- describe ".to_hash" do
35
- it "exports an object to a hash" do
36
- repo = Expressir::ExpressExp::Parser.from_file(sample_file)
37
-
38
- class CustomFormatter < Expressir::ExpressExp::Formatter
39
- def format_schema(node)
40
- "Oook."
41
- end
42
- end
43
- result = repo.to_hash(formatter: CustomFormatter)
44
-
45
- expect(result).to be_instance_of(Hash)
46
- expect(result["_class"]).to eq("Expressir::Model::Repository")
47
- expect(result["schemas"]).to be_instance_of(Array)
48
- expect(result["schemas"].count).to eq(1)
49
- expect(result["schemas"].first).to be_instance_of(Hash)
50
- expect(result["schemas"].first["_class"]).to eq("Expressir::Model::Schema")
51
- expect(result["schemas"].first["id"]).to eq("simple_schema")
52
- expect(result["schemas"].first["entities"]).to be_instance_of(Array)
53
- expect(result["schemas"].first["entities"].count).to eq(1)
54
- expect(result["schemas"].first["entities"].first).to be_instance_of(Hash)
55
- expect(result["schemas"].first["entities"].first["_class"]).to eq("Expressir::Model::Entity")
56
- expect(result["schemas"].first["entities"].first["id"]).to eq("empty_entity")
57
- expect(result["schemas"].first["source"]).to eq("Oook.")
58
- end
59
- end
60
-
61
- def sample_file
62
- @sample_file ||= Expressir.root_path.join(
63
- "original", "examples", "syntax", "simple.exp"
64
- )
65
- end
66
- end