expressir 0.2.9-x64-mingw32 → 0.2.10-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
- data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
- data/lib/expressir/express_exp/formatter.rb +71 -16
- data/lib/expressir/express_exp/visitor.rb +95 -41
- data/lib/expressir/model.rb +2 -0
- data/lib/expressir/model/attribute.rb +3 -1
- data/lib/expressir/model/constant.rb +3 -1
- data/lib/expressir/model/entity.rb +11 -21
- data/lib/expressir/model/enumeration_item.rb +3 -1
- data/lib/expressir/model/expressions/aggregate_initializer.rb +2 -2
- data/lib/expressir/model/expressions/aggregate_item.rb +1 -1
- data/lib/expressir/model/expressions/attribute_reference.rb +1 -1
- data/lib/expressir/model/expressions/binary_expression.rb +1 -1
- data/lib/expressir/model/expressions/call.rb +2 -2
- data/lib/expressir/model/expressions/entity_constructor.rb +2 -2
- data/lib/expressir/model/expressions/group_reference.rb +1 -1
- data/lib/expressir/model/expressions/index_reference.rb +1 -1
- data/lib/expressir/model/expressions/interval.rb +1 -1
- data/lib/expressir/model/expressions/query_expression.rb +3 -1
- data/lib/expressir/model/expressions/simple_reference.rb +1 -1
- data/lib/expressir/model/expressions/unary_expression.rb +1 -1
- data/lib/expressir/model/function.rb +32 -38
- data/lib/expressir/model/identifier.rb +1 -2
- data/lib/expressir/model/informal_proposition.rb +3 -1
- data/lib/expressir/model/interface.rb +2 -2
- data/lib/expressir/model/literals/binary.rb +1 -1
- data/lib/expressir/model/literals/integer.rb +1 -1
- data/lib/expressir/model/literals/logical.rb +1 -1
- data/lib/expressir/model/literals/real.rb +1 -1
- data/lib/expressir/model/literals/string.rb +1 -1
- data/lib/expressir/model/model_element.rb +67 -0
- data/lib/expressir/model/parameter.rb +3 -1
- data/lib/expressir/model/procedure.rb +33 -39
- data/lib/expressir/model/renamed_ref.rb +1 -1
- data/lib/expressir/model/repository.rb +3 -3
- data/lib/expressir/model/rule.rb +34 -40
- data/lib/expressir/model/schema.rb +35 -48
- data/lib/expressir/model/scope.rb +0 -3
- data/lib/expressir/model/statements/alias.rb +4 -2
- data/lib/expressir/model/statements/assignment.rb +1 -1
- data/lib/expressir/model/statements/call.rb +2 -2
- data/lib/expressir/model/statements/case.rb +2 -2
- data/lib/expressir/model/statements/case_action.rb +2 -2
- data/lib/expressir/model/statements/compound.rb +2 -2
- data/lib/expressir/model/statements/escape.rb +1 -1
- data/lib/expressir/model/statements/if.rb +3 -3
- data/lib/expressir/model/statements/null.rb +1 -1
- data/lib/expressir/model/statements/repeat.rb +4 -2
- data/lib/expressir/model/statements/return.rb +1 -1
- data/lib/expressir/model/statements/skip.rb +1 -1
- data/lib/expressir/model/subtype_constraint.rb +3 -1
- data/lib/expressir/model/type.rb +7 -5
- data/lib/expressir/model/types/aggregate.rb +3 -1
- data/lib/expressir/model/types/array.rb +1 -1
- data/lib/expressir/model/types/bag.rb +1 -1
- data/lib/expressir/model/types/binary.rb +1 -1
- data/lib/expressir/model/types/boolean.rb +1 -1
- data/lib/expressir/model/types/enumeration.rb +3 -3
- data/lib/expressir/model/types/generic.rb +3 -1
- data/lib/expressir/model/types/generic_entity.rb +3 -1
- data/lib/expressir/model/types/integer.rb +1 -1
- data/lib/expressir/model/types/list.rb +1 -1
- data/lib/expressir/model/types/logical.rb +1 -1
- data/lib/expressir/model/types/number.rb +1 -1
- data/lib/expressir/model/types/real.rb +1 -1
- data/lib/expressir/model/types/select.rb +3 -3
- data/lib/expressir/model/types/set.rb +1 -1
- data/lib/expressir/model/types/string.rb +1 -1
- data/lib/expressir/model/unique.rb +4 -2
- data/lib/expressir/model/variable.rb +3 -1
- data/lib/expressir/model/where.rb +3 -1
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/remark_formatted.exp +0 -5
- data/original/examples/syntax/simple.exp +3 -0
- data/original/examples/syntax/syntax.exp +189 -181
- data/original/examples/syntax/syntax_formatted.exp +346 -792
- data/spec/expressir/express_exp/head_source_spec.rb +1 -4
- data/spec/expressir/express_exp/parse_remark_spec.rb +3 -3
- data/spec/expressir/express_exp/parse_syntax_spec.rb +1583 -1578
- data/spec/expressir/express_exp/source_spec.rb +1 -4
- data/spec/expressir/model/model_element_spec.rb +59 -0
- data/spec/expressir/model/{find_spec.rb → scope_spec.rb} +1 -1
- metadata +6 -3
@@ -1,15 +1,12 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "expressir/express_exp/parser"
|
3
3
|
|
4
|
-
RSpec.describe Expressir::
|
4
|
+
RSpec.describe Expressir::ExpressExp::Parser do
|
5
5
|
describe ".source" do
|
6
6
|
it "contains original source" do
|
7
7
|
input = File.read(sample_file)
|
8
8
|
repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
|
9
9
|
|
10
|
-
expected_result = input
|
11
|
-
expect(repo.source).to eq(expected_result)
|
12
|
-
|
13
10
|
schema = repo.schemas.first
|
14
11
|
start_index = input.index("SCHEMA")
|
15
12
|
stop_index = input.index("END_SCHEMA;") + "END_SCHEMA;".length - 1
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "expressir/express_exp/parser"
|
3
|
+
|
4
|
+
RSpec.describe Expressir::Model::ModelElement do
|
5
|
+
describe ".from_hash" do
|
6
|
+
it "parses an object from hash" do
|
7
|
+
input = {
|
8
|
+
"_class" => "Expressir::Model::Repository",
|
9
|
+
"schemas" => [{
|
10
|
+
"_class" => "Expressir::Model::Schema",
|
11
|
+
"id" => "simple_schema",
|
12
|
+
"entities" => [{
|
13
|
+
"_class" => "Expressir::Model::Entity",
|
14
|
+
"id" => "empty_entity"
|
15
|
+
}]
|
16
|
+
}]
|
17
|
+
}
|
18
|
+
|
19
|
+
repo = Expressir::Model::ModelElement.from_hash(input)
|
20
|
+
|
21
|
+
expect(repo).to be_instance_of(Expressir::Model::Repository)
|
22
|
+
expect(repo.schemas).to be_instance_of(Array)
|
23
|
+
expect(repo.schemas.count).to eq(1)
|
24
|
+
expect(repo.schemas[0]).to be_instance_of(Expressir::Model::Schema)
|
25
|
+
expect(repo.schemas[0].id).to eq("simple_schema")
|
26
|
+
expect(repo.schemas[0].entities).to be_instance_of(Array)
|
27
|
+
expect(repo.schemas[0].entities.count).to eq(1)
|
28
|
+
expect(repo.schemas[0].entities[0]).to be_instance_of(Expressir::Model::Entity)
|
29
|
+
expect(repo.schemas[0].entities[0].id).to eq("empty_entity")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe ".to_hash" do
|
34
|
+
it "exports an object to hash" do
|
35
|
+
repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
|
36
|
+
|
37
|
+
result = repo.to_hash
|
38
|
+
|
39
|
+
expect(result).to be_instance_of(Hash)
|
40
|
+
expect(result["_class"]).to eq("Expressir::Model::Repository")
|
41
|
+
expect(result["schemas"]).to be_instance_of(Array)
|
42
|
+
expect(result["schemas"].count).to eq(1)
|
43
|
+
expect(result["schemas"][0]).to be_instance_of(Hash)
|
44
|
+
expect(result["schemas"][0]["_class"]).to eq("Expressir::Model::Schema")
|
45
|
+
expect(result["schemas"][0]["id"]).to eq("simple_schema")
|
46
|
+
expect(result["schemas"][0]["entities"]).to be_instance_of(Array)
|
47
|
+
expect(result["schemas"][0]["entities"].count).to eq(1)
|
48
|
+
expect(result["schemas"][0]["entities"][0]).to be_instance_of(Hash)
|
49
|
+
expect(result["schemas"][0]["entities"][0]["_class"]).to eq("Expressir::Model::Entity")
|
50
|
+
expect(result["schemas"][0]["entities"][0]["id"]).to eq("empty_entity")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def sample_file
|
55
|
+
@sample_file ||= Expressir.root_path.join(
|
56
|
+
"original", "examples", "syntax", "simple.exp"
|
57
|
+
)
|
58
|
+
end
|
59
|
+
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.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -230,6 +230,7 @@ files:
|
|
230
230
|
- lib/expressir/model/literals/logical.rb
|
231
231
|
- lib/expressir/model/literals/real.rb
|
232
232
|
- lib/expressir/model/literals/string.rb
|
233
|
+
- lib/expressir/model/model_element.rb
|
233
234
|
- lib/expressir/model/parameter.rb
|
234
235
|
- lib/expressir/model/procedure.rb
|
235
236
|
- lib/expressir/model/renamed_ref.rb
|
@@ -304,6 +305,7 @@ files:
|
|
304
305
|
- original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml
|
305
306
|
- original/examples/syntax/remark.exp
|
306
307
|
- original/examples/syntax/remark_formatted.exp
|
308
|
+
- original/examples/syntax/simple.exp
|
307
309
|
- original/examples/syntax/source.exp
|
308
310
|
- original/examples/syntax/syntax.exp
|
309
311
|
- original/examples/syntax/syntax_formatted.exp
|
@@ -326,7 +328,8 @@ files:
|
|
326
328
|
- spec/expressir/express_exp/parse_remark_spec.rb
|
327
329
|
- spec/expressir/express_exp/parse_syntax_spec.rb
|
328
330
|
- spec/expressir/express_exp/source_spec.rb
|
329
|
-
- spec/expressir/model/
|
331
|
+
- spec/expressir/model/model_element_spec.rb
|
332
|
+
- spec/expressir/model/scope_spec.rb
|
330
333
|
- spec/expressr_spec.rb
|
331
334
|
- spec/spec_helper.rb
|
332
335
|
- spec/support/console_helper.rb
|