expressir 1.3.0-x64-mingw-ucrt → 1.3.2-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21e1bdcfbeda7d260bd8da8c123ca3f053fd7b0c8894b7c81ae7b7a6d260cbe3
4
- data.tar.gz: ec0ae3fcc0d19982d4a6c7bf670dc8c31337333e12757d599bc17f95f1b8ac5b
3
+ metadata.gz: 3aed88572ade42a5255aa602ac69f8ce3d7d17f761c3f339682560e42b217cff
4
+ data.tar.gz: 3c941a67749f3afd43d4ae018aa8165058bb1bbaf926fdd873b78880d20686c3
5
5
  SHA512:
6
- metadata.gz: e03924c0df40f84726d19fe4e845b11e8fa7caf78b561ae3036df98de7a9da2e20793f1429c56bbf458a4d9b24607bde3236ee96087c4195b374d274b7dafef4
7
- data.tar.gz: 305af29497644954853e6ca48d0987b7acf5f4173418100fbe61b73c7162e7194f85cb514bf132d49eee3c33e6c1ca445f951d7548815164120b7e6cf8709c05
6
+ metadata.gz: d8e0cd8f12ebab86cad1abf347c6f403a4b49f689eb7970162aefa3e0d615dd77c1f43bce039959a5ccd3766751903d6d683b1889a6e59d7d3a7982f5385fca3
7
+ data.tar.gz: 64c444e53ddf77fe6c8ece5075f623c38d45c5c0f50f61f2d46143e4031ec0618fb0e7f5a95a764e87f9b5de86d5509c3478c029a61c2a7170ea704a469baba7
data/.cross_rubies CHANGED
@@ -1,20 +1,28 @@
1
1
  3.2.0:x86_64-w64-mingw32
2
2
  3.2.0:x86_64-linux-gnu
3
+ 3.2.0:x86_64-linux-musl
3
4
  3.2.0:aarch64-linux-gnu
5
+ 3.2.0:aarch64-linux-musl
4
6
  3.2.0:x86_64-darwin
5
7
  3.2.0:arm64-darwin
6
8
  3.1.0:x86_64-w64-mingw32
7
9
  3.1.0:x86_64-linux-gnu
10
+ 3.1.0:x86_64-linux-musl
8
11
  3.1.0:aarch64-linux-gnu
12
+ 3.1.0:aarch64-linux-musl
9
13
  3.1.0:x86_64-darwin
10
14
  3.1.0:arm64-darwin
11
15
  3.0.0:x86_64-w64-mingw32
12
16
  3.0.0:x86_64-linux-gnu
17
+ 3.0.0:x86_64-linux-musl
13
18
  3.0.0:aarch64-linux-gnu
19
+ 3.0.0:aarch64-linux-musl
14
20
  3.0.0:x86_64-darwin
15
21
  3.0.0:arm64-darwin
16
22
  2.7.0:x86_64-w64-mingw32
17
23
  2.7.0:x86_64-linux-gnu
24
+ 2.7.0:x86_64-linux-musl
18
25
  2.7.0:aarch64-linux-gnu
26
+ 2.7.0:aarch64-linux-musl
19
27
  2.7.0:x86_64-darwin
20
28
  2.7.0:arm64-darwin
@@ -0,0 +1,47 @@
1
+ name: "CodeQL"
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ schedule:
7
+ - cron: '0 23 * * 3'
8
+ workflow_dispatch:
9
+
10
+ concurrency:
11
+ group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
12
+ cancel-in-progress: true
13
+
14
+ env:
15
+ BUNDLER_VER: 2.4.22
16
+
17
+ jobs:
18
+ analyze:
19
+ name: Analyze
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+ with:
26
+ submodules: recursive
27
+
28
+ - name: Install Ruby
29
+ uses: ruby/setup-ruby@master
30
+ with:
31
+ ruby-version: 3.1
32
+ bundler: ${{ env.BUNDLER_VER }}
33
+ bundler-cache: false
34
+
35
+ - name: Bundle
36
+ run: bundle install --jobs 4 --retry 3
37
+
38
+ - name: Initialize CodeQL
39
+ uses: github/codeql-action/init@v2
40
+ with:
41
+ languages: "ruby, cpp"
42
+
43
+ - name: Build native extension
44
+ run: bundle exec rake compile
45
+
46
+ - name: Perform CodeQL Analysis
47
+ uses: github/codeql-action/analyze@v2
@@ -8,6 +8,7 @@ on:
8
8
  - '**.adoc'
9
9
  - '**.md'
10
10
  - .github/workflows/release.yml
11
+ - .github/workflows/codeql.yml
11
12
  pull_request:
12
13
  workflow_dispatch:
13
14
 
@@ -16,6 +17,7 @@ concurrency:
16
17
  cancel-in-progress: true
17
18
 
18
19
  env:
20
+ RUBYGEM_VER: 3.4.22
19
21
  BUNDLER_VER: 2.4.22
20
22
  # Forcing bundler version to ensure that it is consistent everywhere and
21
23
  # does not cause bundler gem reinstalls
@@ -77,11 +79,54 @@ jobs:
77
79
  run: bundle install --jobs 4 --retry 3
78
80
 
79
81
  - name: Process cache
80
- uses: actions/cache@v3
82
+ uses: actions/cache@v4
81
83
  id: cache
82
84
  with:
83
85
  path: lib/expressir/express/express_parser.*
84
- key: v4-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('ext/express-parser/extconf.rb', 'ext/express-parser/antlrgen/**', 'ext/express-parser/express_parser.cpp', '.git/modules/ext/express-parser/antlr4-upstream/HEAD') }}
86
+ key: v4-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('ext/express_parser/extconf.rb', 'ext/express_parser/antlrgen/**', 'ext/express_parser/express_parser.cpp', '.git/modules/ext/express_parser/antlr4-upstream/HEAD') }}
87
+
88
+ - name: Build native extension
89
+ if: steps.cache.outputs.cache-hit != 'true'
90
+ run: bundle exec rake compile
91
+
92
+ - name: Run tests
93
+ run: |
94
+ bundle exec rake
95
+ cat .rspec_status
96
+
97
+ rake-alpine:
98
+ name: test on ruby-${{ matrix.ruby }} alpine container
99
+ runs-on: ubuntu-latest
100
+ strategy:
101
+ fail-fast: false
102
+ matrix:
103
+ ruby: [ '3.2', '3.1', '3.0', '2.7' ]
104
+ container: ruby:${{ matrix.ruby }}-alpine
105
+ steps:
106
+ - name: Install packages
107
+ run: |
108
+ apk --no-cache --upgrade add build-base git bash tar
109
+
110
+ - name: Checkout
111
+ uses: actions/checkout@v4
112
+ with:
113
+ submodules: recursive
114
+
115
+ - name: Upgrade RubyGems
116
+ if: matrix.ruby == '3.0' || matrix.ruby == '2.7'
117
+ run: gem update --system ${{ env.RUBYGEM_VER }} --no-document
118
+
119
+ - name: Bundle
120
+ run: |
121
+ git config --global --add safe.directory $PWD
122
+ bundle install --jobs 4 --retry 3
123
+
124
+ - name: Process cache
125
+ uses: actions/cache@v4
126
+ id: cache
127
+ with:
128
+ path: lib/expressir/express/express_parser.*
129
+ key: v4-alpine-${{ matrix.ruby }}-${{ hashFiles('ext/express_parser/extconf.rb', 'ext/express_parser/antlrgen/**', 'ext/express_parser/express_parser.cpp', '.git/modules/ext/express_parser/antlr4-upstream/HEAD') }}
85
130
 
86
131
  - name: Build native extension
87
132
  if: steps.cache.outputs.cache-hit != 'true'
@@ -115,7 +160,7 @@ jobs:
115
160
  run: gem build expressir.gemspec
116
161
 
117
162
  - name: Package gem without native extension
118
- uses: actions/upload-artifact@v3
163
+ uses: actions/upload-artifact@v4
119
164
  with:
120
165
  name: pkg-ruby
121
166
  path: expressir-*.gem
@@ -125,7 +170,7 @@ jobs:
125
170
  strategy:
126
171
  fail-fast: false
127
172
  matrix:
128
- platform: [ linux-gnu, windows, darwin ]
173
+ platform: [ linux-gnu, linux-musl, windows, darwin ]
129
174
  steps:
130
175
  - name: Checkout
131
176
  uses: actions/checkout@v4
@@ -154,7 +199,7 @@ jobs:
154
199
  run: bundle exec rake gem:${{ matrix.platform }}
155
200
 
156
201
  - name: Package gem with native extension
157
- uses: actions/upload-artifact@v3
202
+ uses: actions/upload-artifact@v4
158
203
  with:
159
204
  name: pkg-${{ matrix.platform }}
160
205
  path: pkg/*.gem
@@ -185,7 +230,7 @@ jobs:
185
230
  run: bundle install --jobs 4 --retry 3
186
231
 
187
232
  - name: Download packaged gem
188
- uses: actions/download-artifact@v3
233
+ uses: actions/download-artifact@v4
189
234
  with:
190
235
  name: pkg-ruby
191
236
  path: pkg
@@ -195,7 +240,50 @@ jobs:
195
240
 
196
241
  - name: Verify
197
242
  run: |
198
- cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
243
+ cd $(ruby -e "puts Gem::Specification.find_by_name('expressir').gem_dir")
244
+ ruby bin/rspec
245
+ cat .rspec_status || echo ".rspec_status was not found"
246
+
247
+ verify-ruby-linux-musl:
248
+ name: verify ruby gem on ruby-${{ matrix.ruby }} on alpine container
249
+ needs: pack-ruby
250
+ runs-on: ubuntu-latest
251
+ strategy:
252
+ fail-fast: false
253
+ matrix:
254
+ ruby: [ '3.2', '3.1', '3.0', '2.7' ]
255
+ container: ruby:${{ matrix.ruby }}-alpine
256
+ steps:
257
+ - name: Install packages
258
+ run: |
259
+ apk --no-cache --upgrade add build-base git bash tar
260
+
261
+ - name: Checkout
262
+ uses: actions/checkout@v4
263
+ with:
264
+ submodules: recursive
265
+
266
+ - name: Upgrade RubyGems
267
+ if: matrix.ruby == '3.0' || matrix.ruby == '2.7'
268
+ run: gem update --system ${{ env.RUBYGEM_VER }} --no-document
269
+
270
+ - name: Bundle
271
+ run: |
272
+ git config --global --add safe.directory $PWD
273
+ bundle install --jobs 4 --retry 3
274
+
275
+ - name: Download packaged gem
276
+ uses: actions/download-artifact@v4
277
+ with:
278
+ name: pkg-ruby
279
+ path: pkg
280
+
281
+ - name: Install gem
282
+ run: gem install -l pkg/expressir-*.gem
283
+
284
+ - name: Verify
285
+ run: |
286
+ cd $(ruby -e "puts Gem::Specification.find_by_name('expressir').gem_dir")
199
287
  ruby bin/rspec
200
288
  cat .rspec_status || echo ".rspec_status was not found"
201
289
 
@@ -222,7 +310,7 @@ jobs:
222
310
  run: bundle install --jobs 4 --retry 3
223
311
 
224
312
  - name: Download packaged gem
225
- uses: actions/download-artifact@v3
313
+ uses: actions/download-artifact@v4
226
314
  with:
227
315
  name: pkg-darwin
228
316
  path: pkg
@@ -233,7 +321,7 @@ jobs:
233
321
 
234
322
  - name: Verify
235
323
  run: |
236
- cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
324
+ cd $(ruby -e "puts Gem::Specification.find_by_name('expressir').gem_dir")
237
325
  ruby bin/rspec
238
326
  cat .rspec_status || echo ".rspec_status was not found"
239
327
 
@@ -253,6 +341,10 @@ jobs:
253
341
  bundler-cache: false
254
342
  bundler: ${{ env.BUNDLER_VER }}
255
343
 
344
+ - name: Upgrade RubyGems
345
+ if: matrix.ruby == '3.0' || matrix.ruby == '2.7'
346
+ run: gem update --system ${{ env.RUBYGEM_VER }} --no-document
347
+
256
348
  - name: Checkout
257
349
  uses: actions/checkout@v4
258
350
 
@@ -260,7 +352,7 @@ jobs:
260
352
  run: bundle install --jobs 4 --retry 3
261
353
 
262
354
  - name: Download packaged gem
263
- uses: actions/download-artifact@v3
355
+ uses: actions/download-artifact@v4
264
356
  with:
265
357
  name: pkg-linux-gnu
266
358
  path: pkg
@@ -270,7 +362,7 @@ jobs:
270
362
 
271
363
  - name: Verify
272
364
  run: |
273
- cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
365
+ cd $(ruby -e "puts Gem::Specification.find_by_name('expressir').gem_dir")
274
366
  ruby bin/rspec
275
367
  cat .rspec_status || echo ".rspec_status was not found"
276
368
 
@@ -298,7 +390,7 @@ jobs:
298
390
  run: bundle install --jobs 4 --retry 3
299
391
 
300
392
  - name: Download packaged gem
301
- uses: actions/download-artifact@v3
393
+ uses: actions/download-artifact@v4
302
394
  with:
303
395
  name: pkg-windows
304
396
  path: pkg
@@ -308,6 +400,49 @@ jobs:
308
400
 
309
401
  - name: Verify
310
402
  run: |
311
- cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
403
+ cd $(ruby -e "puts Gem::Specification.find_by_name('expressir').gem_dir")
404
+ ruby bin/rspec
405
+ cat .rspec_status || echo ".rspec_status was not found"
406
+
407
+ verify-linux-musl:
408
+ name: verify Linux (musl) binary gem on ruby-${{ matrix.ruby }}
409
+ needs: pack
410
+ runs-on: ubuntu-latest
411
+ strategy:
412
+ fail-fast: false
413
+ matrix:
414
+ ruby: [ '3.2', '3.1', '3.0', '2.7' ]
415
+ container: ruby:${{ matrix.ruby }}-alpine
416
+ steps:
417
+ - name: Install packages
418
+ run: |
419
+ apk --no-cache --upgrade add build-base git bash tar
420
+
421
+ - name: Checkout
422
+ uses: actions/checkout@v4
423
+ with:
424
+ submodules: recursive
425
+
426
+ - name: Upgrade RubyGems
427
+ if: matrix.ruby == '3.0' || matrix.ruby == '2.7'
428
+ run: gem update --system ${{ env.RUBYGEM_VER }} --no-document
429
+
430
+ - name: Bundle
431
+ run: |
432
+ git config --global --add safe.directory $PWD
433
+ bundle install --jobs 4 --retry 3
434
+
435
+ - name: Download packaged gem
436
+ uses: actions/download-artifact@v4
437
+ with:
438
+ name: pkg-linux-musl
439
+ path: pkg
440
+
441
+ - name: Install binary gem
442
+ run: gem install -l pkg/expressir-*-$(ruby -e "puts RUBY_PLATFORM").gem
443
+
444
+ - name: Verify
445
+ run: |
446
+ cd $(ruby -e "puts Gem::Specification.find_by_name('expressir').gem_dir")
312
447
  ruby bin/rspec
313
448
  cat .rspec_status || echo ".rspec_status was not found"
@@ -15,6 +15,9 @@ concurrency:
15
15
  group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
16
16
  cancel-in-progress: true
17
17
 
18
+ env:
19
+ BUNDLER_VER: 2.4.22
20
+
18
21
  jobs:
19
22
  bump:
20
23
  runs-on: ubuntu-latest
@@ -62,13 +65,13 @@ jobs:
62
65
  gem build expressir.gemspec | grep -o 'Version: .*' | awk '{print $2}' > version
63
66
 
64
67
  - if: matrix.platform == 'linux-gnu'
65
- uses: actions/upload-artifact@v3
68
+ uses: actions/upload-artifact@v4
66
69
  with:
67
70
  name: pkg-ruby
68
71
  path: expressir-*.gem
69
72
 
70
73
  - if: matrix.platform == 'linux-gnu'
71
- uses: actions/upload-artifact@v3
74
+ uses: actions/upload-artifact@v4
72
75
  with:
73
76
  name: version
74
77
  path: version
@@ -84,7 +87,7 @@ jobs:
84
87
  # build gem WITH pre-built native extension
85
88
  - run: bundle exec rake gem:${{ matrix.platform }}
86
89
 
87
- - uses: actions/upload-artifact@v3
90
+ - uses: actions/upload-artifact@v4
88
91
  with:
89
92
  name: pkg-${{ matrix.platform }}
90
93
  path: pkg/*.gem
@@ -93,22 +96,22 @@ jobs:
93
96
  runs-on: ubuntu-latest
94
97
  needs: pack
95
98
  steps:
96
- - uses: actions/download-artifact@v3
99
+ - uses: actions/download-artifact@v4
97
100
  with:
98
101
  name: pkg-ruby
99
102
  path: pkg
100
103
 
101
- - uses: actions/download-artifact@v3
104
+ - uses: actions/download-artifact@v4
102
105
  with:
103
106
  name: pkg-linux-gnu
104
107
  path: pkg
105
108
 
106
- - uses: actions/download-artifact@v3
109
+ - uses: actions/download-artifact@v4
107
110
  with:
108
111
  name: pkg-windows
109
112
  path: pkg
110
113
 
111
- - uses: actions/download-artifact@v3
114
+ - uses: actions/download-artifact@v4
112
115
  with:
113
116
  name: pkg-darwin
114
117
  path: pkg
@@ -130,7 +133,7 @@ jobs:
130
133
  chmod 0600 ~/.gem/credentials
131
134
  gem signin
132
135
  for gem in pkg/*.gem; do gem push $gem -V; done
133
- sleep(5)
136
+ sleep 15
134
137
 
135
138
  verify:
136
139
  name: Verify published gem on ${{ matrix.os }}
@@ -149,7 +152,7 @@ jobs:
149
152
  bundler: ${{ env.BUNDLER_VER }}
150
153
 
151
154
  - name: Download version
152
- uses: actions/download-artifact@v3
155
+ uses: actions/download-artifact@v4
153
156
  with:
154
157
  name: version
155
158
 
@@ -170,7 +173,7 @@ jobs:
170
173
  run: apk --no-cache add bash build-base git ruby-dev gcc g++ automake
171
174
 
172
175
  - name: Download version
173
- uses: actions/download-artifact@v3
176
+ uses: actions/download-artifact@v4
174
177
  with:
175
178
  name: version
176
179
 
@@ -0,0 +1,53 @@
1
+ name: stress
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ concurrency:
7
+ group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
8
+ cancel-in-progress: true
9
+
10
+ env:
11
+ BUNDLER_VER: 2.4.22
12
+ GC_STRESS: true
13
+
14
+ jobs:
15
+ rake:
16
+ name: test on ruby-${{ matrix.ruby }} ${{ matrix.os }}
17
+ runs-on: ${{ matrix.os }}
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby: [ '3.2', '3.1', '3.0', '2.7' ]
22
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
23
+
24
+ steps:
25
+ - name: Checkout
26
+ uses: actions/checkout@v4
27
+ with:
28
+ submodules: recursive
29
+
30
+ - name: Setup packages
31
+ if: startsWith(matrix.os, 'macos')
32
+ run: brew install autoconf automake libtool
33
+
34
+ - name: Install Ruby
35
+ uses: ruby/setup-ruby@master
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+ bundler: ${{ env.BUNDLER_VER }}
39
+ # Rice gem has issues with bundler cache
40
+ # more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126
41
+ # but it is not the only issue
42
+ bundler-cache: false
43
+
44
+ - name: Bundle
45
+ run: bundle install --jobs 4 --retry 3
46
+
47
+ - name: Build native extension
48
+ run: bundle exec rake compile
49
+
50
+ - name: Run tests
51
+ run: |
52
+ bundle exec rake
53
+ cat .rspec_status
data/.gitignore CHANGED
@@ -14,7 +14,7 @@
14
14
  /lib/expressir/express/*/express_parser.bundle
15
15
  /lib/expressir/express/*/express_parser.so
16
16
  /spec/syntax/*-pretty.exp
17
- /ext/express-parser/rice-embed
17
+ /ext/express_parser/rice-embed
18
18
 
19
19
  # rspec failure tracking
20
20
  .rspec_status
data/.gitmodules CHANGED
@@ -1,5 +1,5 @@
1
- [submodule "ext/express-parser/antlr4-upstream"]
2
- path = ext/express-parser/antlr4-upstream
1
+ [submodule "ext/express_parser/antlr4-upstream"]
2
+ path = ext/express_parser/antlr4-upstream
3
3
  url = https://github.com/antlr/antlr4
4
4
  [submodule "ext/express-grammar"]
5
5
  path = ext/express-grammar
data/exe/generate-parser CHANGED
@@ -18,7 +18,7 @@ generator = Antlr4Native::Generator.new(
18
18
  generator.generate
19
19
 
20
20
  # fix issues with generated parser
21
- parser_source_file = File.join("ext", "express-parser", "express_parser.cpp")
21
+ parser_source_file = File.join("ext", "express_parser", "express_parser.cpp")
22
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
data/expressir.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.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
 
@@ -28,18 +28,18 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
  spec.executables = %w[expressir]
30
30
 
31
- spec.extensions = File.join(*%w(ext express-parser extconf.rb))
31
+ spec.extensions = File.join(*%w(ext express_parser extconf.rb))
32
32
 
33
- spec.add_runtime_dependency "rice", "~> 4.1"
33
+ spec.add_runtime_dependency "rice", "~> 4.2"
34
34
  spec.add_runtime_dependency "thor", "~> 1.0"
35
- spec.add_development_dependency "antlr4-native", "~> 2.1.0"
35
+ spec.add_development_dependency "antlr4-native", "~> 2.2"
36
36
  spec.add_development_dependency "asciidoctor", "~> 2.0.13"
37
37
  spec.add_development_dependency "bundler", "~> 2.3"
38
38
  spec.add_development_dependency "byebug", "~> 11.1"
39
39
  spec.add_development_dependency "pry", "~> 0.12.2"
40
40
  spec.add_development_dependency "rake", "~> 13.0"
41
41
  spec.add_development_dependency "rake-compiler", "~> 1.2"
42
- spec.add_development_dependency "rake-compiler-dock", "~> 1.3"
42
+ spec.add_development_dependency "rake-compiler-dock", "~> 1.5"
43
43
  spec.add_development_dependency "rspec", "~> 3.11"
44
44
  spec.add_development_dependency "rubocop", "1.58"
45
45
  spec.add_development_dependency "rubocop-performance", "~> 1.19"
@@ -39,7 +39,6 @@ module Expressir
39
39
  # so in this class we keep those C++ structure marked for GC so they are not freed
40
40
  @parser = ::ExpressParser::ParserExt.new(file.to_s)
41
41
  @parse_tree = @parser.syntax()
42
-
43
42
  @visitor = Visitor.new(@parser.tokens, include_source: include_source)
44
43
  @repository = @visitor.visit(@parse_tree)
45
44
 
@@ -40,7 +40,7 @@ module Expressir
40
40
 
41
41
  private_constant :REMARK_CHANNEL
42
42
 
43
- # @param [Array<::ExpressParser::Token>] tokens
43
+ # @param [::ExpressParser::TokenVector] Rice-wrapped std::vector<TokenProxy>
44
44
  # @param [Boolean] include_source attach original source code to model elements
45
45
  def initialize(tokens, include_source: nil)
46
46
  @tokens = tokens
@@ -101,7 +101,11 @@ module Expressir
101
101
  [ctx.start.token_index, ctx.stop.token_index]
102
102
  end
103
103
 
104
- @tokens[start_index..stop_index]
104
+ selected_tokens = []
105
+ (start_index..stop_index).each do |i|
106
+ selected_tokens << @tokens[i]
107
+ end
108
+ selected_tokens
105
109
  end
106
110
 
107
111
  def attach_source(ctx, node)
@@ -150,15 +154,14 @@ module Expressir
150
154
  end
151
155
 
152
156
  def attach_remarks(ctx, node)
153
- @remark_tokens = get_tokens(ctx)
154
- @remark_tokens = @remark_tokens.select{ |x| x.channel == REMARK_CHANNEL
155
- }
157
+ remark_tokens = get_tokens(ctx)
158
+ remark_tokens = remark_tokens.select{ |x| x.channel == REMARK_CHANNEL }
156
159
 
157
160
  # skip already attached remarks
158
- @remark_tokens = @remark_tokens.select{|x| !@attached_remark_tokens.include?(x)}
161
+ remark_tokens = remark_tokens.select{|x| !@attached_remark_tokens.include?(x.token_index)}
159
162
 
160
163
  # parse remarks, find remark targets
161
- tagged_remark_tokens = @remark_tokens.map do |remark_token|
164
+ tagged_remark_tokens = remark_tokens.map do |remark_token|
162
165
  _, remark_tag, remark_text = if remark_token.text.start_with?('--')
163
166
  remark_token.text.match(/^--"([^"]*)"(.*)$/).to_a
164
167
  else
@@ -181,7 +184,7 @@ module Expressir
181
184
  remark_target.remarks << remark_text
182
185
 
183
186
  # mark remark as attached, so that it is not attached again at higher nesting level
184
- @attached_remark_tokens << remark_token
187
+ @attached_remark_tokens << remark_token.token_index
185
188
  end
186
189
  end
187
190
 
@@ -90,13 +90,13 @@ module Expressir
90
90
  return [] unless parent
91
91
 
92
92
  interfaces.flat_map do |interface|
93
- schema = parent.children_by_id[interface.schema.id.downcase]
93
+ schema = parent.children_by_id[interface.schema.id.safe_downcase]
94
94
  if schema
95
95
  schema_safe_children = schema.safe_children
96
- schema_safe_children_by_id = schema_safe_children.select{|x| x.id}.map{|x| [x.id.downcase, x]}.to_h
96
+ schema_safe_children_by_id = schema_safe_children.select{|x| x.id}.map{|x| [x.id.safe_downcase, x]}.to_h
97
97
  if interface.items.length > 0
98
98
  interface.items.map do |interface_item|
99
- base_item = schema_safe_children_by_id[interface_item.ref.id.downcase]
99
+ base_item = schema_safe_children_by_id[interface_item.ref.id.safe_downcase]
100
100
  if base_item
101
101
  id = interface_item.id || base_item.id
102
102
  create_interfaced_item(id, base_item)
@@ -46,7 +46,7 @@ module Expressir
46
46
  def find(path)
47
47
  return self if path.empty?
48
48
 
49
- path_parts = path.downcase.split(/\./).map do |current_path|
49
+ path_parts = path.safe_downcase.split(/\./).map do |current_path|
50
50
  _, _, current_path = current_path.rpartition(":") # ignore prefix
51
51
  current_path
52
52
  end
@@ -82,7 +82,7 @@ module Expressir
82
82
 
83
83
  # @return [Hash<String, Declaration>]
84
84
  def children_by_id
85
- @children_by_id ||= children.select{|x| x.id}.map{|x| [x.id.downcase, x]}.to_h
85
+ @children_by_id ||= children.select{|x| x.id}.map{|x| [x.id.safe_downcase, x]}.to_h
86
86
  end
87
87
 
88
88
  # @return [nil]
@@ -90,7 +90,7 @@ module Expressir
90
90
  @children_by_id = nil
91
91
  nil
92
92
  end
93
-
93
+
94
94
  # @param [String] root_path
95
95
  # @param [Express::Formatter] formatter
96
96
  # @param [Boolean] include_empty
@@ -131,7 +131,7 @@ module Expressir
131
131
 
132
132
  hash
133
133
  end
134
-
134
+
135
135
  # @param [Hash] hash
136
136
  # @param [String] root_path
137
137
  # @return [ModelElement]
@@ -1,3 +1,3 @@
1
1
  module Expressir
2
- VERSION = "1.3.0".freeze
2
+ VERSION = "1.3.2".freeze
3
3
  end
data/lib/expressir.rb CHANGED
@@ -7,6 +7,26 @@ Dir[File.join(__dir__, "expressir", "express", "*.rb")].sort.each do |fea|
7
7
  require fea
8
8
  end
9
9
 
10
+ # ..........................................................
11
+ # https://bugs.ruby-lang.org/issues/19319
12
+ # The issue is that this bug is fixed for 3.1 and above,
13
+ # but not for 3.0 or 2.7, so we need a "safe" function
14
+ # ..........................................................
15
+
16
+ if RUBY_VERSION < "3.1"
17
+ class String
18
+ def safe_downcase
19
+ each_char.map(&:downcase).join
20
+ end
21
+ end
22
+ else
23
+ class String
24
+ def safe_downcase
25
+ downcase
26
+ end
27
+ end
28
+ end
29
+
10
30
  module Expressir
11
31
  class Error < StandardError; end
12
32
 
@@ -72,12 +72,12 @@ def create_pp_class_definition(parser_source_lines)
72
72
  return detail::To_Ruby<SyntaxContextProxy>().convert(proxy);
73
73
  }
74
74
 
75
- Array getTokens() {
76
- Array a;
75
+ Object getTokens() {
76
+ std::vector<TokenProxy> tk;
77
77
  for (auto token : tokens -> getTokens()) {
78
- a.push(new TokenProxy(token));
78
+ tk.push_back(TokenProxy(token));
79
79
  }
80
- return a;
80
+ return detail::To_Ruby<std::vector<TokenProxy>>().convert(tk);
81
81
  }
82
82
 
83
83
  Object visit(VisitorProxy* visitor) {
@@ -88,8 +88,8 @@ def create_pp_class_definition(parser_source_lines)
88
88
 
89
89
  try {
90
90
  return std::any_cast<Object>(result);
91
- } catch(std::bad_cast) {
92
- return Qnil;
91
+ } catch(std::bad_any_cast) {
92
+ return Qnil;
93
93
  }
94
94
  }
95
95
 
@@ -105,7 +105,7 @@ def create_pp_class_definition(parser_source_lines)
105
105
  end
106
106
 
107
107
  def create_class_api(parser_source_lines)
108
- i = parser_source_lines.index { |x| x == " .define_method(\"visit\", &ParserProxy::visit, Return().keepAlive());" }
108
+ i = parser_source_lines.index { |x| x == " .define_method(\"visit\", &ParserProxy::visit);" }
109
109
  parser_source_lines[i] += <<~CPP.split("\n").map { |x| x == "" ? x : " #{x}" }.join("\n")
110
110
 
111
111
 
@@ -116,17 +116,29 @@ def create_class_api(parser_source_lines)
116
116
 
117
117
  rb_cParserExt = define_class_under<ParserProxyExt>(rb_mExpressParser, "ParserExt")
118
118
  .define_constructor(Constructor<ParserProxyExt, string>())
119
- .define_method("syntax", &ParserProxyExt::syntax, Return().keepAlive())
120
- .define_method("tokens", &ParserProxyExt::getTokens)
121
- .define_method("visit", &ParserProxyExt::visit, Return().keepAlive());
119
+ .define_method("syntax", &ParserProxyExt::syntax)
120
+ .define_method("tokens", &ParserProxyExt::getTokens, Return().keepAlive())
121
+ .define_method("visit", &ParserProxyExt::visit);
122
+
123
+ define_vector<std::vector<TokenProxy>>("TokenVector");
124
+
125
+ CPP
126
+ end
127
+
128
+ def create_vector_definition(parser_source_lines)
129
+ i = parser_source_lines.index { |x| x == " .define_method(\"visit\", &ParserProxy::visit);" }
130
+ parser_source_lines[i] += <<~CPP.split("\n").map { |x| x == "" ? x : " #{x}" }.join("\n")
122
131
 
123
132
  CPP
124
133
  end
125
134
 
126
135
  def generate_extended_parser
127
136
  # Generate extended parser that provide Ruby access to token stream
128
- parser_source_file = File.join("ext", "express-parser", "express_parser.cpp")
129
- parser_source_lines = File.read(parser_source_file).split("\n")
137
+ parser_source_file = File.join("ext", "express_parser", "express_parser.cpp")
138
+ parser_source_lines = File.read(parser_source_file)
139
+ .gsub!("bad_cast", "bad_any_cast")
140
+ .gsub!("return detail::To_Ruby<Token*>().convert(token)", "return detail::To_Ruby<TokenProxy>().convert(TokenProxy(token))")
141
+ .split("\n")
130
142
  create_class_declarations(parser_source_lines)
131
143
  create_tp_class_definition(parser_source_lines)
132
144
  create_pp_class_definition(parser_source_lines)
@@ -3,6 +3,7 @@ require "shellwords"
3
3
 
4
4
  WINDOWS_PLATFORM_REGEX = /mingw|mswin/.freeze
5
5
  LINUX_GNU_PLATFORM_REGEX = /linux-gnu/.freeze
6
+ LINUX_MUSL_PLATFORM_REGEX = /linux-musl/.freeze
6
7
  DARWIN_PLATFORM_REGEX = /darwin/.freeze
7
8
  GLIBC_MIN_VERSION = "2.17".freeze
8
9
 
@@ -11,16 +12,20 @@ CrossRuby = Struct.new(:version, :host) do
11
12
  "tmp/#{platform}/stage/lib/expressir/express/#{minor_ver}/express_parser.#{dll_ext}"
12
13
  end
13
14
 
14
- def windows?
15
- !!(platform =~ WINDOWS_PLATFORM_REGEX)
15
+ def darwin?
16
+ !!(platform =~ DARWIN_PLATFORM_REGEX)
16
17
  end
17
18
 
18
19
  def linux_gnu?
19
20
  !!(platform =~ LINUX_GNU_PLATFORM_REGEX)
20
21
  end
21
22
 
22
- def darwin?
23
- !!(platform =~ DARWIN_PLATFORM_REGEX)
23
+ def linux_musl?
24
+ !!(platform =~ LINUX_MUSL_PLATFORM_REGEX)
25
+ end
26
+
27
+ def windows?
28
+ !!(platform =~ WINDOWS_PLATFORM_REGEX)
24
29
  end
25
30
 
26
31
  def ver
@@ -63,6 +68,10 @@ CrossRuby = Struct.new(:version, :host) do
63
68
  "x86_64-linux-gnu"
64
69
  when "aarch64-linux-gnu"
65
70
  "aarch64-linux-gnu"
71
+ when "x86_64-linux-musl"
72
+ "x86_64-linux-musl"
73
+ when "aarch64-linux-musl"
74
+ "aarch64-linux-musl"
66
75
  when /\Ax86_64-darwin/
67
76
  "x86_64-darwin"
68
77
  when /\Aarm64-darwin/
@@ -89,7 +98,7 @@ CrossRuby = Struct.new(:version, :host) do
89
98
  case platform
90
99
  when /x64-mingw(32|-ucrt)/
91
100
  "x86_64-w64-mingw32-"
92
- when /(x86_64|aarch64)-linux-gnu/
101
+ when /(x86_64|aarch64)-linux-(gnu|musl)/
93
102
  # We do believe that we are on Linux and can use native tools
94
103
  ""
95
104
  when /x86_64.*darwin/
@@ -105,9 +114,9 @@ CrossRuby = Struct.new(:version, :host) do
105
114
  case platform
106
115
  when /64-mingw(32|-ucrt)/
107
116
  "pei-x86-64"
108
- when "x86_64-linux-gnu"
117
+ when /x86_64-linux-(gnu|musl)/
109
118
  "elf64-x86-64"
110
- when "aarch64-linux-gnu"
119
+ when /aarch64-linux-(gnu|musl)/
111
120
  "elf64-little"
112
121
  when "x86_64-darwin"
113
122
  "Mach-O 64-bit x86-64"
@@ -154,7 +163,7 @@ CrossRuby = Struct.new(:version, :host) do
154
163
  case platform
155
164
  when WINDOWS_PLATFORM_REGEX
156
165
  verify_entry_windows(dump, dll)
157
- when LINUX_GNU_PLATFORM_REGEX
166
+ when LINUX_GNU_PLATFORM_REGEX, LINUX_MUSL_PLATFORM_REGEX
158
167
  verify_entry_linux(dll)
159
168
  when DARWIN_PLATFORM_REGEX
160
169
  verify_entry_darwin(dll)
@@ -199,7 +208,7 @@ CrossRuby = Struct.new(:version, :host) do
199
208
  end
200
209
  end
201
210
 
202
- def allowed_dlls_linux
211
+ def allowed_dlls_linux_gnu
203
212
  suffix = (platform == "x86_64-linux-gnu" ? "x86-64" : "aarch64")
204
213
  [
205
214
  "ld-linux-#{suffix}.so",
@@ -211,6 +220,16 @@ CrossRuby = Struct.new(:version, :host) do
211
220
  ]
212
221
  end
213
222
 
223
+ def allowed_dlls_linux_musl
224
+ suffix = (platform == "x86_64-linux-gnu" ? "x86-64" : "aarch64")
225
+ [
226
+ "ld-linux-#{suffix}.so",
227
+ "libstdc++.so",
228
+ "libc.so",
229
+ "libgcc_s.so",
230
+ ]
231
+ end
232
+
214
233
  def allowed_dlls_darwin
215
234
  [
216
235
  "/usr/lib/libSystem.B.dylib",
@@ -218,12 +237,14 @@ CrossRuby = Struct.new(:version, :host) do
218
237
  ]
219
238
  end
220
239
 
221
- def allowed_dlls
240
+ def allowed_dlls # rubocop:disable Metrics/MethodLength
222
241
  case platform
223
242
  when WINDOWS_PLATFORM_REGEX
224
243
  allowed_dlls_windows
225
244
  when LINUX_GNU_PLATFORM_REGEX
226
- allowed_dlls_linux
245
+ allowed_dlls_linux_gnu
246
+ when LINUX_MUSL_PLATFORM_REGEX
247
+ allowed_dlls_linux_musl
227
248
  when DARWIN_PLATFORM_REGEX
228
249
  allowed_dlls_darwin
229
250
  else
@@ -248,7 +269,7 @@ CrossRuby = Struct.new(:version, :host) do
248
269
  case platform
249
270
  when DARWIN_PLATFORM_REGEX
250
271
  actual_dlls_darwin(dll)
251
- when LINUX_GNU_PLATFORM_REGEX
272
+ when LINUX_GNU_PLATFORM_REGEX, LINUX_MUSL_PLATFORM_REGEX
252
273
  actual_dlls_linux(dump)
253
274
  when WINDOWS_PLATFORM_REGEX
254
275
  actual_dlls_windows(dump)
@@ -335,15 +356,10 @@ def pre_req(plat)
335
356
  end
336
357
 
337
358
  namespace "gem" do
338
- CROSS_RUBIES.find_all { |cr| cr.windows? || cr.linux_gnu? || cr.darwin? }
339
- .map { |cr| { platform: cr.platform, tag: cr.tag } }
340
- .uniq { |hash| hash[:platform] }.each do |hash|
341
- plat = hash[:platform]
342
- tag = hash[:tag]
343
-
359
+ CROSS_RUBIES.find_all { |cr| cr.windows? || cr.linux_gnu? || cr.linux_musl? || cr.darwin? }.map(&:platform).uniq.each do |plat|
344
360
  desc "build native gem for #{plat} platform"
345
361
  task plat do
346
- RakeCompilerDock.sh <<~RCD, platform: tag
362
+ RakeCompilerDock.sh <<~RCD, platform: plat
347
363
  #{pre_req(plat)} && gem install bundler --no-document &&
348
364
  bundle && bundle exec rake gem:#{plat}:builder MAKE="nice make -j`nproc`"
349
365
  RCD
@@ -360,9 +376,12 @@ namespace "gem" do
360
376
  desc "build native gems for windows"
361
377
  multitask "windows" => CROSS_RUBIES.find_all(&:windows?).map(&:platform).uniq
362
378
 
363
- desc "build native gems for linux"
379
+ desc "build native gems for linux-gnu"
364
380
  multitask "linux-gnu" => CROSS_RUBIES.find_all(&:linux_gnu?).map(&:platform).uniq
365
381
 
382
+ desc "build native gems for linux-musl"
383
+ multitask "linux-musl" => CROSS_RUBIES.find_all(&:linux_musl?).map(&:platform).uniq
384
+
366
385
  desc "build native gems for darwin"
367
386
  multitask "darwin" => CROSS_RUBIES.find_all(&:darwin?).map(&:platform).uniq
368
387
  end
@@ -370,7 +389,7 @@ end
370
389
  require "rake/extensiontask"
371
390
 
372
391
  Rake::ExtensionTask.new("express_parser", GEMSPEC) do |ext|
373
- ext.ext_dir = "ext/express-parser"
392
+ ext.ext_dir = "ext/express_parser"
374
393
  ext.lib_dir = File.join(*["lib", "expressir", "express", ENV.fetch("FAT_DIR", nil)].compact)
375
394
  ext.config_options << ENV.fetch("EXTOPTS", nil)
376
395
  ext.cross_compile = true
@@ -3,6 +3,9 @@ require "spec_helper"
3
3
  RSpec.describe "Expressir" do
4
4
  describe "version" do
5
5
  it "has a version number" do |example|
6
+ GC.stress = ENV["GC_STRESS"] == "true"
7
+ puts "Running tests in GC stress mode. It may take a couple of hours ..." if GC.stress
8
+
6
9
  print "\n[#{example.description}] "
7
10
  expect(Expressir::VERSION).not_to be nil
8
11
 
@@ -40,7 +40,7 @@ RSpec.describe Expressir::Express::Cache do
40
40
  end.to raise_error(Errno::ENOENT)
41
41
  end
42
42
 
43
- it "parses a file" do |example|
43
+ it "loads a cache file" do |example|
44
44
  print "\n[#{example.description}] "
45
45
  temp_file = Tempfile.new
46
46
 
@@ -63,7 +63,7 @@ RSpec.describe Expressir::Express::Cache do
63
63
  GC.verify_internal_consistency
64
64
  end
65
65
 
66
- it "fails parsing a file from a different Expressir version" do |example|
66
+ it "fails parsing a cache from a different Expressir version" do |example|
67
67
  print "\n[#{example.description}] "
68
68
  temp_file = Tempfile.new
69
69
 
@@ -11,9 +11,7 @@ RSpec.describe Expressir::Express::Formatter do
11
11
  print "\n[#{example.description}] "
12
12
  exp_file = Expressir.root_path.join("spec", "syntax", "single.exp")
13
13
  formatted_exp_file = Expressir.root_path.join("spec", "syntax", "single_formatted.exp")
14
-
15
14
  repo = Expressir::Express::Parser.from_file(exp_file)
16
-
17
15
  result = Expressir::Express::Formatter.format(repo)
18
16
  # File.write(formatted_exp_file, result)
19
17
  expected_result = File.read(formatted_exp_file)
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: 1.3.0
4
+ version: 1.3.2
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-19 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.1.0
33
+ version: '2.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.1.0
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: asciidoctor
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.3'
131
+ version: '1.5'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.3'
138
+ version: '1.5'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -216,8 +216,10 @@ extensions: []
216
216
  extra_rdoc_files: []
217
217
  files:
218
218
  - ".cross_rubies"
219
+ - ".github/workflows/codeql.yml"
219
220
  - ".github/workflows/rake.yml"
220
221
  - ".github/workflows/release.yml"
222
+ - ".github/workflows/stress.yml"
221
223
  - ".gitignore"
222
224
  - ".gitmodules"
223
225
  - ".hound.yml"