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.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +5 -0
- data/.github/workflows/release.yml +16 -4
- data/README.adoc +3 -3
- data/exe/format +66 -12
- data/lib/expressir/express_exp/2.4/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/3.0/express_parser.bundle +0 -0
- data/lib/expressir/express_exp/cache.rb +48 -0
- data/lib/expressir/express_exp/formatter.rb +185 -135
- data/lib/expressir/express_exp/hyperlink_formatter.rb +1 -3
- data/lib/expressir/express_exp/parser.rb +33 -29
- data/lib/expressir/express_exp/schema_head_formatter.rb +2 -7
- data/lib/expressir/express_exp/visitor.rb +11 -30
- data/lib/expressir/model.rb +2 -0
- data/lib/expressir/model/cache.rb +13 -0
- data/lib/expressir/model/entity.rb +6 -6
- data/lib/expressir/model/expressions/query_expression.rb +3 -3
- data/lib/expressir/model/function.rb +15 -11
- data/lib/expressir/model/informal_proposition.rb +4 -1
- data/lib/expressir/model/interfaced_item.rb +4 -1
- data/lib/expressir/model/model_element.rb +43 -13
- data/lib/expressir/model/procedure.rb +15 -11
- data/lib/expressir/model/repository.rb +3 -3
- data/lib/expressir/model/rule.rb +16 -12
- data/lib/expressir/model/schema.rb +52 -48
- data/lib/expressir/model/statements/alias.rb +3 -3
- data/lib/expressir/model/statements/repeat.rb +3 -3
- data/lib/expressir/model/subtype_constraint.rb +1 -6
- data/lib/expressir/model/type.rb +9 -5
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/{hyperlink.exp → multiple.exp} +8 -8
- data/original/examples/syntax/multiple.yaml +184 -0
- data/original/examples/syntax/multiple_formatted.exp +71 -0
- data/original/examples/syntax/multiple_hyperlink_formatted.exp +71 -0
- data/original/examples/syntax/multiple_schema_head_hyperlink_formatted.exp +13 -0
- data/original/examples/syntax/remark.exp +41 -41
- data/original/examples/syntax/remark.yaml +446 -0
- data/original/examples/syntax/remark_formatted.exp +62 -50
- data/original/examples/syntax/{simple.exp → single.exp} +1 -1
- data/original/examples/syntax/single.yaml +9 -0
- data/original/examples/syntax/single_formatted.exp +6 -0
- data/original/examples/syntax/single_formatted.yaml +19 -0
- data/original/examples/syntax/syntax.exp +29 -19
- data/original/examples/syntax/syntax.yaml +3439 -0
- data/original/examples/syntax/syntax_formatted.exp +271 -131
- data/original/examples/syntax/syntax_schema_head_formatted.exp +18 -0
- data/spec/expressir/express_exp/cache_spec.rb +64 -0
- data/spec/expressir/express_exp/formatter_spec.rb +111 -0
- data/spec/expressir/express_exp/parser_spec.rb +98 -0
- data/spec/expressir/model/{model_element/find_spec.rb → model_element_spec.rb} +96 -10
- metadata +20 -17
- data/original/examples/syntax/hyperlink_formatted.exp +0 -51
- data/original/examples/syntax/source.exp +0 -16
- data/spec/expressir/express_exp/formatter/remark_spec.rb +0 -28
- data/spec/expressir/express_exp/formatter/syntax_spec.rb +0 -28
- data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +0 -24
- data/spec/expressir/express_exp/parser/head_source_spec.rb +0 -38
- data/spec/expressir/express_exp/parser/multiple_spec.rb +0 -37
- data/spec/expressir/express_exp/parser/remark_spec.rb +0 -411
- data/spec/expressir/express_exp/parser/source_spec.rb +0 -29
- data/spec/expressir/express_exp/parser/syntax_spec.rb +0 -3086
- data/spec/expressir/express_exp/schema_head_formatter_spec.rb +0 -36
- 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
|