expressir 0.2.16-x86-linux → 0.2.24-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +5 -0
  3. data/.github/workflows/release.yml +31 -3
  4. data/README.adoc +3 -3
  5. data/exe/format +66 -12
  6. data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
  7. data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
  8. data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
  9. data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
  10. data/lib/expressir/express_exp/3.0/express_parser.so +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/parser.rb +33 -29
  14. data/lib/expressir/express_exp/schema_head_formatter.rb +1 -4
  15. data/lib/expressir/express_exp/visitor.rb +29 -23
  16. data/lib/expressir/model.rb +3 -1
  17. data/lib/expressir/model/attribute.rb +12 -5
  18. data/lib/expressir/model/cache.rb +13 -0
  19. data/lib/expressir/model/constant.rb +9 -2
  20. data/lib/expressir/model/entity.rb +15 -13
  21. data/lib/expressir/model/enumeration_item.rb +7 -0
  22. data/lib/expressir/model/expressions/aggregate_initializer.rb +1 -1
  23. data/lib/expressir/model/expressions/aggregate_item.rb +2 -2
  24. data/lib/expressir/model/expressions/attribute_reference.rb +2 -2
  25. data/lib/expressir/model/expressions/binary_expression.rb +3 -3
  26. data/lib/expressir/model/expressions/call.rb +2 -2
  27. data/lib/expressir/model/expressions/entity_constructor.rb +2 -2
  28. data/lib/expressir/model/expressions/group_reference.rb +2 -2
  29. data/lib/expressir/model/expressions/index_reference.rb +3 -3
  30. data/lib/expressir/model/expressions/interval.rb +5 -5
  31. data/lib/expressir/model/expressions/query_expression.rb +7 -5
  32. data/lib/expressir/model/expressions/simple_reference.rb +1 -1
  33. data/lib/expressir/model/expressions/unary_expression.rb +2 -2
  34. data/lib/expressir/model/function.rb +27 -21
  35. data/lib/expressir/model/identifier.rb +6 -3
  36. data/lib/expressir/model/interface.rb +3 -3
  37. data/lib/expressir/model/interface_item.rb +2 -2
  38. data/lib/expressir/model/interfaced_item.rb +11 -3
  39. data/lib/expressir/model/literals/binary.rb +1 -1
  40. data/lib/expressir/model/literals/integer.rb +1 -1
  41. data/lib/expressir/model/literals/logical.rb +1 -1
  42. data/lib/expressir/model/literals/real.rb +1 -1
  43. data/lib/expressir/model/literals/string.rb +2 -2
  44. data/lib/expressir/model/model_element.rb +54 -19
  45. data/lib/expressir/model/parameter.rb +9 -2
  46. data/lib/expressir/model/procedure.rb +26 -20
  47. data/lib/expressir/model/{informal_proposition.rb → remark_item.rb} +3 -3
  48. data/lib/expressir/model/repository.rb +4 -4
  49. data/lib/expressir/model/rule.rb +29 -23
  50. data/lib/expressir/model/schema.rb +63 -54
  51. data/lib/expressir/model/statements/alias.rb +7 -5
  52. data/lib/expressir/model/statements/assignment.rb +2 -2
  53. data/lib/expressir/model/statements/call.rb +2 -2
  54. data/lib/expressir/model/statements/case.rb +3 -3
  55. data/lib/expressir/model/statements/case_action.rb +2 -2
  56. data/lib/expressir/model/statements/compound.rb +1 -1
  57. data/lib/expressir/model/statements/if.rb +3 -3
  58. data/lib/expressir/model/statements/repeat.rb +11 -9
  59. data/lib/expressir/model/statements/return.rb +1 -1
  60. data/lib/expressir/model/subtype_constraint.rb +9 -7
  61. data/lib/expressir/model/type.rb +14 -8
  62. data/lib/expressir/model/types/aggregate.rb +8 -1
  63. data/lib/expressir/model/types/array.rb +5 -5
  64. data/lib/expressir/model/types/bag.rb +3 -3
  65. data/lib/expressir/model/types/binary.rb +2 -2
  66. data/lib/expressir/model/types/enumeration.rb +4 -4
  67. data/lib/expressir/model/types/generic.rb +7 -0
  68. data/lib/expressir/model/types/generic_entity.rb +7 -0
  69. data/lib/expressir/model/types/list.rb +4 -4
  70. data/lib/expressir/model/types/real.rb +1 -1
  71. data/lib/expressir/model/types/select.rb +5 -5
  72. data/lib/expressir/model/types/set.rb +3 -3
  73. data/lib/expressir/model/types/string.rb +2 -2
  74. data/lib/expressir/model/unique.rb +8 -1
  75. data/lib/expressir/model/variable.rb +9 -2
  76. data/lib/expressir/model/where.rb +8 -1
  77. data/lib/expressir/version.rb +1 -1
  78. data/original/examples/syntax/{hyperlink.exp → multiple.exp} +8 -8
  79. data/original/examples/syntax/multiple.yaml +184 -0
  80. data/original/examples/syntax/multiple_formatted.exp +71 -0
  81. data/original/examples/syntax/multiple_hyperlink_formatted.exp +71 -0
  82. data/original/examples/syntax/multiple_schema_head_hyperlink_formatted.exp +13 -0
  83. data/original/examples/syntax/remark.exp +52 -50
  84. data/original/examples/syntax/remark.yaml +452 -0
  85. data/original/examples/syntax/remark_formatted.exp +64 -50
  86. data/original/examples/syntax/{simple.exp → single.exp} +1 -1
  87. data/original/examples/syntax/single.yaml +9 -0
  88. data/original/examples/syntax/single_formatted.exp +6 -0
  89. data/original/examples/syntax/single_formatted.yaml +19 -0
  90. data/original/examples/syntax/syntax.exp +29 -19
  91. data/original/examples/syntax/syntax.yaml +3439 -0
  92. data/original/examples/syntax/syntax_formatted.exp +271 -131
  93. data/original/examples/syntax/syntax_schema_head_formatted.exp +18 -0
  94. data/spec/expressir/express_exp/cache_spec.rb +64 -0
  95. data/spec/expressir/express_exp/formatter_spec.rb +111 -0
  96. data/spec/expressir/express_exp/parser_spec.rb +98 -0
  97. data/spec/expressir/model/{model_element/find_spec.rb → model_element_spec.rb} +96 -10
  98. metadata +21 -17
  99. data/original/examples/syntax/hyperlink_formatted.exp +0 -51
  100. data/original/examples/syntax/source.exp +0 -16
  101. data/spec/expressir/express_exp/formatter/remark_spec.rb +0 -28
  102. data/spec/expressir/express_exp/formatter/syntax_spec.rb +0 -28
  103. data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +0 -28
  104. data/spec/expressir/express_exp/parser/multiple_spec.rb +0 -37
  105. data/spec/expressir/express_exp/parser/remark_spec.rb +0 -411
  106. data/spec/expressir/express_exp/parser/source_spec.rb +0 -29
  107. data/spec/expressir/express_exp/parser/syntax_spec.rb +0 -3086
  108. data/spec/expressir/express_exp/schema_head_formatter_spec.rb +0 -40
  109. data/spec/expressir/model/model_element/hash_spec.rb +0 -66
@@ -1,40 +0,0 @@
1
- require "spec_helper"
2
- require "expressir/express_exp/parser"
3
- require "expressir/express_exp/formatter"
4
- require "expressir/express_exp/schema_head_formatter"
5
-
6
- RSpec.describe Expressir::ExpressExp::SchemaHeadFormatter do
7
- describe ".format" do
8
- it "formats schema head" do
9
- repo = Expressir::ExpressExp::Parser.from_file(sample_file)
10
-
11
- class CustomFormatter < Expressir::ExpressExp::Formatter
12
- include Expressir::ExpressExp::SchemaHeadFormatter
13
- end
14
- result = CustomFormatter.format(repo)
15
-
16
- expect(result).to eq(<<~EXP.strip
17
- SCHEMA syntax_schema 'version';
18
- USE FROM contract_schema;
19
- USE FROM contract_schema
20
- (contract);
21
- USE FROM contract_schema
22
- (contract, contract2);
23
- USE FROM contract_schema
24
- (contract AS contract2);
25
- REFERENCE FROM contract_schema;
26
- REFERENCE FROM contract_schema
27
- (contract);
28
- REFERENCE FROM contract_schema
29
- (contract, contract2);
30
- REFERENCE FROM contract_schema
31
- (contract AS contract2);
32
- EXP
33
- )
34
- end
35
- end
36
-
37
- def sample_file
38
- @sample_file ||= Expressir.root_path.join("original", "examples", "syntax", "syntax.exp")
39
- end
40
- 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