expressir 1.2.4-aarch64-linux → 1.2.5-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +0 -6
  3. data/.github/workflows/rake.yml +200 -9
  4. data/.gitignore +7 -2
  5. data/.gitmodules +3 -0
  6. data/.rubocop.yml +13 -4
  7. data/Rakefile +4 -1
  8. data/bin/console +0 -1
  9. data/bin/rspec +3 -3
  10. data/exe/expressir +4 -2
  11. data/exe/format +1 -1
  12. data/exe/format-test +25 -25
  13. data/exe/generate-parser +16 -13
  14. data/expressir.gemspec +11 -9
  15. data/lib/expressir/config.rb +1 -1
  16. data/lib/expressir/express/2.7/express_parser.so +0 -0
  17. data/lib/expressir/express/3.0/express_parser.so +0 -0
  18. data/lib/expressir/express/3.1/express_parser.so +0 -0
  19. data/lib/expressir/express/parser.rb +2 -2
  20. data/lib/expressir/express/visitor.rb +7 -5
  21. data/lib/expressir/model.rb +78 -78
  22. data/lib/expressir/version.rb +1 -1
  23. data/rakelib/antlr4-native.rake +63 -0
  24. data/rakelib/cross-ruby.rake +213 -162
  25. data/spec/acceptance/version_spec.rb +7 -2
  26. data/spec/expressir/express/cache_spec.rb +8 -5
  27. data/spec/expressir/express/formatter_spec.rb +16 -8
  28. data/spec/expressir/express/parser_spec.rb +17 -11
  29. data/spec/expressir/model/model_element_spec.rb +154 -146
  30. metadata +52 -61
  31. data/demo.rb +0 -18
  32. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.exp +0 -9589
  33. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.owl +0 -36619
  34. data/original/examples/ap233/ap233e1_arm_lf_stepmod-2010-11-12.xml +0 -13294
  35. data/original/examples/employment/eclipse/.project +0 -17
  36. data/original/examples/employment/eclipse/Export/Employment.png +0 -0
  37. data/original/examples/employment/eclipse/Express/employment_schema.exp +0 -33
  38. data/original/examples/employment/eclipse/Express/employment_schema.xmi +0 -77
  39. data/original/examples/employment/eclipse/Express/employment_schema.xml +0 -93
  40. data/original/examples/employment/eclipse/Models/Employment.uml +0 -4
  41. data/original/examples/employment/eclipse/Models/Employment.umldi +0 -240
  42. data/original/examples/employment/eclipse/readme.txt +0 -7
  43. data/original/examples/employment/employment_schema.exp +0 -33
  44. data/original/examples/employment/employment_schema.rb +0 -232
  45. data/original/examples/employment/employment_schema.xml +0 -93
  46. data/original/examples/employment/employment_schema___module.rb +0 -46
  47. data/original/examples/employment/employment_schema___p28attr.rb +0 -126
  48. data/original/examples/employment/employment_schema___p28inst.rb +0 -26
  49. data/original/examples/employment/example_employment_data.xml +0 -1
  50. data/original/examples/employment/example_employment_data_copy.xml +0 -1
  51. data/original/examples/employment/example_employment_reader.rb +0 -30
  52. data/original/examples/employment/example_employment_writer.rb +0 -51
  53. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.exp +0 -3710
  54. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.owl +0 -35880
  55. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xmi +0 -15357
  56. data/original/examples/plcs/ap239e1_arm_lf_dexlib_2010-01-06.xml +0 -9468
  57. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.exp +0 -8404
  58. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.owl +0 -43147
  59. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xmi +0 -18341
  60. data/original/examples/plcs/ap239e2_arm_lf_stepmod-2010-01-25.xml +0 -11632
  61. data/original/exp2ruby.rb +0 -525
  62. data/original/expsm.rb +0 -34
  63. data/original/mapping_owl.rb +0 -1018
  64. data/original/mapping_sysml.rb +0 -2281
  65. data/original/mapping_uml2.rb +0 -599
  66. data/original/mapping_uml2_eclipse.rb +0 -433
  67. data/original/reeper.rb +0 -134
  68. data/spec/expressr_spec.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67f6821fbf8af4e809af75e9f883c77a64a918be32c3b0722cbfedc071decb3f
4
- data.tar.gz: 1ebf48402a3ecb7070bc92287f7e32e086dc8a65087e931cde15c3830fc708fb
3
+ metadata.gz: 29754234e47e9db9651b0a156e670667b0e7bd670685919bc5ef2a71e672e2b8
4
+ data.tar.gz: 42d6b2bd9da41bfab0055fae8214c4c58a017b3a551f78c1e4f04657b3abde71
5
5
  SHA512:
6
- metadata.gz: 1760ca6ac60cb51506fa5bff34f4ae19ee865545d10dbba6cc3db2b4d56d5590e96915988fd80c4e8b70e31351d031952db342f3f7bfd3ef9f8e94eec47d73d1
7
- data.tar.gz: 8abbb5f198cebc895db689621d62aedc9294421f84335e342b52bbf8a42ac21b836f8a0a9ad92f6d93c0a11272561575d75bd29efcbccfd3a2e24744ba198b1f
6
+ metadata.gz: 17f9a5ba1d53bb9870ab53076474a15890f0d2c49f7f9ea10f6a5c211fc91d8bba5eef773f0d2c2647ac921324086ea6bd9df79387acd7d208cd39cdff59d3a2
7
+ data.tar.gz: 331705f2327f8b82c925ddb22dba975ad90a85bd27ec864bcf4d8d2e13bf5867eeaf182eeb511719e8e9775a384724e3808c58657066cd29c6d0dba4b31d5344
data/.cross_rubies CHANGED
@@ -1,20 +1,14 @@
1
- 3.1.0:i686-w64-mingw32
2
1
  3.1.0:x86_64-w64-mingw32
3
- 3.1.0:i686-linux-gnu
4
2
  3.1.0:x86_64-linux-gnu
5
3
  3.1.0:aarch64-linux-gnu
6
4
  3.1.0:x86_64-darwin
7
5
  3.1.0:arm64-darwin
8
- 3.0.0:i686-w64-mingw32
9
6
  3.0.0:x86_64-w64-mingw32
10
- 3.0.0:i686-linux-gnu
11
7
  3.0.0:x86_64-linux-gnu
12
8
  3.0.0:aarch64-linux-gnu
13
9
  3.0.0:x86_64-darwin
14
10
  3.0.0:arm64-darwin
15
- 2.7.0:i686-w64-mingw32
16
11
  2.7.0:x86_64-w64-mingw32
17
- 2.7.0:i686-linux-gnu
18
12
  2.7.0:x86_64-linux-gnu
19
13
  2.7.0:aarch64-linux-gnu
20
14
  2.7.0:x86_64-darwin
@@ -6,9 +6,29 @@ on:
6
6
  pull_request:
7
7
 
8
8
  jobs:
9
+ rubocop:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout
13
+ uses: actions/checkout@v3
14
+ with:
15
+ submodules: recursive
16
+
17
+ - name: Install Ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: 3.0
21
+ bundler-cache: true
22
+
23
+ - name: Bundle
24
+ run: bundle install --jobs 4 --retry 3
25
+
26
+ - name: Rubocop
27
+ run: bundle exec rake rubocop
28
+
9
29
  rake:
10
30
  name: test on ruby-${{ matrix.ruby }} ${{ matrix.os }}
11
- runs-on: ${{ matrix.os }}
31
+ runs-on: ${{ matrix.os }}
12
32
  continue-on-error: ${{ matrix.experimental }}
13
33
  strategy:
14
34
  fail-fast: false
@@ -29,7 +49,7 @@ jobs:
29
49
 
30
50
  steps:
31
51
  - name: Checkout
32
- uses: actions/checkout@v2
52
+ uses: actions/checkout@v3
33
53
  with:
34
54
  submodules: recursive
35
55
 
@@ -55,18 +75,18 @@ jobs:
55
75
  run: bundle exec rake compile
56
76
 
57
77
  - name: Run tests
58
- run: bundle exec rake
78
+ run: |
79
+ bundle exec rake
80
+ cat .rspec_status
59
81
 
60
82
  # test release workflow
61
- pack:
83
+ pack-ruby:
62
84
  runs-on: ubuntu-latest
63
85
  strategy:
64
86
  fail-fast: false
65
- matrix:
66
- host: [ linux, windows, darwin ]
67
87
  steps:
68
88
  - name: Checkout
69
- uses: actions/checkout@v2
89
+ uses: actions/checkout@v3
70
90
  with:
71
91
  submodules: recursive
72
92
 
@@ -81,16 +101,36 @@ jobs:
81
101
  run: bundle install --jobs 4 --retry 3
82
102
 
83
103
  - name: Build gem without native extension
84
- if: matrix.host == 'linux'
85
104
  run: gem build expressir.gemspec
86
105
 
87
106
  - name: Package gem without native extension
88
- if: matrix.host == 'linux'
89
107
  uses: actions/upload-artifact@v2
90
108
  with:
91
109
  name: pkg-ruby
92
110
  path: expressir-*.gem
93
111
 
112
+ pack:
113
+ runs-on: ubuntu-latest
114
+ strategy:
115
+ fail-fast: false
116
+ matrix:
117
+ host: [ linux, windows, darwin ]
118
+ steps:
119
+ - name: Checkout
120
+ uses: actions/checkout@v3
121
+ with:
122
+ submodules: recursive
123
+
124
+ - name: Setup Ruby
125
+ uses: ruby/setup-ruby@v1
126
+ with:
127
+ ruby-version: '3.0'
128
+ # bundler-cache: true important to not use cache because it leads to "cannot find -lrice"
129
+ # more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126
130
+
131
+ - name: Bundle
132
+ run: bundle install --jobs 4 --retry 3
133
+
94
134
  - name: Enable swap
95
135
  run: |
96
136
  sudo fallocate -l 15g /compile.swap
@@ -107,3 +147,154 @@ jobs:
107
147
  with:
108
148
  name: pkg-${{ matrix.host }}
109
149
  path: pkg/*.gem
150
+
151
+ verify-ruby:
152
+ name: verify ruby gem on ruby-${{ matrix.ruby }} ${{ matrix.os }}
153
+ needs: pack-ruby
154
+ runs-on: ${{ matrix.os }}
155
+ strategy:
156
+ fail-fast: false
157
+ matrix:
158
+ ruby: [ '3.1', '3.0', '2.7' ]
159
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
160
+ steps:
161
+ - name: Install Ruby
162
+ uses: ruby/setup-ruby@v1
163
+ with:
164
+ ruby-version: ${{ matrix.ruby }}
165
+ bundler-cache: true
166
+
167
+ - name: Checkout
168
+ uses: actions/checkout@v3
169
+ with:
170
+ submodules: recursive
171
+
172
+ - name: Bundle
173
+ run: bundle install --jobs 4 --retry 3
174
+
175
+ - name: Download packaged gem
176
+ uses: actions/download-artifact@v2
177
+ with:
178
+ name: pkg-ruby
179
+ path: pkg
180
+
181
+ - name: Install gem
182
+ run: gem install -l pkg/expressir-*.gem
183
+
184
+ - name: Verify
185
+ run: |
186
+ cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
187
+ ruby bin/rspec
188
+ cat .rspec_status || echo ".rspec_status was not found"
189
+
190
+ verify-darwin:
191
+ name: verify MacOS binary gem on ruby-${{ matrix.ruby }}
192
+ needs: pack
193
+ runs-on: macos-latest
194
+ strategy:
195
+ fail-fast: false
196
+ matrix:
197
+ ruby: [ '3.1', '3.0', '2.7' ]
198
+ steps:
199
+ - name: Install Ruby
200
+ uses: ruby/setup-ruby@v1
201
+ with:
202
+ ruby-version: ${{ matrix.ruby }}
203
+ bundler-cache: true
204
+
205
+ - name: Checkout
206
+ uses: actions/checkout@v3
207
+
208
+ - name: Bundle
209
+ run: bundle install --jobs 4 --retry 3
210
+
211
+ - name: Download packaged gem
212
+ uses: actions/download-artifact@v2
213
+ with:
214
+ name: pkg-darwin
215
+ path: pkg
216
+
217
+ - name: Install binary gem
218
+ run: gem install -l pkg/expressir-*-$(ruby -e "puts RUBY_PLATFORM.sub(/darwin\d{2}$/, 'darwin')").gem
219
+ # MacOS with have something like x86_64-darwin19, others just x86_64-linux
220
+
221
+ - name: Verify
222
+ run: |
223
+ cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
224
+ ruby bin/rspec
225
+ cat .rspec_status || echo ".rspec_status was not found"
226
+
227
+ verify-linux:
228
+ name: verify Linux binary gem on ruby-${{ matrix.ruby }}
229
+ needs: pack
230
+ runs-on: ubuntu-latest
231
+ strategy:
232
+ fail-fast: false
233
+ matrix:
234
+ ruby: [ '3.1', '3.0', '2.7' ]
235
+ steps:
236
+ - name: Install Ruby
237
+ uses: ruby/setup-ruby@v1
238
+ with:
239
+ ruby-version: ${{ matrix.ruby }}
240
+ bundler-cache: true
241
+
242
+ - name: Checkout
243
+ uses: actions/checkout@v3
244
+
245
+ - name: Bundle
246
+ run: bundle install --jobs 4 --retry 3
247
+
248
+ - name: Download packaged gem
249
+ uses: actions/download-artifact@v2
250
+ with:
251
+ name: pkg-linux
252
+ path: pkg
253
+
254
+ - name: Install binary gem
255
+ run: gem install -l pkg/expressir-*-$(ruby -e "puts RUBY_PLATFORM").gem
256
+
257
+ - name: Verify
258
+ run: |
259
+ cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
260
+ ruby bin/rspec
261
+ cat .rspec_status || echo ".rspec_status was not found"
262
+
263
+ verify-windows:
264
+ name: verify Windows binary gem on ruby-${{ matrix.ruby }}
265
+ needs: pack
266
+ continue-on-error: true
267
+ runs-on: windows-latest
268
+ strategy:
269
+ fail-fast: false
270
+ # Ruby 3.1 fails
271
+ # https://github.com/lutaml/expressir/issues/103
272
+ matrix:
273
+ ruby: [ '3.1', '3.0', '2.7' ]
274
+ steps:
275
+ - name: Install Ruby
276
+ uses: ruby/setup-ruby@v1
277
+ with:
278
+ ruby-version: ${{ matrix.ruby }}
279
+ bundler-cache: true
280
+
281
+ - name: Checkout
282
+ uses: actions/checkout@v3
283
+
284
+ - name: Bundle
285
+ run: bundle install --jobs 4 --retry 3
286
+
287
+ - name: Download packaged gem
288
+ uses: actions/download-artifact@v2
289
+ with:
290
+ name: pkg-windows
291
+ path: pkg
292
+
293
+ - name: Install binary gem
294
+ run: gem install -l pkg/expressir-*-$(ruby -e "puts RUBY_PLATFORM").gem
295
+
296
+ - name: Verify
297
+ run: |
298
+ cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
299
+ ruby bin/rspec
300
+ cat .rspec_status || echo ".rspec_status was not found"
data/.gitignore CHANGED
@@ -8,11 +8,16 @@
8
8
  /tmp/
9
9
  /Gemfile.lock
10
10
  /.idea
11
+ /.vscode
11
12
  /lib/expressir/express/express_parser.bundle
13
+ /lib/expressir/express/express_parser.so
14
+ /lib/expressir/express/*/express_parser.bundle
15
+ /lib/expressir/express/*/express_parser.so
12
16
  /spec/syntax/*-pretty.exp
17
+ /ext/express-parser/rice-embed
13
18
 
14
19
  # rspec failure tracking
15
20
  .rspec_status
16
21
 
17
- /ext/express-parser/rice-embed
18
- /lib/expressir/express/express_parser.so
22
+ # rubocop guide
23
+ .rubocop-https---*
data/.gitmodules CHANGED
@@ -1,3 +1,6 @@
1
1
  [submodule "ext/express-parser/antlr4-upstream"]
2
2
  path = ext/express-parser/antlr4-upstream
3
3
  url = https://github.com/antlr/antlr4
4
+ [submodule "ext/express-grammar"]
5
+ path = ext/express-grammar
6
+ url = https://github.com/lutaml/express-grammar
data/.rubocop.yml CHANGED
@@ -1,8 +1,17 @@
1
1
  inherit_from:
2
2
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
3
3
 
4
- # local repo-specific modifications
5
- # ...
6
-
7
4
  AllCops:
8
- TargetRubyVersion: 2.4
5
+ TargetRubyVersion: 2.6
6
+ SuggestExtensions: false
7
+ Exclude:
8
+ - 'vendor/**/*'
9
+ - 'expressir.gemspec'
10
+ - 'tmp/**/*'
11
+ - 'pkg/**/*'
12
+ - 'exe/format-test'
13
+ - 'lib/expressir/express/**/*'
14
+ - 'lib/expressir/model/**/*'
15
+
16
+ Layout/LineLength:
17
+ Max: 160
data/Rakefile CHANGED
@@ -1,14 +1,17 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
  require "rake/extensiontask"
4
+ require "rubocop/rake_task"
4
5
  require "yard"
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
7
8
 
8
- task :default => :spec
9
+ task default: :spec
9
10
 
10
11
  GEMSPEC = Gem::Specification.load("expressir.gemspec")
11
12
 
13
+ RuboCop::RakeTask.new
14
+
12
15
  Gem::PackageTask.new(GEMSPEC).define
13
16
 
14
17
  YARD::Rake::YardocTask.new
data/bin/console CHANGED
@@ -9,4 +9,3 @@ require "reeper"
9
9
  # (If you use this, don't forget to add pry to your Gemfile!)
10
10
  require "pry"
11
11
  Pry.start
12
-
data/bin/rspec CHANGED
@@ -10,12 +10,12 @@
10
10
 
11
11
  require "pathname"
12
12
  ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
13
+ Pathname.new(__FILE__).realpath)
14
14
 
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
15
+ bundle_binstub = File.expand_path("bundle", __dir__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
data/exe/expressir CHANGED
@@ -11,8 +11,10 @@ $:.unshift File.expand_path("../../lib", bin_file)
11
11
  # Fixes https://github.com/rubygems/rubygems/issues/1420
12
12
  require "rubygems/specification"
13
13
 
14
- class Gem::Specification
15
- def this; self; end
14
+ module Gem
15
+ class Specification
16
+ def this; self; end
17
+ end
16
18
  end
17
19
 
18
20
  # start up the CLI
data/exe/format CHANGED
@@ -15,4 +15,4 @@ formatter = Class.new(Expressir::Express::Formatter) do
15
15
  end
16
16
  result = repository.to_hash(formatter: formatter, skip_empty: true)
17
17
 
18
- puts YAML.dump(result)
18
+ puts YAML.dump(result)
data/exe/format-test CHANGED
@@ -24,30 +24,30 @@ exp_files = [
24
24
  # '../iso-10303-stepmod/data/resources/iso13584_expressions_schema/iso13584_expressions_schema.exp',
25
25
  # annotated-express test (12s)
26
26
  # see https://github.com/metanorma/annotated-express/blob/master/data/documents/resources/fundamentals_of_product_description_and_support/sections/04-schemas.adoc
27
- '../iso-10303-stepmod/data/resources/action_schema/action_schema_annotated.exp',
28
- '../iso-10303-stepmod/data/resources/application_context_schema/application_context_schema_annotated.exp',
29
- '../iso-10303-stepmod/data/resources/approval_schema/approval_schema_annotated.exp',
30
- '../iso-10303-stepmod/data/resources/basic_attribute_schema/basic_attribute_schema_annotated.exp',
31
- '../iso-10303-stepmod/data/resources/certification_schema/certification_schema_annotated.exp',
32
- '../iso-10303-stepmod/data/resources/contract_schema/contract_schema_annotated.exp',
33
- '../iso-10303-stepmod/data/resources/date_time_schema/date_time_schema_annotated.exp',
34
- '../iso-10303-stepmod/data/resources/document_schema/document_schema.exp',
35
- '../iso-10303-stepmod/data/resources/effectivity_schema/effectivity_schema_annotated.exp',
36
- '../iso-10303-stepmod/data/resources/experience_schema/experience_schema_annotated.exp',
37
- '../iso-10303-stepmod/data/resources/external_reference_schema/external_reference_schema_annotated.exp',
38
- '../iso-10303-stepmod/data/resources/group_schema/group_schema_annotated.exp',
39
- '../iso-10303-stepmod/data/resources/language_schema/language_schema_annotated.exp',
40
- '../iso-10303-stepmod/data/resources/location_schema/location_schema_annotated.exp',
41
- '../iso-10303-stepmod/data/resources/management_resources_schema/management_resources_schema_annotated.exp',
42
- '../iso-10303-stepmod/data/resources/measure_schema/measure_schema_annotated.exp',
43
- '../iso-10303-stepmod/data/resources/person_organization_schema/person_organization_schema_annotated.exp',
44
- '../iso-10303-stepmod/data/resources/process_property_schema/process_property_schema_annotated.exp',
45
- '../iso-10303-stepmod/data/resources/product_definition_schema/product_definition_schema_annotated.exp',
46
- '../iso-10303-stepmod/data/resources/product_property_definition_schema/product_property_definition_schema_annotated.exp',
47
- '../iso-10303-stepmod/data/resources/product_property_representation_schema/product_property_representation_schema_annotated.exp',
48
- '../iso-10303-stepmod/data/resources/qualifications_schema/qualifications_schema_annotated.exp',
49
- '../iso-10303-stepmod/data/resources/security_classification_schema/security_classification_schema_annotated.exp',
50
- '../iso-10303-stepmod/data/resources/support_resource_schema/support_resource_schema_annotated.exp',
27
+ "../iso-10303-stepmod/data/resources/action_schema/action_schema_annotated.exp",
28
+ "../iso-10303-stepmod/data/resources/application_context_schema/application_context_schema_annotated.exp",
29
+ "../iso-10303-stepmod/data/resources/approval_schema/approval_schema_annotated.exp",
30
+ "../iso-10303-stepmod/data/resources/basic_attribute_schema/basic_attribute_schema_annotated.exp",
31
+ "../iso-10303-stepmod/data/resources/certification_schema/certification_schema_annotated.exp",
32
+ "../iso-10303-stepmod/data/resources/contract_schema/contract_schema_annotated.exp",
33
+ "../iso-10303-stepmod/data/resources/date_time_schema/date_time_schema_annotated.exp",
34
+ "../iso-10303-stepmod/data/resources/document_schema/document_schema.exp",
35
+ "../iso-10303-stepmod/data/resources/effectivity_schema/effectivity_schema_annotated.exp",
36
+ "../iso-10303-stepmod/data/resources/experience_schema/experience_schema_annotated.exp",
37
+ "../iso-10303-stepmod/data/resources/external_reference_schema/external_reference_schema_annotated.exp",
38
+ "../iso-10303-stepmod/data/resources/group_schema/group_schema_annotated.exp",
39
+ "../iso-10303-stepmod/data/resources/language_schema/language_schema_annotated.exp",
40
+ "../iso-10303-stepmod/data/resources/location_schema/location_schema_annotated.exp",
41
+ "../iso-10303-stepmod/data/resources/management_resources_schema/management_resources_schema_annotated.exp",
42
+ "../iso-10303-stepmod/data/resources/measure_schema/measure_schema_annotated.exp",
43
+ "../iso-10303-stepmod/data/resources/person_organization_schema/person_organization_schema_annotated.exp",
44
+ "../iso-10303-stepmod/data/resources/process_property_schema/process_property_schema_annotated.exp",
45
+ "../iso-10303-stepmod/data/resources/product_definition_schema/product_definition_schema_annotated.exp",
46
+ "../iso-10303-stepmod/data/resources/product_property_definition_schema/product_property_definition_schema_annotated.exp",
47
+ "../iso-10303-stepmod/data/resources/product_property_representation_schema/product_property_representation_schema_annotated.exp",
48
+ "../iso-10303-stepmod/data/resources/qualifications_schema/qualifications_schema_annotated.exp",
49
+ "../iso-10303-stepmod/data/resources/security_classification_schema/security_classification_schema_annotated.exp",
50
+ "../iso-10303-stepmod/data/resources/support_resource_schema/support_resource_schema_annotated.exp",
51
51
  # full test (6m18s + 8s = 6m26s)
52
52
  # *`bundle exec ../stepmod-utils/exe/stepmod-find-express-files ../iso-10303-stepmod`.strip.split("\n").map{|file| File.exists?(file.sub(/\.exp$/, '_annotated.exp')) ? file.sub(/\.exp$/, '_annotated.exp') : file}
53
53
  ]
@@ -78,4 +78,4 @@ end
78
78
  result = repository.to_hash(formatter: formatter, skip_empty: true)
79
79
  puts "Repository.to_hash time: #{(Time.now - start).round(2)}s"
80
80
 
81
- # puts YAML.dump(result)
81
+ # puts YAML.dump(result)
data/exe/generate-parser CHANGED
@@ -1,29 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'fileutils'
4
- require 'antlr4-native'
3
+ require "fileutils"
4
+ require "antlr4-native"
5
5
 
6
6
  grammar_file = ARGV.shift
7
7
 
8
8
  # ANTLR does weird things if the grammar file isn't in the current working directory
9
- temp_grammar_file = File.join(FileUtils.pwd(), File.basename(grammar_file))
9
+ temp_grammar_file = File.join(FileUtils.pwd, File.basename(grammar_file))
10
10
  FileUtils.cp(grammar_file, temp_grammar_file)
11
11
 
12
12
  # generate parser
13
13
  generator = Antlr4Native::Generator.new(
14
14
  grammar_files: [File.basename(temp_grammar_file)],
15
- output_dir: 'ext',
16
- parser_root_method: 'syntax'
15
+ output_dir: "ext",
16
+ parser_root_method: "syntax",
17
17
  )
18
18
  generator.generate
19
19
 
20
20
  # fix issues with generated parser
21
- parser_source_file = File.join(*%w(ext express-parser express_parser.cpp))
22
- parser_source_lines = File.read(parser_source_file).split(/\n/)
21
+ parser_source_file = File.join("ext", "express-parser", "express_parser.cpp")
22
+ parser_source_lines = File.read(parser_source_file).split("\n")
23
23
 
24
24
  # - add ParserProxy tokens method, simple compensation for missing exposed BufferedTokenStream
25
- i = parser_source_lines.index{|x| x == ' Object syntax() {'}
26
- parser_source_lines[i + 6] += "\n" + <<~CPP.split(/\n/).map{|x| x != "" ? " " + x : x}.join("\n") + "\n"
25
+ i = parser_source_lines.index { |x| x == " Object syntax() {" }
26
+ parser_source_lines[i + 6] += <<~CPP.split("\n").map { |x| x == "" ? x : " #{x}" }.join("\n")
27
+
27
28
  Array getTokens() {
28
29
  Array a;
29
30
 
@@ -35,14 +36,16 @@ parser_source_lines[i + 6] += "\n" + <<~CPP.split(/\n/).map{|x| x != "" ? " " +
35
36
 
36
37
  return a;
37
38
  }
39
+
38
40
  CPP
39
- i = parser_source_lines.index{|x| x == ' .define_method("syntax", &ParserProxy::syntax)'}
40
- parser_source_lines[i] += "\n" + <<~CPP.split(/\n/).map{|x| x != "" ? " " + x : x}.join("\n")
41
+ i = parser_source_lines.index { |x| x == ' .define_method("syntax", &ParserProxy::syntax, Return().keepAlive())' }
42
+ parser_source_lines[i] += <<~CPP.split("\n").map { |x| x == "" ? x : " #{x}" }.join("\n")
43
+
41
44
  .define_method("tokens", &ParserProxy::getTokens)
42
45
  CPP
43
46
 
44
47
  # write fixed parser file
45
- File.write(parser_source_file, parser_source_lines.join("\n") + "\n")
48
+ File.write(parser_source_file, "#{parser_source_lines.join("\n")}\n")
46
49
 
47
50
  # cleanup
48
- FileUtils.rm(temp_grammar_file)
51
+ FileUtils.rm(temp_grammar_file)
data/expressir.gemspec CHANGED
@@ -17,10 +17,10 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata["source_code_uri"] = spec.homepage
18
18
  spec.metadata["changelog_uri"] = "https://github.com/lutaml/expressir/releases"
19
19
 
20
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
20
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
21
21
 
22
22
  spec.files = `git ls-files`.split("\n")\
23
- + Dir.glob('ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/**/*')
23
+ + Dir.glob("ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/**/*")
24
24
 
25
25
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
26
26
 
@@ -30,17 +30,19 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.extensions = File.join(*%w(ext express-parser extconf.rb))
32
32
 
33
- spec.add_runtime_dependency "thor", "~> 1.0"
34
33
  spec.add_runtime_dependency "rice", "~> 4.0.3"
34
+ spec.add_runtime_dependency "thor", "~> 1.0"
35
+ spec.add_development_dependency "antlr4-native", "~> 2.1.0"
35
36
  spec.add_development_dependency "asciidoctor", "~> 2.0.13"
36
- spec.add_development_dependency "antlr4-native", "~> 1.1.0"
37
37
  spec.add_development_dependency "bundler", "~> 2.0"
38
- spec.add_development_dependency "pry", "~> 0.12.2"
39
38
  spec.add_development_dependency "byebug", "~> 11.1"
39
+ spec.add_development_dependency "pry", "~> 0.12.2"
40
40
  spec.add_development_dependency "rake", "~> 13.0"
41
- spec.add_development_dependency "rake-compiler", "~> 1.1"
42
- spec.add_development_dependency "rake-compiler-dock", "~> 1.1"
43
- spec.add_development_dependency "rspec", "~> 3.0"
44
- spec.add_development_dependency "yard", "~> 0.9.26"
41
+ spec.add_development_dependency "rake-compiler", "~> 1.2"
42
+ spec.add_development_dependency "rake-compiler-dock", "~> 1.2.1"
43
+ spec.add_development_dependency "rspec", "~> 3.11"
44
+ spec.add_development_dependency "rubocop", "1.5.2"
45
+ spec.add_development_dependency "rubocop-performance", "~> 1.0"
45
46
  spec.add_development_dependency "webrick", "~> 1.7.0"
47
+ spec.add_development_dependency "yard", "~> 0.9.26"
46
48
  end
@@ -15,7 +15,7 @@ module Expressir
15
15
  attr_accessor :logs
16
16
 
17
17
  def initialize
18
- @logs ||= %i(error)
18
+ @logs = %i(error)
19
19
  end
20
20
  end
21
21
 
@@ -31,13 +31,13 @@ module Expressir
31
31
  # @param [Boolean] include_source attach original source code to model elements
32
32
  # @return [Model::Repository]
33
33
  def self.from_file(file, skip_references: nil, include_source: nil)
34
- input = File.read(file)
34
+ @input = File.read(file)
35
35
 
36
36
  # An important note re memory management
37
37
  # parse, syntax, visitor methods return complex tree structures created in netive (C++) extension
38
38
  # visit method references nodes and leaves of this structures but it is totally untransparent for Ruby GarbageCllector
39
39
  # so in this class we keep those C++ structure marked for GC so theu are not freed
40
- @parser = ::ExpressParser::Parser.parse(input)
40
+ @parser = ::ExpressParser::Parser.parse(@input)
41
41
  @parse_tree = @parser.syntax()
42
42
 
43
43
  @visitor = Visitor.new(@parser.tokens, include_source: include_source)
@@ -31,6 +31,8 @@ require "set"
31
31
  # - prevents segfault in ANTLR4 C++ runtime, not sure why they are caused
32
32
  # - e.g. see visit_schema_decl
33
33
 
34
+ require 'objspace'
35
+
34
36
  module Expressir
35
37
  module Express
36
38
  class Visitor < ::ExpressParser::Visitor
@@ -138,15 +140,15 @@ module Expressir
138
140
  end
139
141
 
140
142
  def attach_remarks(ctx, node)
141
- remark_tokens = get_tokens(ctx)
142
- remark_tokens = remark_tokens.select{ |x| x.channel == REMARK_CHANNEL
143
- }
143
+ @remark_tokens = get_tokens(ctx)
144
+ @remark_tokens = @remark_tokens.select{ |x| x.channel == REMARK_CHANNEL
145
+ }
144
146
 
145
147
  # skip already attached remarks
146
- remark_tokens = remark_tokens.select{|x| !@attached_remark_tokens.include?(x)}
148
+ @remark_tokens = @remark_tokens.select{|x| !@attached_remark_tokens.include?(x)}
147
149
 
148
150
  # parse remarks, find remark targets
149
- tagged_remark_tokens = remark_tokens.map do |remark_token|
151
+ tagged_remark_tokens = @remark_tokens.map do |remark_token|
150
152
  _, remark_tag, remark_text = if remark_token.text.start_with?('--')
151
153
  remark_token.text.match(/^--"([^"]*)"(.*)$/).to_a
152
154
  else