expressir 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -13
- data/.rubocop_todo.yml +69 -6
- data/Gemfile +1 -1
- data/README.adoc +46 -0
- data/exe/expressir-format-test +2 -1
- data/expressir.gemspec +2 -3
- data/lib/expressir/express/cache.rb +6 -6
- data/lib/expressir/express/formatter.rb +754 -741
- data/lib/expressir/express/hyperlink_formatter.rb +2 -2
- data/lib/expressir/express/model_visitor.rb +1 -1
- data/lib/expressir/express/parser.rb +224 -100
- data/lib/expressir/express/resolve_references_model_visitor.rb +6 -6
- data/lib/expressir/express/schema_head_formatter.rb +3 -3
- data/lib/expressir/express/visitor.rb +353 -344
- data/lib/expressir/model/cache.rb +3 -3
- data/lib/expressir/model/data_type.rb +1 -1
- data/lib/expressir/model/data_types/aggregate.rb +3 -3
- data/lib/expressir/model/data_types/array.rb +6 -6
- data/lib/expressir/model/data_types/bag.rb +4 -4
- data/lib/expressir/model/data_types/binary.rb +3 -3
- data/lib/expressir/model/data_types/boolean.rb +1 -1
- data/lib/expressir/model/data_types/enumeration.rb +4 -4
- data/lib/expressir/model/data_types/enumeration_item.rb +2 -2
- data/lib/expressir/model/data_types/generic.rb +2 -2
- data/lib/expressir/model/data_types/generic_entity.rb +2 -2
- data/lib/expressir/model/data_types/integer.rb +1 -1
- data/lib/expressir/model/data_types/list.rb +5 -5
- data/lib/expressir/model/data_types/logical.rb +1 -1
- data/lib/expressir/model/data_types/number.rb +1 -1
- data/lib/expressir/model/data_types/real.rb +2 -2
- data/lib/expressir/model/data_types/select.rb +5 -5
- data/lib/expressir/model/data_types/set.rb +4 -4
- data/lib/expressir/model/data_types/string.rb +3 -3
- data/lib/expressir/model/declaration.rb +1 -1
- data/lib/expressir/model/declarations/attribute.rb +7 -7
- data/lib/expressir/model/declarations/constant.rb +4 -4
- data/lib/expressir/model/declarations/entity.rb +9 -9
- data/lib/expressir/model/declarations/function.rb +13 -13
- data/lib/expressir/model/declarations/interface.rb +4 -4
- data/lib/expressir/model/declarations/interface_item.rb +3 -3
- data/lib/expressir/model/declarations/interfaced_item.rb +6 -6
- data/lib/expressir/model/declarations/parameter.rb +4 -4
- data/lib/expressir/model/declarations/procedure.rb +12 -12
- data/lib/expressir/model/declarations/remark_item.rb +3 -3
- data/lib/expressir/model/declarations/rule.rb +14 -14
- data/lib/expressir/model/declarations/schema.rb +18 -18
- data/lib/expressir/model/declarations/schema_version.rb +3 -3
- data/lib/expressir/model/declarations/schema_version_item.rb +3 -3
- data/lib/expressir/model/declarations/subtype_constraint.rb +6 -6
- data/lib/expressir/model/declarations/type.rb +5 -5
- data/lib/expressir/model/declarations/unique_rule.rb +3 -3
- data/lib/expressir/model/declarations/variable.rb +4 -4
- data/lib/expressir/model/declarations/where_rule.rb +3 -3
- data/lib/expressir/model/expression.rb +1 -1
- data/lib/expressir/model/expressions/aggregate_initializer.rb +2 -2
- data/lib/expressir/model/expressions/aggregate_initializer_item.rb +3 -3
- data/lib/expressir/model/expressions/binary_expression.rb +12 -5
- data/lib/expressir/model/expressions/entity_constructor.rb +3 -3
- data/lib/expressir/model/expressions/function_call.rb +3 -3
- data/lib/expressir/model/expressions/interval.rb +6 -6
- data/lib/expressir/model/expressions/query_expression.rb +4 -4
- data/lib/expressir/model/expressions/unary_expression.rb +3 -3
- data/lib/expressir/model/identifier.rb +5 -5
- data/lib/expressir/model/literal.rb +1 -1
- data/lib/expressir/model/literals/binary.rb +2 -2
- data/lib/expressir/model/literals/integer.rb +2 -2
- data/lib/expressir/model/literals/logical.rb +2 -2
- data/lib/expressir/model/literals/real.rb +2 -2
- data/lib/expressir/model/literals/string.rb +3 -3
- data/lib/expressir/model/model_element.rb +35 -41
- data/lib/expressir/model/reference.rb +1 -1
- data/lib/expressir/model/references/attribute_reference.rb +3 -3
- data/lib/expressir/model/references/group_reference.rb +3 -3
- data/lib/expressir/model/references/index_reference.rb +4 -4
- data/lib/expressir/model/references/simple_reference.rb +3 -3
- data/lib/expressir/model/repository.rb +3 -4
- data/lib/expressir/model/statement.rb +1 -1
- data/lib/expressir/model/statements/alias.rb +4 -4
- data/lib/expressir/model/statements/assignment.rb +3 -3
- data/lib/expressir/model/statements/case.rb +4 -4
- data/lib/expressir/model/statements/case_action.rb +3 -3
- 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 +4 -4
- data/lib/expressir/model/statements/null.rb +1 -1
- data/lib/expressir/model/statements/procedure_call.rb +3 -3
- data/lib/expressir/model/statements/repeat.rb +8 -8
- data/lib/expressir/model/statements/return.rb +2 -2
- data/lib/expressir/model/statements/skip.rb +1 -1
- data/lib/expressir/model/supertype_expression.rb +1 -1
- data/lib/expressir/model/supertype_expressions/binary_supertype_expression.rb +4 -4
- data/lib/expressir/model/supertype_expressions/oneof_supertype_expression.rb +2 -2
- data/lib/expressir/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ae2589e65c9c989edbabf98e4052772fd7abae7c221d00a091983e7f5525ef3
|
4
|
+
data.tar.gz: d5b2682aacd2aa4bed76747876c2c8b2d4d1aed0e3f4bcc59b518404e9deae30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b28fcd1ecee58b9eb7b750731fa28d86866d77c18afdc8b5d3e4857d9816b5c3f92ec6bd38175519526c0add26973d31dbb664a332459f8fcaf5be4938beeffd
|
7
|
+
data.tar.gz: 66633c6a8ab3bfa54d6934b53de31b9c9b040e200ad5537ec806160ccc26ad7c7e9ad9a60c84a27836b944ff96a724bd807a21f139394080e193bf71422402d9
|
data/.rubocop.yml
CHANGED
@@ -1,19 +1,14 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-performance
|
3
|
+
|
1
4
|
inherit_from:
|
2
|
-
- .rubocop_todo.yml
|
3
5
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
6
|
+
- .rubocop_todo.yml
|
4
7
|
|
5
|
-
|
6
|
-
TargetRubyVersion: 2.7
|
7
|
-
NewCops: enable
|
8
|
-
SuggestExtensions: false
|
8
|
+
Naming/VariableName:
|
9
9
|
Exclude:
|
10
|
-
|
11
|
-
- 'expressir.gemspec'
|
12
|
-
- 'tmp/**/*'
|
13
|
-
- 'pkg/**/*'
|
14
|
-
- 'exe/format-test'
|
15
|
-
- 'lib/expressir/express/**/*'
|
16
|
-
- 'lib/expressir/model/**/*'
|
17
|
-
|
10
|
+
- lib/expressir/express/visitor.rb
|
18
11
|
Layout/LineLength:
|
19
12
|
Max: 160
|
13
|
+
AllCops:
|
14
|
+
TargetRubyVersion: 2.7
|
data/.rubocop_todo.yml
CHANGED
@@ -1,21 +1,84 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2024-11-
|
3
|
+
# on 2024-11-26 21:06:12 UTC using RuboCop version 1.68.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
9
|
# Offense count: 1
|
10
|
+
# Configuration parameters: AllowedParentClasses.
|
11
|
+
Lint/MissingSuper:
|
12
|
+
Exclude:
|
13
|
+
- 'lib/expressir/model/cache.rb'
|
14
|
+
|
15
|
+
# Offense count: 3
|
16
|
+
Lint/ShadowingOuterLocalVariable:
|
17
|
+
Exclude:
|
18
|
+
- 'lib/expressir/express/visitor.rb'
|
19
|
+
|
20
|
+
# Offense count: 2
|
10
21
|
# This cop supports safe autocorrection (--autocorrect).
|
11
|
-
# Configuration parameters:
|
12
|
-
|
13
|
-
Layout/LineLength:
|
22
|
+
# Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
23
|
+
Lint/UnusedMethodArgument:
|
14
24
|
Exclude:
|
15
|
-
- '
|
25
|
+
- 'lib/expressir/express/parser.rb'
|
26
|
+
|
27
|
+
# Offense count: 54
|
28
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
29
|
+
Metrics/AbcSize:
|
30
|
+
Exclude:
|
31
|
+
- 'lib/expressir/express/formatter.rb'
|
32
|
+
- 'lib/expressir/express/hyperlink_formatter.rb'
|
33
|
+
- 'lib/expressir/express/resolve_references_model_visitor.rb'
|
34
|
+
- 'lib/expressir/express/visitor.rb'
|
35
|
+
- 'lib/expressir/model/declarations/function.rb'
|
36
|
+
- 'lib/expressir/model/declarations/procedure.rb'
|
37
|
+
- 'lib/expressir/model/declarations/rule.rb'
|
38
|
+
- 'lib/expressir/model/declarations/schema.rb'
|
39
|
+
- 'lib/expressir/model/model_element.rb'
|
16
40
|
|
17
41
|
# Offense count: 1
|
18
42
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
19
43
|
# AllowedMethods: refine
|
20
44
|
Metrics/BlockLength:
|
21
|
-
Max:
|
45
|
+
Max: 29
|
46
|
+
|
47
|
+
# Offense count: 40
|
48
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
49
|
+
Metrics/CyclomaticComplexity:
|
50
|
+
Exclude:
|
51
|
+
- 'lib/expressir/express/formatter.rb'
|
52
|
+
- 'lib/expressir/express/visitor.rb'
|
53
|
+
- 'lib/expressir/model/declarations/function.rb'
|
54
|
+
- 'lib/expressir/model/declarations/procedure.rb'
|
55
|
+
- 'lib/expressir/model/declarations/rule.rb'
|
56
|
+
- 'lib/expressir/model/declarations/schema.rb'
|
57
|
+
- 'lib/expressir/model/model_element.rb'
|
58
|
+
|
59
|
+
# Offense count: 74
|
60
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
61
|
+
Metrics/MethodLength:
|
62
|
+
Max: 135
|
63
|
+
|
64
|
+
# Offense count: 36
|
65
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
66
|
+
Metrics/PerceivedComplexity:
|
67
|
+
Exclude:
|
68
|
+
- 'lib/expressir/express/formatter.rb'
|
69
|
+
- 'lib/expressir/express/visitor.rb'
|
70
|
+
- 'lib/expressir/model/declarations/function.rb'
|
71
|
+
- 'lib/expressir/model/declarations/procedure.rb'
|
72
|
+
- 'lib/expressir/model/declarations/rule.rb'
|
73
|
+
- 'lib/expressir/model/declarations/schema.rb'
|
74
|
+
- 'lib/expressir/model/model_element.rb'
|
75
|
+
|
76
|
+
# Offense count: 5
|
77
|
+
Performance/FixedSize:
|
78
|
+
Exclude:
|
79
|
+
- 'lib/expressir/express/formatter.rb'
|
80
|
+
|
81
|
+
# Offense count: 1
|
82
|
+
Style/MissingRespondToMissing:
|
83
|
+
Exclude:
|
84
|
+
- 'lib/expressir/express/visitor.rb'
|
data/Gemfile
CHANGED
@@ -9,7 +9,7 @@ gem "pry"
|
|
9
9
|
gem "rake", "~> 13.0"
|
10
10
|
gem "rspec", "~> 3.0"
|
11
11
|
gem "rubocop", "~> 1.21"
|
12
|
-
gem "rubocop-performance"
|
12
|
+
gem "rubocop-performance"
|
13
13
|
gem "rubocop-rake", require: false
|
14
14
|
gem "rubocop-rspec", require: false
|
15
15
|
gem "webrick", "~> 1.7"
|
data/README.adoc
CHANGED
@@ -142,6 +142,52 @@ schemas = repo_hash['schemas']
|
|
142
142
|
schemas.map {|s| s["id"] }
|
143
143
|
----
|
144
144
|
|
145
|
+
=== Convert models to liquid
|
146
|
+
|
147
|
+
Use `to_liquid` method to convert the models of `Expressir::Model::*` to liquid
|
148
|
+
drop models (`Expressir::Liquid::*`).
|
149
|
+
|
150
|
+
Example:
|
151
|
+
|
152
|
+
[source,ruby]
|
153
|
+
----
|
154
|
+
repo = Expressir::Express::Parser.from_file("path/to/file.exp")
|
155
|
+
repo_drop = repo.to_liquid
|
156
|
+
----
|
157
|
+
|
158
|
+
where `repo` is an instance of `Expressir::Model::Repository` and
|
159
|
+
`repo_drop` is an instance of `Expressir::Liquid::RepositoryDrop`.
|
160
|
+
|
161
|
+
The liquid drop models of `Expressir::Liquid::*` have the same attributes
|
162
|
+
(`model_attr`) as the models of `Expressir::Model::*`.
|
163
|
+
|
164
|
+
For example, `Expressir::Model::Repository` has the following attributes:
|
165
|
+
|
166
|
+
- schemas
|
167
|
+
|
168
|
+
and each `Expressir::Model::Declarations::Schema` has the following attributes:
|
169
|
+
|
170
|
+
- file
|
171
|
+
- version
|
172
|
+
- interfaces
|
173
|
+
- constants
|
174
|
+
- entities
|
175
|
+
- subtype_constraints
|
176
|
+
- functions
|
177
|
+
- rules
|
178
|
+
- procedures
|
179
|
+
|
180
|
+
Thus, `Expressir::Liquid::Repository` has the same attribute `schemas`
|
181
|
+
and `Expressir::Liquid::Declarations::SchemaDrop` has same attribute `file`.
|
182
|
+
|
183
|
+
[source,ruby]
|
184
|
+
----
|
185
|
+
repo = Expressir::Express::Parser.from_file("path/to/file.exp")
|
186
|
+
repo_drop = repo.to_liquid
|
187
|
+
schema = repo_drop.schemas.first
|
188
|
+
schema.file = "path/to/file.exp"
|
189
|
+
----
|
190
|
+
|
145
191
|
== Contributing
|
146
192
|
|
147
193
|
First, thank you for contributing! We love pull requests from everyone. By
|
data/exe/expressir-format-test
CHANGED
@@ -49,7 +49,8 @@ exp_files = [
|
|
49
49
|
"../iso-10303-stepmod/data/resources/security_classification_schema/security_classification_schema_annotated.exp",
|
50
50
|
"../iso-10303-stepmod/data/resources/support_resource_schema/support_resource_schema_annotated.exp",
|
51
51
|
# full test (6m18s + 8s = 6m26s)
|
52
|
-
# *`bundle exec ../stepmod-utils/exe/stepmod-find-express-files ../iso-10303-stepmod`.strip
|
52
|
+
# *`bundle exec ../stepmod-utils/exe/stepmod-find-express-files ../iso-10303-stepmod`.strip
|
53
|
+
# .split("\n").map{|file| File.exists?(file.sub(/\.exp$/, '_annotated.exp')) ? file.sub(/\.exp$/, '_annotated.exp') : file}
|
53
54
|
]
|
54
55
|
|
55
56
|
start = Time.now
|
data/expressir.gemspec
CHANGED
@@ -16,7 +16,6 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.bindir = "exe"
|
18
18
|
spec.require_paths = ["lib"]
|
19
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
|
20
19
|
|
21
20
|
spec.metadata["homepage_uri"] = spec.homepage
|
22
21
|
spec.metadata["source_code_uri"] = spec.homepage
|
@@ -33,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
33
32
|
|
34
33
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
35
34
|
|
36
|
-
spec.add_dependency "thor", "~> 1.0"
|
37
|
-
spec.add_dependency "parslet", "~> 2.0"
|
38
35
|
spec.add_dependency "liquid"
|
36
|
+
spec.add_dependency "parslet", "~> 2.0"
|
37
|
+
spec.add_dependency "thor", "~> 1.0"
|
39
38
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "yaml"
|
2
|
+
require "zlib"
|
3
|
+
require "expressir/model"
|
4
4
|
|
5
5
|
module Expressir
|
6
6
|
module Express
|
@@ -16,7 +16,7 @@ module Expressir
|
|
16
16
|
|
17
17
|
cache = Model::Cache.new(
|
18
18
|
version: version,
|
19
|
-
content: content
|
19
|
+
content: content,
|
20
20
|
)
|
21
21
|
|
22
22
|
hash = cache.to_hash(root_path: root_path)
|
@@ -37,7 +37,7 @@ module Expressir
|
|
37
37
|
|
38
38
|
yaml_compressed = File.binread(file)
|
39
39
|
yaml = Zlib::Inflate.inflate(yaml_compressed)
|
40
|
-
hash = YAML.
|
40
|
+
hash = YAML.safe_load(yaml)
|
41
41
|
cache = Model::ModelElement.from_hash(hash, root_path: root_path)
|
42
42
|
|
43
43
|
if cache.version != version
|
@@ -48,4 +48,4 @@ module Expressir
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
51
|
-
end
|
51
|
+
end
|