ibex 0.3.0 → 0.4.0

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.
@@ -0,0 +1,28 @@
1
+ # Generated from lib/ibex/impact/coverage_impact.rb with RBS::Inline
2
+
3
+ module Ibex
4
+ module Impact
5
+ # Selects separated runtime coverage reports for affected productions.
6
+ class CoverageImpact
7
+ attr_reader status: String
8
+
9
+ attr_reader reports: Array[Hash[Symbol, Object?]]
10
+
11
+ attr_reader warnings: Array[String]
12
+
13
+ # @rbs (IR::Automaton automaton, Array[Integer], Array[[String, Coverage::Report]]) -> void
14
+ def initialize: (IR::Automaton automaton, Array[Integer], Array[[ String, Coverage::Report ]]) -> void
15
+
16
+ # @rbs () -> Hash[Symbol, Object?]
17
+ def to_h: () -> Hash[Symbol, Object?]
18
+
19
+ private
20
+
21
+ # @rbs (Array[[String, Coverage::Report]]) -> Array[Hash[Symbol, Object?]]
22
+ def select_reports: (Array[[ String, Coverage::Report ]]) -> Array[Hash[Symbol, Object?]]
23
+
24
+ # @rbs (Array[[String, Coverage::Report]]) -> String
25
+ def coverage_status: (Array[[ String, Coverage::Report ]]) -> String
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,67 @@
1
+ # Generated from lib/ibex/impact/graph.rb with RBS::Inline
2
+
3
+ module Ibex
4
+ module Impact
5
+ # A grammar dependency edge with enough origin information for a witness.
6
+ class Edge
7
+ attr_reader source: Integer
8
+
9
+ attr_reader target: Integer
10
+
11
+ attr_reader kind: Symbol
12
+
13
+ attr_reader production: Integer?
14
+
15
+ attr_reader position: Integer?
16
+
17
+ # @rbs (source: Integer, target: Integer, kind: Symbol, production: Integer?, position: Integer?) -> void
18
+ def initialize: (source: Integer, target: Integer, kind: Symbol, production: Integer?, position: Integer?) -> void
19
+
20
+ # @rbs () -> Array[Integer | Symbol | nil]
21
+ def sort_key: () -> Array[Integer | Symbol | nil]
22
+ end
23
+
24
+ # Combines reference, FIRST, and FOLLOW propagation dependencies.
25
+ class Graph
26
+ EDGE_KINDS: Array[Symbol]
27
+
28
+ KIND_ALIASES: Hash[Symbol, Array[Symbol]]
29
+
30
+ attr_reader grammar: IR::Grammar
31
+
32
+ attr_reader sets: Analysis::Sets
33
+
34
+ # @rbs (IR::Grammar grammar, ?sets: Analysis::Sets) -> void
35
+ def initialize: (IR::Grammar grammar, ?sets: Analysis::Sets) -> void
36
+
37
+ # @rbs (?Symbol kind) -> untyped
38
+ def edges: (?Symbol kind) -> untyped
39
+
40
+ # @rbs (Symbol kind) -> Array[Array[Integer]]
41
+ def adjacency: (Symbol kind) -> Array[Array[Integer]]
42
+
43
+ private
44
+
45
+ # @rbs () -> Hash[Symbol, Array[Edge]]
46
+ def build_edges: () -> Hash[Symbol, Array[Edge]]
47
+
48
+ # @rbs (Hash[Symbol, Array[Edge]], IR::Production) -> void
49
+ def add_production_edges: (Hash[Symbol, Array[Edge]], IR::Production) -> void
50
+
51
+ # @rbs (Hash[Symbol, Array[Edge]], IR::Production, Integer, Integer) -> void
52
+ def add_first_edge: (Hash[Symbol, Array[Edge]], IR::Production, Integer, Integer) -> void
53
+
54
+ # @rbs (Hash[Symbol, Array[Edge]], IR::Production, Integer, Integer) -> void
55
+ def add_follow_edges: (Hash[Symbol, Array[Edge]], IR::Production, Integer, Integer) -> void
56
+
57
+ # @rbs (Hash[Symbol, Array[Edge]], IR::Production, Integer, Integer) -> void
58
+ def add_follow_first_edges: (Hash[Symbol, Array[Edge]], IR::Production, Integer, Integer) -> void
59
+
60
+ # @rbs (Integer source, Integer target, Symbol kind, IR::Production production, Integer position) -> Edge
61
+ def edge: (Integer source, Integer target, Symbol kind, IR::Production production, Integer position) -> Edge
62
+
63
+ # @rbs () -> void
64
+ def freeze_edges: () -> void
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,56 @@
1
+ # Generated from lib/ibex/impact/propagation.rb with RBS::Inline
2
+
3
+ module Ibex
4
+ module Impact
5
+ # One shortest witness for a symbol reached by dependency propagation.
6
+ class Node
7
+ attr_reader symbol: Integer
8
+
9
+ attr_reader distance: Integer
10
+
11
+ attr_reader witness: Array[Edge]
12
+
13
+ attr_reader kind: Symbol
14
+
15
+ attr_reader component: Array[Integer]
16
+
17
+ # @rbs (symbol: Integer, distance: Integer, witness: Array[Edge], kind: Symbol, component: Array[Integer]) -> void
18
+ def initialize: (symbol: Integer, distance: Integer, witness: Array[Edge], kind: Symbol, component: Array[Integer]) -> void
19
+ end
20
+
21
+ # Performs deterministic forward propagation over a dependency graph.
22
+ class Propagation
23
+ # @rbs @graph: Graph
24
+ # @rbs (Graph graph) -> void
25
+ def initialize: (Graph graph) -> void
26
+
27
+ # @rbs (Array[Integer] seeds, Symbol kind, ?max_depth: Integer?) -> Hash[Integer, Node]
28
+ def propagate: (Array[Integer] seeds, Symbol kind, ?max_depth: Integer?) -> Hash[Integer, Node]
29
+
30
+ alias call propagate
31
+
32
+ private
33
+
34
+ # @rbs (Integer?) -> void
35
+ def validate_depth: (Integer?) -> void
36
+
37
+ # @rbs (Array[Integer]) -> Array[Integer]
38
+ def normalize_seeds: (Array[Integer]) -> Array[Integer]
39
+
40
+ # @rbs (Array[Array[Integer]], Integer) -> Array[Integer]
41
+ def component_index: (Array[Array[Integer]], Integer) -> Array[Integer]
42
+
43
+ # @rbs (Array[Array[Integer]], Array[Integer], Integer) -> Array[Array[Integer]]
44
+ def component_adjacency: (Array[Array[Integer]], Array[Integer], Integer) -> Array[Array[Integer]]
45
+
46
+ # @rbs (Array[Integer], Array[Integer], Array[Array[Integer]], Integer?) -> Hash[Integer, Integer]
47
+ def traverse_components: (Array[Integer], Array[Integer], Array[Array[Integer]], Integer?) -> Hash[Integer, Integer]
48
+
49
+ # @rbs (Array[Integer], Array[Array[Integer]], Symbol) -> Hash[Integer, Array[Edge]]
50
+ def symbol_witnesses: (Array[Integer], Array[Array[Integer]], Symbol) -> Hash[Integer, Array[Edge]]
51
+
52
+ # @rbs (Hash[Integer, Integer], Array[Array[Integer]], Symbol, Hash[Integer, Array[Edge]]) -> Hash[Integer, Node]
53
+ def build_nodes: (Hash[Integer, Integer], Array[Array[Integer]], Symbol, Hash[Integer, Array[Edge]]) -> Hash[Integer, Node]
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,107 @@
1
+ # Generated from lib/ibex/impact/report.rb with RBS::Inline
2
+
3
+ module Ibex
4
+ module Impact
5
+ # Builds the deterministic public impact-v1 document.
6
+ class Report
7
+ # @rbs @mode: String
8
+ # @rbs @algorithm: String
9
+ # @rbs @grammar: IR::Grammar
10
+ # @rbs @before: IR::Automaton?
11
+ # @rbs @after: IR::Automaton?
12
+ # @rbs @seeds: Array[Hash[Symbol, Object?]]
13
+ # @rbs @nodes: Hash[Integer, Node]
14
+ # @rbs @symbol_kinds: Hash[Integer, Array[String]]
15
+ # @rbs @set_changes: Hash[String, Hash[Symbol, Object?]]
16
+ # @rbs @metadata_names: Array[String]
17
+ # @rbs @automaton: Hash[Symbol, Object?]
18
+ # @rbs @actions: Array[Hash[Symbol, Object?]]
19
+ # @rbs @coverage: Hash[Symbol, Object?]
20
+ # @rbs @minimum: String
21
+ # @rbs @warnings: Array[String]
22
+ # @rbs (mode: String, algorithm: String, grammar: IR::Grammar, before: IR::Automaton?, after: IR::Automaton?,
23
+ # seeds: Array[Hash[Symbol, Object?]], nodes: Hash[Integer, Node], symbol_kinds: Hash[Integer, Array[String]],
24
+ # set_changes: Hash[String, Hash[Symbol, Object?]], automaton: Hash[Symbol, Object?],
25
+ # actions: Array[Hash[Symbol, Object?]], coverage: Hash[Symbol, Object?], ?metadata_names: Array[String],
26
+ # ?minimum: String,
27
+ # ?warnings: Array[String]) -> void
28
+ # rubocop:disable Metrics/ParameterLists
29
+ def initialize: (mode: String, algorithm: String, grammar: IR::Grammar, before: IR::Automaton?, after: IR::Automaton?, seeds: Array[Hash[Symbol, Object?]], nodes: Hash[Integer, Node], symbol_kinds: Hash[Integer, Array[String]], set_changes: Hash[String, Hash[Symbol, Object?]], automaton: Hash[Symbol, Object?], actions: Array[Hash[Symbol, Object?]], coverage: Hash[Symbol, Object?], ?metadata_names: Array[String], ?minimum: String, ?warnings: Array[String]) -> void
30
+
31
+ # @rbs (?minimum: String) -> Hash[Symbol, Object?]
32
+ def to_h: (?minimum: String) -> Hash[Symbol, Object?]
33
+
34
+ private
35
+
36
+ # @rbs (String minimum) -> Array[Hash[Symbol, Object?]]
37
+ def symbol_documents: (String minimum) -> Array[Hash[Symbol, Object?]]
38
+
39
+ # @rbs (String) -> Hash[Symbol, Object?]?
40
+ def symbol_document: (String) -> Hash[Symbol, Object?]?
41
+
42
+ # @rbs (String) -> bool
43
+ def reportable_symbol?: (String) -> bool
44
+
45
+ # @rbs (String, Integer?) -> Array[String]
46
+ def symbol_kinds_for: (String, Integer?) -> Array[String]
47
+
48
+ # @rbs (String) -> Array[String]
49
+ def change_kinds: (String) -> Array[String]
50
+
51
+ # @rbs (String, Array[String]) -> String
52
+ def document_severity: (String, Array[String]) -> String
53
+
54
+ # @rbs (Node?, String) -> Array[String]
55
+ def component_names: (Node?, String) -> Array[String]
56
+
57
+ # @rbs (String kind) -> String
58
+ def kind_severity: (String kind) -> String
59
+
60
+ # @rbs (String name, String current) -> String
61
+ def action_severity: (String name, String current) -> String
62
+
63
+ # @rbs (Hash[Symbol, Object?] record) -> String
64
+ def severity_of: (Hash[Symbol, Object?] record) -> String
65
+
66
+ # @rbs () -> Hash[Symbol, Array[String]]
67
+ def empty_change: () -> Hash[Symbol, Array[String]]
68
+
69
+ # @rbs (Array[Edge]) -> Array[Hash[Symbol, Object?]]
70
+ def witness_documents: (Array[Edge]) -> Array[Hash[Symbol, Object?]]
71
+
72
+ # @rbs (Integer) -> String
73
+ def symbol_name: (Integer) -> String
74
+
75
+ # @rbs (IR::Production?) -> String?
76
+ def production_shape: (IR::Production?) -> String?
77
+
78
+ # @rbs (Array[Hash[Symbol, Object?]], Array[Hash[Symbol, Object?]],
79
+ # Hash[Symbol, Object?]) -> Hash[Symbol, Integer]
80
+ def totals: (Array[Hash[Symbol, Object?]], Array[Hash[Symbol, Object?]], Hash[Symbol, Object?]) -> Hash[Symbol, Integer]
81
+
82
+ # @rbs (String minimum) -> Array[Hash[Symbol, Object?]]
83
+ def action_documents: (String minimum) -> Array[Hash[Symbol, Object?]]
84
+
85
+ # @rbs (Hash[Symbol, Object?] action) -> String
86
+ def action_production: (Hash[Symbol, Object?] action) -> String
87
+
88
+ # @rbs () -> Hash[Symbol, Object?]
89
+ def coverage_document: () -> Hash[Symbol, Object?]
90
+
91
+ # @rbs (Hash[Symbol, Object?] report) -> String
92
+ def coverage_report_path: (Hash[Symbol, Object?] report) -> String
93
+
94
+ # @rbs () -> Array[String]
95
+ def stable_warnings: () -> Array[String]
96
+
97
+ # @rbs (IR::location?) -> Hash[Symbol, Integer]?
98
+ def stable_location: (IR::location?) -> Hash[Symbol, Integer]?
99
+
100
+ # @rbs (IR::Automaton?) -> String?
101
+ def stable_grammar_digest: (IR::Automaton?) -> String?
102
+
103
+ # @rbs (String) -> String
104
+ def stable_path: (String) -> String
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,36 @@
1
+ # Generated from lib/ibex/impact/seeds.rb with RBS::Inline
2
+
3
+ module Ibex
4
+ module Impact
5
+ # Converts command-line symbols and Diff rule ids into analysis seeds.
6
+ class Seeds
7
+ # @rbs @grammar: IR::Grammar
8
+ # @rbs @sets: Analysis::Sets
9
+ # @rbs @records: Array[Hash[Symbol, Object?]]
10
+ # @rbs @ids: Array[Integer]
11
+ attr_reader ids: Array[Integer]
12
+
13
+ attr_reader records: Array[Hash[Symbol, Object?]]
14
+
15
+ # @rbs (IR::Grammar grammar, Array[String] names, ?origin: String) -> void
16
+ def initialize: (IR::Grammar grammar, Array[String] names, ?origin: String) -> void
17
+
18
+ # @rbs (IR::Grammar grammar, Hash[Symbol, Object?] diff, ?origin: String) -> Seeds
19
+ def self.from_diff: (IR::Grammar grammar, Hash[Symbol, Object?] diff, ?origin: String) -> Seeds
20
+
21
+ private
22
+
23
+ # @rbs (Hash[Symbol, Object?] record) -> String
24
+ def seed_symbol: (Hash[Symbol, Object?] record) -> String
25
+
26
+ # @rbs (Hash[Symbol, Object?] record) -> Integer
27
+ def seed_id: (Hash[Symbol, Object?] record) -> Integer
28
+
29
+ # @rbs (String name, String origin) -> Array[Hash[Symbol, Object?]]
30
+ def resolve: (String name, String origin) -> Array[Hash[Symbol, Object?]]
31
+
32
+ # @rbs (Integer) -> bool
33
+ def nullable_boundary?: (Integer) -> bool
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,55 @@
1
+ # Generated from lib/ibex/impact/severity.rb with RBS::Inline
2
+
3
+ module Ibex
4
+ module Impact
5
+ # Stores only conflict identities so a baseline is stable across state ids.
6
+ class Baseline
7
+ # @rbs (String path) -> void
8
+ def initialize: (String path) -> void
9
+
10
+ # @rbs () -> Array[String]
11
+ def conflicts: () -> Array[String]
12
+
13
+ # @rbs (Object?) -> void
14
+ def validate_document: (Object?) -> void
15
+
16
+ # @rbs (Array[String] identities) -> void
17
+ def write: (Array[String] identities) -> void
18
+ end
19
+
20
+ # Severity ranking and CI gate evaluation for impact findings.
21
+ module Severity
22
+ LEVELS: Array[String]
23
+
24
+ FAIL_ON: Array[String]
25
+
26
+ RANK: Hash[String, Integer]
27
+
28
+ GATE_TO_KIND: Hash[String, String]
29
+
30
+ # @rbs (String left, String right) -> String
31
+ def self?.max: (String left, String right) -> String
32
+
33
+ # @rbs (Hash[String, Array[String]], Array[Hash[Symbol, String]]) -> Hash[String, String]
34
+ def self?.symbols: (Hash[String, Array[String]], Array[Hash[Symbol, String]]) -> Hash[String, String]
35
+
36
+ # @rbs (String) -> String
37
+ def self?.level_for_kind: (String) -> String
38
+
39
+ # @rbs (Hash[Symbol, Object?] report, Array[String] gates) -> bool
40
+ def self?.fails?: (Hash[Symbol, Object?] report, Array[String] gates) -> bool
41
+
42
+ # @rbs (Hash[Symbol, Object?], Array[String]) -> bool
43
+ def self?.conflict_gate?: (Hash[Symbol, Object?], Array[String]) -> bool
44
+
45
+ # @rbs (Hash[Symbol, Object?], Array[String]) -> bool
46
+ def self?.unreachable_gate?: (Hash[Symbol, Object?], Array[String]) -> bool
47
+
48
+ # @rbs (Hash[Symbol, Object?], Array[String]) -> bool
49
+ def self?.action_gate?: (Hash[Symbol, Object?], Array[String]) -> bool
50
+
51
+ # @rbs (Array[String] gates) -> Array[String]
52
+ def self?.validate_gates: (Array[String] gates) -> Array[String]
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,6 @@
1
+ # Generated from lib/ibex/impact.rb with RBS::Inline
2
+
3
+ module Ibex
4
+ module Impact
5
+ end
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yudai Takada
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.3.0
18
+ version: 0.4.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.3.0
25
+ version: 0.4.0
26
26
  description: Ibex generates LR parsers from racc-compatible grammars without native
27
27
  extensions.
28
28
  email:
@@ -86,6 +86,7 @@ files:
86
86
  - docs/grammar-reference.md
87
87
  - docs/ielr-design.md
88
88
  - docs/ielr.md
89
+ - docs/impact.md
89
90
  - docs/ja/bison-import.md
90
91
  - docs/ja/stable-api.md
91
92
  - docs/lexer-construction-profile.md
@@ -141,6 +142,7 @@ files:
141
142
  - lib/ibex/cli/generation_artifacts.rb
142
143
  - lib/ibex/cli/generation_error_messages.rb
143
144
  - lib/ibex/cli/grammar_tests.rb
145
+ - lib/ibex/cli/impact.rb
144
146
  - lib/ibex/cli/ir_tools.rb
145
147
  - lib/ibex/cli/lsp.rb
146
148
  - lib/ibex/cli/outputs.rb
@@ -237,6 +239,15 @@ files:
237
239
  - lib/ibex/generation_transaction_recovery.rb
238
240
  - lib/ibex/generation_transaction_validation.rb
239
241
  - lib/ibex/grammar_tests.rb
242
+ - lib/ibex/impact.rb
243
+ - lib/ibex/impact/action_impact.rb
244
+ - lib/ibex/impact/automaton_impact.rb
245
+ - lib/ibex/impact/coverage_impact.rb
246
+ - lib/ibex/impact/graph.rb
247
+ - lib/ibex/impact/propagation.rb
248
+ - lib/ibex/impact/report.rb
249
+ - lib/ibex/impact/seeds.rb
250
+ - lib/ibex/impact/severity.rb
240
251
  - lib/ibex/ir.rb
241
252
  - lib/ibex/ir/automaton_ir.rb
242
253
  - lib/ibex/ir/grammar_ir.rb
@@ -382,6 +393,7 @@ files:
382
393
  - schema/grammar-ir-foundation.schema.json
383
394
  - schema/grammar-ir.schema.json
384
395
  - schema/ielr-benchmark-v1.schema.json
396
+ - schema/impact-v1.schema.json
385
397
  - schema/lexer-ir-v1.schema.json
386
398
  - schema/lexer-profile-v1.schema.json
387
399
  - schema/metrics-v1.schema.json
@@ -426,6 +438,7 @@ files:
426
438
  - sig/ibex/cli/generation_artifacts.rbs
427
439
  - sig/ibex/cli/generation_error_messages.rbs
428
440
  - sig/ibex/cli/grammar_tests.rbs
441
+ - sig/ibex/cli/impact.rbs
429
442
  - sig/ibex/cli/ir_tools.rbs
430
443
  - sig/ibex/cli/lsp.rbs
431
444
  - sig/ibex/cli/outputs.rbs
@@ -522,6 +535,15 @@ files:
522
535
  - sig/ibex/generation_transaction_recovery.rbs
523
536
  - sig/ibex/generation_transaction_validation.rbs
524
537
  - sig/ibex/grammar_tests.rbs
538
+ - sig/ibex/impact.rbs
539
+ - sig/ibex/impact/action_impact.rbs
540
+ - sig/ibex/impact/automaton_impact.rbs
541
+ - sig/ibex/impact/coverage_impact.rbs
542
+ - sig/ibex/impact/graph.rbs
543
+ - sig/ibex/impact/propagation.rbs
544
+ - sig/ibex/impact/report.rbs
545
+ - sig/ibex/impact/seeds.rbs
546
+ - sig/ibex/impact/severity.rbs
525
547
  - sig/ibex/ir.rbs
526
548
  - sig/ibex/ir/automaton_ir.rbs
527
549
  - sig/ibex/ir/grammar_ir.rbs