hegeltest 0.3.1-aarch64-linux → 0.4.0-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +262 -0
- data/README.ja.md +408 -0
- data/README.md +209 -103
- data/Rakefile +6 -3
- data/docs/README.md +11 -0
- data/docs/adr/0025-copy-each-string-input-into-a-hegel-string-t.md +61 -0
- data/docs/adr/0026-select-the-engine-release-repository-by-version.md +47 -0
- data/docs/adr/0027-report-each-runs-test-location-from-the-callers-frame.md +63 -0
- data/docs/adr/0028-expose-settings-profiles-as-a-keyword-and-module-functions.md +91 -0
- data/docs/adr/0029-keep-notes-local-and-defer-run-error-kinds.md +72 -0
- data/docs/adr/0030-represent-a-duration-as-integer-nanoseconds.md +48 -0
- data/docs/adr/0031-take-the-alphabet-options-from-hegel-rust.md +52 -0
- data/docs/adr/0032-suppress-span-closes-while-an-abandoned-recursion-attempt-unwinds.md +147 -0
- data/docs/adr/0033-cache-compiled-grammars-for-the-length-of-a-run.md +80 -0
- data/docs/adr/0034-repeat-a-test-body-with-a-ruby-side-indent.md +120 -0
- data/docs/adr/0035-defer-concurrent-state-machines-and-the-engine-printer.md +136 -0
- data/docs/architecture.md +33 -11
- data/lib/hegel/errors.rb +24 -0
- data/lib/hegel/generator.rb +52 -25
- data/lib/hegel/generators.rb +715 -45
- data/lib/hegel/grammar_cache.rb +36 -0
- data/lib/hegel/lib_hegel/real.rb +455 -120
- data/lib/hegel/lib_hegel.rb +33 -8
- data/lib/hegel/libhegel/libhegel-linux-arm64.so +0 -0
- data/lib/hegel/libhegel_version.rb +1 -1
- data/lib/hegel/locate.rb +10 -10
- data/lib/hegel/report.rb +13 -10
- data/lib/hegel/runner.rb +61 -27
- data/lib/hegel/settings.rb +92 -16
- data/lib/hegel/state_machine.rb +17 -4
- data/lib/hegel/stateful/pool.rb +52 -0
- data/lib/hegel/stateful.rb +2 -2
- data/lib/hegel/syntax/methods.rb +99 -15
- data/lib/hegel/test_case.rb +256 -35
- data/lib/hegel/test_location.rb +49 -0
- data/lib/hegel/version.rb +1 -1
- data/lib/hegel.rb +21 -5
- data/lib/tasks/libhegel.rake +17 -5
- data/lib/tasks/platform_gems.rake +3 -3
- data/sig/hegel.rbs +296 -43
- data/skills/hegel-ruby/references/ruby/reference.md +465 -43
- metadata +15 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hegel
|
|
4
|
+
# The grammars compiled during one run, keyed by everything the
|
|
5
|
+
# compilation read. Hegel::Runner.run owns one and frees it after the run
|
|
6
|
+
# and before the context; see docs/adr/0033.
|
|
7
|
+
class GrammarCache
|
|
8
|
+
# A compiled grammar handle and the marker standing for each explicit
|
|
9
|
+
# terminal, in the order the terminals were named.
|
|
10
|
+
Compiled = Data.define(:grammar, :markers)
|
|
11
|
+
|
|
12
|
+
def initialize
|
|
13
|
+
@entries = {}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# The entry under +key+, or the block's value, stored only once the
|
|
17
|
+
# block returns, so a compilation that raises leaves nothing behind.
|
|
18
|
+
def fetch(key)
|
|
19
|
+
@entries.fetch(key) { @entries[key] = yield }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Frees every grammar, carrying on past a free that raises so that the
|
|
23
|
+
# rest are still freed before the context, and raises the first error
|
|
24
|
+
# once all have been tried.
|
|
25
|
+
def free_all(impl, ctx)
|
|
26
|
+
error = nil
|
|
27
|
+
@entries.each_value do |compiled|
|
|
28
|
+
impl.grammar_free(ctx, compiled.grammar)
|
|
29
|
+
rescue => e
|
|
30
|
+
error ||= e
|
|
31
|
+
end
|
|
32
|
+
@entries.clear
|
|
33
|
+
raise error if error
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|