expressir 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +1 -7
- data/expressir.gemspec +2 -2
- data/lib/expressir/express_exp/formatter.rb +2 -6
- data/lib/expressir/express_exp/parser.rb +14 -1
- data/lib/expressir/express_exp/visitor.rb +79 -43
- data/lib/expressir/model.rb +1 -0
- data/lib/expressir/model/entity.rb +3 -0
- data/lib/expressir/model/informal_proposition.rb +11 -0
- data/lib/expressir/model/rule.rb +3 -0
- data/lib/expressir/model/schema.rb +2 -0
- data/lib/expressir/model/scope.rb +43 -9
- data/lib/expressir/model/type.rb +8 -0
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/remark.exp +63 -20
- data/original/examples/syntax/remark_formatted.exp +62 -19
- data/original/examples/syntax/source.exp +16 -0
- data/original/examples/syntax/syntax.exp +4 -1
- data/original/examples/syntax/syntax_formatted.exp +9 -0
- data/spec/expressir/express_exp/head_source_spec.rb +41 -0
- data/spec/expressir/express_exp/parse_multiple_spec.rb +32 -0
- data/spec/expressir/express_exp/parse_remark_spec.rb +115 -50
- data/spec/expressir/express_exp/parse_syntax_spec.rb +40 -0
- data/spec/expressir/express_exp/source_spec.rb +1 -1
- data/spec/expressir/model/find_spec.rb +19 -6
- metadata +10 -7
- data/spec/expressir/express_exp/find_spec.rb +0 -28
@@ -10,13 +10,16 @@ RSpec.describe Expressir::Model do
|
|
10
10
|
expect(repo.find('remark_schema')).to be_instance_of(Expressir::Model::Schema)
|
11
11
|
expect(repo.find('remark_schema.remark_constant')).to be_instance_of(Expressir::Model::Constant)
|
12
12
|
expect(repo.find('remark_schema.remark_type')).to be_instance_of(Expressir::Model::Type)
|
13
|
+
expect(repo.find('remark_schema.remark_type.WR1')).to be_instance_of(Expressir::Model::Where)
|
14
|
+
expect(repo.find('remark_schema.remark_type.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
13
15
|
expect(repo.find('remark_schema.remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
|
14
16
|
expect(repo.find('remark_schema.remark_entity')).to be_instance_of(Expressir::Model::Entity)
|
15
17
|
expect(repo.find('remark_schema.remark_entity.remark_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
16
18
|
expect(repo.find('remark_schema.remark_entity.remark_derived_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
17
19
|
expect(repo.find('remark_schema.remark_entity.remark_inverse_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
18
20
|
expect(repo.find('remark_schema.remark_entity.remark_unique')).to be_instance_of(Expressir::Model::Unique)
|
19
|
-
expect(repo.find('remark_schema.remark_entity.
|
21
|
+
expect(repo.find('remark_schema.remark_entity.WR1')).to be_instance_of(Expressir::Model::Where)
|
22
|
+
expect(repo.find('remark_schema.remark_entity.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
20
23
|
expect(repo.find('remark_schema.remark_subtype_constraint')).to be_instance_of(Expressir::Model::SubtypeConstraint)
|
21
24
|
expect(repo.find('remark_schema.remark_function')).to be_instance_of(Expressir::Model::Function)
|
22
25
|
expect(repo.find('remark_schema.remark_function.remark_parameter')).to be_instance_of(Expressir::Model::Parameter)
|
@@ -35,7 +38,8 @@ RSpec.describe Expressir::Model do
|
|
35
38
|
expect(repo.find('remark_schema.remark_rule.remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
|
36
39
|
expect(repo.find('remark_schema.remark_rule.remark_constant')).to be_instance_of(Expressir::Model::Constant)
|
37
40
|
expect(repo.find('remark_schema.remark_rule.remark_variable')).to be_instance_of(Expressir::Model::Variable)
|
38
|
-
expect(repo.find('remark_schema.remark_rule.
|
41
|
+
expect(repo.find('remark_schema.remark_rule.WR1')).to be_instance_of(Expressir::Model::Where)
|
42
|
+
expect(repo.find('remark_schema.remark_rule.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
39
43
|
|
40
44
|
# schema scope
|
41
45
|
schema = repo.schemas.first
|
@@ -47,7 +51,8 @@ RSpec.describe Expressir::Model do
|
|
47
51
|
expect(schema.find('remark_entity.remark_derived_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
48
52
|
expect(schema.find('remark_entity.remark_inverse_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
49
53
|
expect(schema.find('remark_entity.remark_unique')).to be_instance_of(Expressir::Model::Unique)
|
50
|
-
expect(schema.find('remark_entity.
|
54
|
+
expect(schema.find('remark_entity.WR1')).to be_instance_of(Expressir::Model::Where)
|
55
|
+
expect(schema.find('remark_entity.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
51
56
|
expect(schema.find('remark_subtype_constraint')).to be_instance_of(Expressir::Model::SubtypeConstraint)
|
52
57
|
expect(schema.find('remark_function')).to be_instance_of(Expressir::Model::Function)
|
53
58
|
expect(schema.find('remark_function.remark_parameter')).to be_instance_of(Expressir::Model::Parameter)
|
@@ -66,7 +71,13 @@ RSpec.describe Expressir::Model do
|
|
66
71
|
expect(schema.find('remark_rule.remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
|
67
72
|
expect(schema.find('remark_rule.remark_constant')).to be_instance_of(Expressir::Model::Constant)
|
68
73
|
expect(schema.find('remark_rule.remark_variable')).to be_instance_of(Expressir::Model::Variable)
|
69
|
-
expect(schema.find('remark_rule.
|
74
|
+
expect(schema.find('remark_rule.WR1')).to be_instance_of(Expressir::Model::Where)
|
75
|
+
expect(schema.find('remark_rule.wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
76
|
+
|
77
|
+
# type scope
|
78
|
+
type = schema.types.first
|
79
|
+
expect(type.find('WR1')).to be_instance_of(Expressir::Model::Where)
|
80
|
+
expect(type.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
70
81
|
|
71
82
|
# entity scope
|
72
83
|
entity = schema.entities.first
|
@@ -74,7 +85,8 @@ RSpec.describe Expressir::Model do
|
|
74
85
|
expect(entity.find('remark_derived_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
75
86
|
expect(entity.find('remark_inverse_attribute')).to be_instance_of(Expressir::Model::Attribute)
|
76
87
|
expect(entity.find('remark_unique')).to be_instance_of(Expressir::Model::Unique)
|
77
|
-
expect(entity.find('
|
88
|
+
expect(entity.find('WR1')).to be_instance_of(Expressir::Model::Where)
|
89
|
+
expect(entity.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
78
90
|
|
79
91
|
# function scope
|
80
92
|
function = schema.functions.first
|
@@ -98,7 +110,8 @@ RSpec.describe Expressir::Model do
|
|
98
110
|
expect(rule.find('remark_enumeration_item')).to be_instance_of(Expressir::Model::EnumerationItem)
|
99
111
|
expect(rule.find('remark_constant')).to be_instance_of(Expressir::Model::Constant)
|
100
112
|
expect(rule.find('remark_variable')).to be_instance_of(Expressir::Model::Variable)
|
101
|
-
expect(rule.find('
|
113
|
+
expect(rule.find('WR1')).to be_instance_of(Expressir::Model::Where)
|
114
|
+
expect(rule.find('wr:WR1')).to be_instance_of(Expressir::Model::Where)
|
102
115
|
end
|
103
116
|
end
|
104
117
|
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: antlr4-native
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '13.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '13.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake-compiler
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -576,6 +576,7 @@ files:
|
|
576
576
|
- lib/expressir/model/expressions/unary_expression.rb
|
577
577
|
- lib/expressir/model/function.rb
|
578
578
|
- lib/expressir/model/identifier.rb
|
579
|
+
- lib/expressir/model/informal_proposition.rb
|
579
580
|
- lib/expressir/model/interface.rb
|
580
581
|
- lib/expressir/model/literals/binary.rb
|
581
582
|
- lib/expressir/model/literals/integer.rb
|
@@ -656,6 +657,7 @@ files:
|
|
656
657
|
- original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml
|
657
658
|
- original/examples/syntax/remark.exp
|
658
659
|
- original/examples/syntax/remark_formatted.exp
|
660
|
+
- original/examples/syntax/source.exp
|
659
661
|
- original/examples/syntax/syntax.exp
|
660
662
|
- original/examples/syntax/syntax_formatted.exp
|
661
663
|
- original/exp2ruby.rb
|
@@ -670,9 +672,10 @@ files:
|
|
670
672
|
- spec/acceptance/version_spec.rb
|
671
673
|
- spec/expressir/express/repository_spec.rb
|
672
674
|
- spec/expressir/express_exp/ap233_spec.rb
|
673
|
-
- spec/expressir/express_exp/find_spec.rb
|
674
675
|
- spec/expressir/express_exp/format_remark_spec.rb
|
675
676
|
- spec/expressir/express_exp/format_syntax_spec.rb
|
677
|
+
- spec/expressir/express_exp/head_source_spec.rb
|
678
|
+
- spec/expressir/express_exp/parse_multiple_spec.rb
|
676
679
|
- spec/expressir/express_exp/parse_remark_spec.rb
|
677
680
|
- spec/expressir/express_exp/parse_syntax_spec.rb
|
678
681
|
- spec/expressir/express_exp/source_spec.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "expressir/express_exp/parser"
|
3
|
-
|
4
|
-
RSpec.describe Expressir::Model::Scope do
|
5
|
-
describe ".find" do
|
6
|
-
it "finds an item" do
|
7
|
-
repo = Expressir::ExpressExp::Parser.from_exp(sample_file)
|
8
|
-
|
9
|
-
schema = repo.find("syntax_schema")
|
10
|
-
expect(schema).to be_instance_of(Expressir::Model::Schema)
|
11
|
-
|
12
|
-
entity = repo.find("syntax_schema.empty_entity")
|
13
|
-
expect(entity).to be_instance_of(Expressir::Model::Entity)
|
14
|
-
|
15
|
-
attribute = repo.find("syntax_schema.attribute_entity.test")
|
16
|
-
expect(attribute).to be_instance_of(Expressir::Model::Attribute)
|
17
|
-
|
18
|
-
where = repo.find("syntax_schema.where_label_entity.wr:WR1")
|
19
|
-
expect(where).to be_instance_of(Expressir::Model::Where)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def sample_file
|
24
|
-
@sample_file ||= Expressir.root_path.join(
|
25
|
-
"original", "examples", "syntax", "syntax.exp"
|
26
|
-
)
|
27
|
-
end
|
28
|
-
end
|