lrama 0.6.10 → 0.6.11
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/.github/workflows/test.yaml +5 -1
- data/Gemfile +2 -2
- data/NEWS.md +65 -30
- data/Steepfile +3 -0
- data/doc/development/compressed_state_table/main.md +635 -0
- data/doc/development/compressed_state_table/parse.output +174 -0
- data/doc/development/compressed_state_table/parse.y +22 -0
- data/doc/development/compressed_state_table/parser.rb +282 -0
- data/lib/lrama/bitmap.rb +1 -1
- data/lib/lrama/context.rb +3 -3
- data/lib/lrama/counterexamples/derivation.rb +6 -5
- data/lib/lrama/counterexamples/example.rb +7 -4
- data/lib/lrama/counterexamples/path.rb +4 -0
- data/lib/lrama/counterexamples.rb +19 -9
- data/lib/lrama/grammar/parameterizing_rule/rhs.rb +1 -1
- data/lib/lrama/grammar/rule_builder.rb +1 -1
- data/lib/lrama/grammar/symbols/resolver.rb +4 -0
- data/lib/lrama/grammar.rb +2 -2
- data/lib/lrama/lexer/token/user_code.rb +1 -1
- data/lib/lrama/lexer.rb +1 -0
- data/lib/lrama/parser.rb +520 -487
- data/lib/lrama/state/reduce.rb +2 -3
- data/lib/lrama/version.rb +1 -1
- data/parser.y +38 -27
- data/rbs_collection.lock.yaml +10 -2
- data/sig/lrama/counterexamples/derivation.rbs +33 -0
- data/sig/lrama/counterexamples/example.rbs +45 -0
- data/sig/lrama/counterexamples/path.rbs +21 -0
- data/sig/lrama/counterexamples/production_path.rbs +11 -0
- data/sig/lrama/counterexamples/start_path.rbs +13 -0
- data/sig/lrama/counterexamples/state_item.rbs +10 -0
- data/sig/lrama/counterexamples/transition_path.rbs +11 -0
- data/sig/lrama/counterexamples/triple.rbs +20 -0
- data/sig/lrama/counterexamples.rbs +29 -0
- data/sig/lrama/grammar/symbol.rbs +1 -1
- data/sig/lrama/grammar/symbols/resolver.rbs +3 -3
- data/sig/lrama/grammar.rbs +13 -0
- data/sig/lrama/state/reduce_reduce_conflict.rbs +2 -2
- data/sig/lrama/state.rbs +79 -0
- data/sig/lrama/states.rbs +101 -0
- metadata +17 -2
data/lib/lrama/state/reduce.rb
CHANGED
data/lib/lrama/version.rb
CHANGED
data/parser.y
CHANGED
@@ -61,26 +61,26 @@ rule
|
|
61
61
|
| symbol_declaration
|
62
62
|
| rule_declaration
|
63
63
|
| inline_declaration
|
64
|
-
| "%destructor" param
|
64
|
+
| "%destructor" param (symbol | TAG)+
|
65
65
|
{
|
66
66
|
@grammar.add_destructor(
|
67
|
-
ident_or_tags: val[2],
|
67
|
+
ident_or_tags: val[2].flatten,
|
68
68
|
token_code: val[1],
|
69
69
|
lineno: val[1].line
|
70
70
|
)
|
71
71
|
}
|
72
|
-
| "%printer" param
|
72
|
+
| "%printer" param (symbol | TAG)+
|
73
73
|
{
|
74
74
|
@grammar.add_printer(
|
75
|
-
ident_or_tags: val[2],
|
75
|
+
ident_or_tags: val[2].flatten,
|
76
76
|
token_code: val[1],
|
77
77
|
lineno: val[1].line
|
78
78
|
)
|
79
79
|
}
|
80
|
-
| "%error-token" param
|
80
|
+
| "%error-token" param (symbol | TAG)+
|
81
81
|
{
|
82
82
|
@grammar.add_error_token(
|
83
|
-
ident_or_tags: val[2],
|
83
|
+
ident_or_tags: val[2].flatten,
|
84
84
|
token_code: val[1],
|
85
85
|
lineno: val[1].line
|
86
86
|
)
|
@@ -115,6 +115,18 @@ rule
|
|
115
115
|
}
|
116
116
|
}
|
117
117
|
}
|
118
|
+
| "%nterm" symbol_declarations
|
119
|
+
{
|
120
|
+
val[1].each {|hash|
|
121
|
+
hash[:tokens].each {|id|
|
122
|
+
if @grammar.find_term_by_s_value(id.s_value)
|
123
|
+
on_action_error("symbol #{id.s_value} redeclared as a nonterminal", id)
|
124
|
+
else
|
125
|
+
@grammar.add_type(id: id, tag: hash[:tag])
|
126
|
+
end
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
118
130
|
| "%left" token_declarations_for_precedence
|
119
131
|
{
|
120
132
|
val[1].each {|hash|
|
@@ -156,13 +168,7 @@ rule
|
|
156
168
|
@precedence_number += 1
|
157
169
|
}
|
158
170
|
|
159
|
-
token_declarations: token_declaration+
|
160
|
-
{
|
161
|
-
val[0].each {|token_declaration|
|
162
|
-
@grammar.add_term(id: token_declaration[0], alias_name: token_declaration[2], token_id: token_declaration[1], tag: nil, replace: true)
|
163
|
-
}
|
164
|
-
}
|
165
|
-
| TAG token_declaration+
|
171
|
+
token_declarations: TAG? token_declaration+
|
166
172
|
{
|
167
173
|
val[1].each {|token_declaration|
|
168
174
|
@grammar.add_term(id: token_declaration[0], alias_name: token_declaration[2], token_id: token_declaration[1], tag: val[0], replace: true)
|
@@ -208,7 +214,7 @@ rule
|
|
208
214
|
result = val[0].append(builder)
|
209
215
|
}
|
210
216
|
|
211
|
-
rule_rhs: empty
|
217
|
+
rule_rhs: "%empty"?
|
212
218
|
{
|
213
219
|
reset_precs
|
214
220
|
result = Grammar::ParameterizingRule::Rhs.new
|
@@ -250,11 +256,16 @@ rule
|
|
250
256
|
result = builder
|
251
257
|
}
|
252
258
|
|
253
|
-
alias:
|
254
|
-
| string_as_id { result = val[0].s_value }
|
259
|
+
alias: string_as_id? { result = val[0].s_value if val[0] }
|
255
260
|
|
256
|
-
symbol_declarations: symbol+
|
257
|
-
|
261
|
+
symbol_declarations: TAG? symbol+
|
262
|
+
{
|
263
|
+
result = if val[0]
|
264
|
+
[{tag: val[0], tokens: val[1]}]
|
265
|
+
else
|
266
|
+
[{tag: nil, tokens: val[1]}]
|
267
|
+
end
|
268
|
+
}
|
258
269
|
| symbol_declarations TAG symbol+ { result = val[0].append({tag: val[1], tokens: val[2]}) }
|
259
270
|
|
260
271
|
symbol: id
|
@@ -311,7 +322,7 @@ rule
|
|
311
322
|
result = val[0].append(builder)
|
312
323
|
}
|
313
324
|
|
314
|
-
rhs: empty
|
325
|
+
rhs: "%empty"?
|
315
326
|
{
|
316
327
|
reset_precs
|
317
328
|
result = @grammar.create_rule_builder(@rule_counter, @midrule_action_counter)
|
@@ -362,9 +373,15 @@ rule
|
|
362
373
|
| "+" { result = "nonempty_list" }
|
363
374
|
| "*" { result = "list" }
|
364
375
|
|
365
|
-
parameterizing_args: symbol
|
376
|
+
parameterizing_args: symbol parameterizing_suffix?
|
377
|
+
{
|
378
|
+
result = if val[1]
|
379
|
+
[Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[0])]
|
380
|
+
else
|
381
|
+
[val[0]]
|
382
|
+
end
|
383
|
+
}
|
366
384
|
| parameterizing_args ',' symbol { result = val[0].append(val[2]) }
|
367
|
-
| symbol parameterizing_suffix { result = [Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[0])] }
|
368
385
|
| IDENTIFIER "(" parameterizing_args ")" { result = [Lrama::Lexer::Token::InstantiateRule.new(s_value: val[0].s_value, location: @lexer.location, args: val[2])] }
|
369
386
|
|
370
387
|
midrule_action: "{"
|
@@ -404,12 +421,6 @@ rule
|
|
404
421
|
| STRING
|
405
422
|
| "{...}"
|
406
423
|
|
407
|
-
generic_symbol: symbol
|
408
|
-
| TAG
|
409
|
-
|
410
|
-
empty: /* empty */
|
411
|
-
| "%empty"
|
412
|
-
|
413
424
|
string_as_id: STRING { result = Lrama::Lexer::Token::Ident.new(s_value: val[0]) }
|
414
425
|
end
|
415
426
|
|
data/rbs_collection.lock.yaml
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
---
|
2
2
|
path: ".gem_rbs_collection"
|
3
3
|
gems:
|
4
|
+
- name: diff-lcs
|
5
|
+
version: '1.5'
|
6
|
+
source:
|
7
|
+
type: git
|
8
|
+
name: ruby/gem_rbs_collection
|
9
|
+
revision: 71fb7ae83789ae150bdee1cd8a7cd3035b5d79e2
|
10
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
11
|
+
repo_dir: gems
|
4
12
|
- name: erb
|
5
13
|
version: '0'
|
6
14
|
source:
|
@@ -18,7 +26,7 @@ gems:
|
|
18
26
|
source:
|
19
27
|
type: git
|
20
28
|
name: ruby/gem_rbs_collection
|
21
|
-
revision:
|
29
|
+
revision: 71fb7ae83789ae150bdee1cd8a7cd3035b5d79e2
|
22
30
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
23
31
|
repo_dir: gems
|
24
32
|
- name: stackprof
|
@@ -26,7 +34,7 @@ gems:
|
|
26
34
|
source:
|
27
35
|
type: git
|
28
36
|
name: ruby/gem_rbs_collection
|
29
|
-
revision:
|
37
|
+
revision: 71fb7ae83789ae150bdee1cd8a7cd3035b5d79e2
|
30
38
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
31
39
|
repo_dir: gems
|
32
40
|
- name: strscan
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Counterexamples
|
3
|
+
class Derivation
|
4
|
+
@item: States::Item
|
5
|
+
|
6
|
+
@left: Derivation?
|
7
|
+
|
8
|
+
@right: Derivation?
|
9
|
+
|
10
|
+
attr_reader item: States::Item
|
11
|
+
|
12
|
+
attr_reader left: Derivation?
|
13
|
+
|
14
|
+
attr_reader right: Derivation?
|
15
|
+
|
16
|
+
attr_writer right: Derivation?
|
17
|
+
|
18
|
+
def initialize: (States::Item item, Derivation? left, ?Derivation? right) -> void
|
19
|
+
|
20
|
+
def to_s: () -> ::String
|
21
|
+
|
22
|
+
alias inspect to_s
|
23
|
+
|
24
|
+
def render_strings_for_report: () -> Array[String]
|
25
|
+
|
26
|
+
def render_for_report: () -> String
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def _render_for_report: (Derivation derivation, Integer offset, Array[String] strings, Integer index) -> Integer
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Counterexamples
|
3
|
+
class Example
|
4
|
+
@path1: ::Array[StartPath | TransitionPath | ProductionPath]
|
5
|
+
|
6
|
+
@path2: ::Array[StartPath | TransitionPath | ProductionPath]
|
7
|
+
|
8
|
+
@conflict: (State::ShiftReduceConflict | State::ReduceReduceConflict)
|
9
|
+
|
10
|
+
@conflict_symbol: Grammar::Symbol
|
11
|
+
|
12
|
+
@counterexamples: Counterexamples
|
13
|
+
|
14
|
+
@derivations1: Derivation
|
15
|
+
|
16
|
+
@derivations2: Derivation
|
17
|
+
|
18
|
+
attr_reader path1: ::Array[StartPath | TransitionPath | ProductionPath]
|
19
|
+
|
20
|
+
attr_reader path2: ::Array[StartPath | TransitionPath | ProductionPath]
|
21
|
+
|
22
|
+
attr_reader conflict: (State::ShiftReduceConflict | State::ReduceReduceConflict)
|
23
|
+
|
24
|
+
attr_reader conflict_symbol: Grammar::Symbol
|
25
|
+
|
26
|
+
def initialize: (::Array[StartPath | TransitionPath | ProductionPath]? path1, ::Array[StartPath | TransitionPath | ProductionPath]? path2, (State::ShiftReduceConflict | State::ReduceReduceConflict) conflict, Grammar::Symbol conflict_symbol, Counterexamples counterexamples) -> void
|
27
|
+
|
28
|
+
def type: () -> (:shift_reduce | :reduce_reduce)
|
29
|
+
|
30
|
+
def path1_item: () -> States::Item
|
31
|
+
|
32
|
+
def path2_item: () -> States::Item
|
33
|
+
|
34
|
+
def derivations1: () -> Derivation
|
35
|
+
|
36
|
+
def derivations2: () -> Derivation
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def _derivations: (::Array[StartPath | TransitionPath | ProductionPath] paths) -> Derivation
|
41
|
+
|
42
|
+
def find_derivation_for_symbol: (StateItem state_item, Grammar::Symbol sym) -> Derivation?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Counterexamples
|
3
|
+
class Path
|
4
|
+
@from_state_item: StateItem?
|
5
|
+
|
6
|
+
@to_state_item: StateItem
|
7
|
+
|
8
|
+
def initialize: (StateItem? from_state_item, StateItem to_state_item) -> void
|
9
|
+
|
10
|
+
def from: () -> StateItem?
|
11
|
+
|
12
|
+
def to: () -> StateItem
|
13
|
+
|
14
|
+
def to_s: () -> ::String
|
15
|
+
|
16
|
+
alias inspect to_s
|
17
|
+
|
18
|
+
def type: -> bot
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Counterexamples
|
3
|
+
class Triple
|
4
|
+
attr_accessor s: State
|
5
|
+
attr_accessor itm: States::Item
|
6
|
+
attr_accessor l: Set[Grammar::Symbol]
|
7
|
+
|
8
|
+
alias state s
|
9
|
+
alias item itm
|
10
|
+
alias precise_lookahead_set l
|
11
|
+
|
12
|
+
def initialize: (State s, States::Item itm, Set[Grammar::Symbol] l) -> void
|
13
|
+
|
14
|
+
def state_item: () -> StateItem
|
15
|
+
def inspect: () -> ::String
|
16
|
+
|
17
|
+
alias to_s inspect
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Counterexamples
|
3
|
+
@states: States
|
4
|
+
@transitions: Hash[[StateItem, Grammar::Symbol], StateItem]
|
5
|
+
@reverse_transitions: Hash[[StateItem, Grammar::Symbol], Set[StateItem]]
|
6
|
+
@productions: Hash[StateItem, Set[States::Item]]
|
7
|
+
@reverse_productions: Hash[[State, Grammar::Symbol], Set[States::Item]]
|
8
|
+
|
9
|
+
attr_reader transitions: Hash[[StateItem, Grammar::Symbol], StateItem]
|
10
|
+
attr_reader productions: Hash[StateItem, Set[States::Item]]
|
11
|
+
|
12
|
+
def initialize: (States states) -> void
|
13
|
+
def to_s: () -> "#<Counterexamples>"
|
14
|
+
alias inspect to_s
|
15
|
+
def compute: (State conflict_state) -> Array[Example]
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def setup_transitions: () -> void
|
20
|
+
def setup_productions: () -> void
|
21
|
+
def shift_reduce_example: (State conflict_state, State::ShiftReduceConflict conflict) -> Example
|
22
|
+
def reduce_reduce_examples: (State conflict_state, State::ReduceReduceConflict conflict) -> Example
|
23
|
+
def find_shift_conflict_shortest_path: (::Array[StartPath|TransitionPath|ProductionPath]? reduce_path, State conflict_state, States::Item conflict_item) -> ::Array[StartPath|TransitionPath|ProductionPath]
|
24
|
+
def find_shift_conflict_shortest_state_items: (::Array[StartPath|TransitionPath|ProductionPath]? reduce_path, State conflict_state, States::Item conflict_item) -> Array[StateItem]
|
25
|
+
def build_paths_from_state_items: (Array[StateItem] state_items) -> ::Array[StartPath|TransitionPath|ProductionPath]
|
26
|
+
def shortest_path: (State conflict_state, States::Item conflict_reduce_item, Grammar::Symbol conflict_term) -> ::Array[StartPath|TransitionPath|ProductionPath]?
|
27
|
+
def follow_l: (States::Item item, Set[Grammar::Symbol] current_l) -> Set[Grammar::Symbol]
|
28
|
+
end
|
29
|
+
end
|
@@ -13,7 +13,7 @@ module Lrama
|
|
13
13
|
attr_accessor destructor: Destructor?
|
14
14
|
attr_accessor error_token: ErrorToken
|
15
15
|
|
16
|
-
attr_accessor first_set: Set[
|
16
|
+
attr_accessor first_set: Set[Grammar::Symbol]
|
17
17
|
attr_accessor first_set_bitmap: Integer
|
18
18
|
attr_writer eof_symbol: bool
|
19
19
|
attr_writer error_symbol: bool
|
@@ -14,8 +14,8 @@ module Lrama
|
|
14
14
|
def sort_by_number!: () -> Array[Grammar::Symbol]
|
15
15
|
def add_term: (id: Lexer::Token, ?alias_name: String?, ?tag: Lexer::Token::Tag?, ?token_id: Integer?, ?replace: bool) -> Grammar::Symbol
|
16
16
|
def add_nterm: (id: Lexer::Token, ?alias_name: String?, ?tag: Lexer::Token::Tag?) -> Grammar::Symbol
|
17
|
-
def find_symbol_by_s_value: (
|
18
|
-
def find_symbol_by_s_value!: (
|
17
|
+
def find_symbol_by_s_value: (::String s_value) -> Grammar::Symbol?
|
18
|
+
def find_symbol_by_s_value!: (::String s_value) -> Grammar::Symbol
|
19
19
|
def find_symbol_by_id: (Lexer::Token id) -> Grammar::Symbol?
|
20
20
|
def find_symbol_by_id!: (Lexer::Token id) -> Grammar::Symbol
|
21
21
|
def find_symbol_by_token_id: (Integer token_id) -> Grammar::Symbol?
|
@@ -47,7 +47,7 @@ module Lrama
|
|
47
47
|
def find_symbol_by_number!: (Integer number) -> Grammar::Symbol
|
48
48
|
def find_symbol_by_id!: (Lexer::Token id) -> Grammar::Symbol
|
49
49
|
def token_to_symbol: (Lexer::Token token) -> Grammar::Symbol
|
50
|
-
def find_symbol_by_s_value!: (
|
50
|
+
def find_symbol_by_s_value!: (::String s_value) -> Grammar::Symbol
|
51
51
|
def fill_nterm_type: (Array[Grammar::Type] types) -> void
|
52
52
|
def fill_symbol_number: () -> void
|
53
53
|
def fill_printer: (Array[Grammar::Printer] printers) -> void
|
data/sig/lrama/grammar.rbs
CHANGED
@@ -91,5 +91,18 @@ module Lrama
|
|
91
91
|
def fill_sym_to_rules: () -> Array[Rule]
|
92
92
|
def validate_rule_lhs_is_nterm!: () -> void
|
93
93
|
def set_locations: () -> void
|
94
|
+
|
95
|
+
interface _DelegatedMethods
|
96
|
+
def rules: () -> Array[Rule]
|
97
|
+
def accept_symbol: () -> Grammar::Symbol
|
98
|
+
def eof_symbol: () -> Grammar::Symbol
|
99
|
+
def undef_symbol: () -> Grammar::Symbol
|
100
|
+
|
101
|
+
# delegate to @symbols_resolver
|
102
|
+
def symbols: () -> Array[Grammar::Symbol]
|
103
|
+
def terms: () -> Array[Grammar::Symbol]
|
104
|
+
def nterms: () -> Array[Grammar::Symbol]
|
105
|
+
def find_symbol_by_s_value!: (::String s_value) -> Grammar::Symbol
|
106
|
+
end
|
94
107
|
end
|
95
108
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Lrama
|
2
2
|
class State
|
3
3
|
class ReduceReduceConflict
|
4
|
-
attr_accessor symbols: Array[Grammar::Symbol
|
4
|
+
attr_accessor symbols: Array[Grammar::Symbol]
|
5
5
|
attr_accessor reduce1: State::Reduce
|
6
6
|
attr_accessor reduce2: State::Reduce
|
7
7
|
|
8
|
-
def initialize: (?symbols: Array[Grammar::Symbol
|
8
|
+
def initialize: (?symbols: Array[Grammar::Symbol], ?reduce1: State::Reduce, ?reduce2: State::Reduce) -> void
|
9
9
|
|
10
10
|
def type: () -> :reduce_reduce
|
11
11
|
end
|
data/sig/lrama/state.rbs
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
module Lrama
|
2
|
+
class State
|
3
|
+
@id: untyped
|
4
|
+
|
5
|
+
@accessing_symbol: untyped
|
6
|
+
|
7
|
+
@kernels: untyped
|
8
|
+
|
9
|
+
@items: Array[States::Item]
|
10
|
+
|
11
|
+
@items_to_state: untyped
|
12
|
+
|
13
|
+
@conflicts: Array[State::ShiftReduceConflict|State::ReduceReduceConflict]
|
14
|
+
|
15
|
+
@resolved_conflicts: untyped
|
16
|
+
|
17
|
+
@default_reduction_rule: untyped
|
18
|
+
|
19
|
+
@closure: untyped
|
20
|
+
|
21
|
+
@nterm_transitions: untyped
|
22
|
+
|
23
|
+
@term_transitions: untyped
|
24
|
+
|
25
|
+
@transitions: Array[[Shift, State]]
|
26
|
+
|
27
|
+
attr_reader id: untyped
|
28
|
+
|
29
|
+
attr_reader accessing_symbol: untyped
|
30
|
+
|
31
|
+
attr_reader kernels: untyped
|
32
|
+
|
33
|
+
attr_reader conflicts: Array[State::ShiftReduceConflict|State::ReduceReduceConflict]
|
34
|
+
|
35
|
+
attr_reader resolved_conflicts: untyped
|
36
|
+
|
37
|
+
attr_reader default_reduction_rule: untyped
|
38
|
+
|
39
|
+
attr_reader closure: untyped
|
40
|
+
|
41
|
+
attr_reader items: Array[States::Item]
|
42
|
+
|
43
|
+
attr_accessor shifts: Array[Shift]
|
44
|
+
|
45
|
+
attr_accessor reduces: untyped
|
46
|
+
|
47
|
+
def initialize: (untyped id, untyped accessing_symbol, Array[States::Item] kernels) -> void
|
48
|
+
|
49
|
+
def closure=: (untyped closure) -> untyped
|
50
|
+
|
51
|
+
def non_default_reduces: () -> untyped
|
52
|
+
|
53
|
+
def compute_shifts_reduces: () -> untyped
|
54
|
+
|
55
|
+
def set_items_to_state: (untyped items, untyped next_state) -> untyped
|
56
|
+
|
57
|
+
def set_look_ahead: (untyped rule, untyped look_ahead) -> untyped
|
58
|
+
|
59
|
+
def nterm_transitions: () -> untyped
|
60
|
+
|
61
|
+
def term_transitions: () -> untyped
|
62
|
+
|
63
|
+
def transitions: () -> Array[[Shift, State]]
|
64
|
+
|
65
|
+
def selected_term_transitions: () -> untyped
|
66
|
+
|
67
|
+
def transition: (untyped sym) -> untyped
|
68
|
+
|
69
|
+
def find_reduce_by_item!: (untyped item) -> untyped
|
70
|
+
|
71
|
+
def default_reduction_rule=: (untyped default_reduction_rule) -> untyped
|
72
|
+
|
73
|
+
def has_conflicts?: () -> untyped
|
74
|
+
|
75
|
+
def sr_conflicts: () -> untyped
|
76
|
+
|
77
|
+
def rr_conflicts: () -> untyped
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
module Lrama
|
2
|
+
class States
|
3
|
+
include Grammar::_DelegatedMethods
|
4
|
+
|
5
|
+
@grammar: untyped
|
6
|
+
|
7
|
+
@warning: untyped
|
8
|
+
|
9
|
+
@trace_state: untyped
|
10
|
+
|
11
|
+
@states: Array[State]
|
12
|
+
|
13
|
+
@direct_read_sets: untyped
|
14
|
+
|
15
|
+
@reads_relation: untyped
|
16
|
+
|
17
|
+
@read_sets: untyped
|
18
|
+
|
19
|
+
@includes_relation: untyped
|
20
|
+
|
21
|
+
@lookback_relation: untyped
|
22
|
+
|
23
|
+
@follow_sets: untyped
|
24
|
+
|
25
|
+
@la: untyped
|
26
|
+
|
27
|
+
extend Forwardable
|
28
|
+
|
29
|
+
include Lrama::Report::Duration
|
30
|
+
|
31
|
+
attr_reader states: Array[State]
|
32
|
+
|
33
|
+
attr_reader reads_relation: untyped
|
34
|
+
|
35
|
+
attr_reader includes_relation: untyped
|
36
|
+
|
37
|
+
attr_reader lookback_relation: untyped
|
38
|
+
|
39
|
+
def initialize: (untyped grammar, untyped warning, ?trace_state: bool) -> void
|
40
|
+
|
41
|
+
def compute: () -> untyped
|
42
|
+
|
43
|
+
def reporter: () -> untyped
|
44
|
+
|
45
|
+
def states_count: () -> untyped
|
46
|
+
|
47
|
+
def direct_read_sets: () -> untyped
|
48
|
+
|
49
|
+
def read_sets: () -> untyped
|
50
|
+
|
51
|
+
def follow_sets: () -> untyped
|
52
|
+
|
53
|
+
def la: () -> untyped
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def sr_conflicts: () -> untyped
|
58
|
+
|
59
|
+
def rr_conflicts: () -> untyped
|
60
|
+
|
61
|
+
def trace_state: () { (untyped) -> untyped } -> (untyped | nil)
|
62
|
+
|
63
|
+
def create_state: (untyped accessing_symbol, untyped kernels, untyped states_created) -> (::Array[untyped | false] | ::Array[untyped | true])
|
64
|
+
|
65
|
+
def setup_state: (untyped state) -> untyped
|
66
|
+
|
67
|
+
def enqueue_state: (untyped states, untyped state) -> untyped
|
68
|
+
|
69
|
+
def compute_lr0_states: () -> untyped
|
70
|
+
|
71
|
+
def nterm_transitions: () -> untyped
|
72
|
+
|
73
|
+
def compute_direct_read_sets: () -> untyped
|
74
|
+
|
75
|
+
def compute_reads_relation: () -> untyped
|
76
|
+
|
77
|
+
def compute_read_sets: () -> untyped
|
78
|
+
|
79
|
+
def transition: (untyped state, untyped symbols) -> untyped
|
80
|
+
|
81
|
+
def compute_includes_relation: () -> untyped
|
82
|
+
|
83
|
+
def compute_lookback_relation: () -> untyped
|
84
|
+
|
85
|
+
def compute_follow_sets: () -> untyped
|
86
|
+
|
87
|
+
def compute_look_ahead_sets: () -> untyped
|
88
|
+
|
89
|
+
def bitmap_to_terms: (untyped bit) -> untyped
|
90
|
+
|
91
|
+
def compute_conflicts: () -> untyped
|
92
|
+
|
93
|
+
def compute_shift_reduce_conflicts: () -> untyped
|
94
|
+
|
95
|
+
def compute_reduce_reduce_conflicts: () -> untyped
|
96
|
+
|
97
|
+
def compute_default_reduction: () -> untyped
|
98
|
+
|
99
|
+
def check_conflicts: () -> untyped
|
100
|
+
end
|
101
|
+
end
|