lrama 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yaml +20 -5
- data/Gemfile +1 -1
- data/NEWS.md +46 -0
- data/Steepfile +2 -3
- data/lib/lrama/command.rb +17 -3
- data/lib/lrama/context.rb +2 -22
- data/lib/lrama/grammar/binding.rb +24 -0
- data/lib/lrama/grammar/code/rule_action.rb +1 -1
- data/lib/lrama/grammar/parameterizing_rule/resolver.rb +39 -0
- data/lib/lrama/grammar/parameterizing_rule/rhs.rb +15 -0
- data/lib/lrama/grammar/parameterizing_rule/rule.rb +16 -0
- data/lib/lrama/grammar/parameterizing_rule.rb +3 -6
- data/lib/lrama/grammar/percent_code.rb +3 -3
- data/lib/lrama/grammar/rule_builder.rb +59 -25
- data/lib/lrama/grammar/type.rb +13 -1
- data/lib/lrama/grammar.rb +7 -9
- data/lib/lrama/lexer/grammar_file.rb +1 -1
- data/lib/lrama/lexer/token/instantiate_rule.rb +7 -2
- data/lib/lrama/lexer/token.rb +5 -0
- data/lib/lrama/lexer.rb +2 -7
- data/lib/lrama/output.rb +2 -2
- data/lib/lrama/parser.rb +166 -148
- data/lib/lrama/version.rb +1 -1
- data/parser.y +8 -8
- data/sig/lrama/grammar/binding.rbs +16 -0
- data/sig/lrama/grammar/parameterizing_rule/resolver.rbs +21 -0
- data/sig/lrama/grammar/parameterizing_rule/rhs.rbs +13 -0
- data/sig/lrama/grammar/parameterizing_rule/rule.rbs +14 -0
- data/sig/lrama/grammar/parameterizing_rule.rbs +0 -4
- data/sig/lrama/grammar/percent_code.rbs +3 -3
- data/sig/lrama/grammar/rule_builder.rbs +9 -6
- data/sig/lrama/lexer/token/instantiate_rule.rbs +4 -2
- data/sig/lrama/lexer/token.rbs +1 -0
- metadata +11 -9
- data/lib/lrama/grammar/parameterizing_rule_builder.rb +0 -34
- data/lib/lrama/grammar/parameterizing_rule_resolver.rb +0 -30
- data/lib/lrama/grammar/parameterizing_rule_rhs_builder.rb +0 -53
- data/sig/lrama/grammar/parameterizing_rule_builder.rbs +0 -19
- data/sig/lrama/grammar/parameterizing_rule_resolver.rbs +0 -16
- data/sig/lrama/grammar/parameterizing_rule_rhs_builder.rbs +0 -18
data/parser.y
CHANGED
@@ -205,8 +205,8 @@ rule
|
|
205
205
|
|
206
206
|
rule_declaration: "%rule" IDENTIFIER "(" rule_args ")" ":" rule_rhs_list
|
207
207
|
{
|
208
|
-
|
209
|
-
@grammar.
|
208
|
+
rule = Grammar::ParameterizingRule::Rule.new(val[1].s_value, val[3], val[6])
|
209
|
+
@grammar.add_parameterizing_rule(rule)
|
210
210
|
}
|
211
211
|
|
212
212
|
rule_args: IDENTIFIER { result = [val[0]] }
|
@@ -226,12 +226,12 @@ rule
|
|
226
226
|
rule_rhs: /* empty */
|
227
227
|
{
|
228
228
|
reset_precs
|
229
|
-
result = Grammar::
|
229
|
+
result = Grammar::ParameterizingRule::Rhs.new
|
230
230
|
}
|
231
231
|
| "%empty"
|
232
232
|
{
|
233
233
|
reset_precs
|
234
|
-
result = Grammar::
|
234
|
+
result = Grammar::ParameterizingRule::Rhs.new
|
235
235
|
}
|
236
236
|
| rule_rhs symbol named_ref_opt
|
237
237
|
{
|
@@ -408,19 +408,17 @@ rule
|
|
408
408
|
}
|
409
409
|
| rhs symbol parameterizing_suffix tag_opt
|
410
410
|
{
|
411
|
-
token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[2], location: @lexer.location, args: [val[1]])
|
411
|
+
token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[2], location: @lexer.location, args: [val[1]], lhs_tag: val[3])
|
412
412
|
builder = val[0]
|
413
413
|
builder.add_rhs(token)
|
414
|
-
builder.lhs_tag = val[3]
|
415
414
|
builder.line = val[1].first_line
|
416
415
|
result = builder
|
417
416
|
}
|
418
417
|
| rhs IDENTIFIER "(" parameterizing_args ")" tag_opt
|
419
418
|
{
|
420
|
-
token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[3])
|
419
|
+
token = Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[3], lhs_tag: val[5])
|
421
420
|
builder = val[0]
|
422
421
|
builder.add_rhs(token)
|
423
|
-
builder.lhs_tag = val[5]
|
424
422
|
builder.line = val[1].first_line
|
425
423
|
result = builder
|
426
424
|
}
|
@@ -459,6 +457,8 @@ rule
|
|
459
457
|
|
460
458
|
parameterizing_args: symbol { result = [val[0]] }
|
461
459
|
| parameterizing_args ',' symbol { result = val[0].append(val[2]) }
|
460
|
+
| symbol parameterizing_suffix { result = [Lrama::Lexer::Token::InstantiateRule.new(s_value: val[1].s_value, location: @lexer.location, args: val[0])] }
|
461
|
+
| IDENTIFIER "(" parameterizing_args ")" { result = [Lrama::Lexer::Token::InstantiateRule.new(s_value: val[0].s_value, location: @lexer.location, args: val[2])] }
|
462
462
|
|
463
463
|
named_ref_opt: # empty
|
464
464
|
| '[' IDENTIFIER ']' { result = val[1].s_value }
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Grammar
|
3
|
+
class Binding
|
4
|
+
attr_reader actual_args: Array[Lexer::Token]
|
5
|
+
attr_reader count: Integer
|
6
|
+
|
7
|
+
@rule_name: String
|
8
|
+
@required_parameters_count: Integer
|
9
|
+
@parameters: Array[Lexer::Token]
|
10
|
+
@parameter_to_arg: untyped
|
11
|
+
|
12
|
+
def initialize: (Grammar::ParameterizingRule::Rule parameterizing_rule, Array[Lexer::Token] actual_args) -> void
|
13
|
+
def resolve_symbol: (Lexer::Token symbol) -> Lexer::Token
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Grammar
|
3
|
+
class ParameterizingRule
|
4
|
+
class Resolver
|
5
|
+
attr_accessor created_lhs_list: Array[Lexer::Token]
|
6
|
+
|
7
|
+
@rules: Array[Grammar::ParameterizingRule::Rule]
|
8
|
+
|
9
|
+
def initialize: () -> void
|
10
|
+
def add_parameterizing_rule: (Grammar::ParameterizingRule::Rule rule) -> void
|
11
|
+
def defined?: (Lexer::Token::InstantiateRule token) -> bool
|
12
|
+
def find: (Lexer::Token::InstantiateRule token) -> Grammar::ParameterizingRule::Rule?
|
13
|
+
def created_lhs: (String lhs_s_value) -> Lexer::Token?
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def select_rules: (Lexer::Token::InstantiateRule token) -> Array[Grammar::ParameterizingRule::Rule]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Grammar
|
3
|
+
class ParameterizingRule
|
4
|
+
class Rhs
|
5
|
+
attr_reader symbols: Array[untyped]
|
6
|
+
attr_reader user_code: Lexer::Token::UserCode?
|
7
|
+
attr_reader precedence_sym: Lexer::Token?
|
8
|
+
|
9
|
+
def initialize: () -> void
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Lrama
|
2
|
+
class Grammar
|
3
|
+
class ParameterizingRule
|
4
|
+
class Rule
|
5
|
+
attr_reader name: String
|
6
|
+
attr_reader parameters: Array[Lexer::Token]
|
7
|
+
attr_reader rhs_list: Array[Grammar::ParameterizingRule::Rhs]
|
8
|
+
attr_reader required_parameters_count: Integer
|
9
|
+
|
10
|
+
def initialize: (String name, Array[Lexer::Token] parameters, Array[Grammar::ParameterizingRule::Rhs] rhs_list) -> void
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Lrama
|
2
2
|
class Grammar
|
3
3
|
class PercentCode
|
4
|
-
attr_reader
|
5
|
-
attr_reader code:
|
4
|
+
attr_reader name: String
|
5
|
+
attr_reader code: String
|
6
6
|
|
7
|
-
def initialize: (
|
7
|
+
def initialize: (String name, String code) -> void
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -2,8 +2,8 @@ module Lrama
|
|
2
2
|
class Grammar
|
3
3
|
class RuleBuilder
|
4
4
|
attr_accessor lhs: Lexer::Token
|
5
|
-
attr_accessor lhs_tag: untyped
|
6
5
|
attr_accessor line: Integer?
|
6
|
+
attr_reader lhs_tag: Lexer::Token::Tag?
|
7
7
|
attr_reader rhs: Array[Lexer::Token]
|
8
8
|
attr_reader user_code: Lexer::Token::UserCode?
|
9
9
|
attr_reader precedence_sym: Lexer::Token?
|
@@ -13,18 +13,20 @@ module Lrama
|
|
13
13
|
@position_in_original_rule_rhs: Integer?
|
14
14
|
@skip_preprocess_references: bool
|
15
15
|
@user_code: Lexer::Token::UserCode?
|
16
|
+
@rule_builders_for_parameterizing_rules: Array[RuleBuilder]
|
16
17
|
@rule_builders_for_derived_rules: Array[RuleBuilder]
|
17
18
|
@rules: Array[Rule]
|
18
19
|
@replaced_rhs: Array[Lexer::Token]
|
19
20
|
@parameterizing_rules: Array[Rule]
|
21
|
+
@old_parameterizing_rules: Array[Rule]
|
20
22
|
@midrule_action_rules: Array[Rule]
|
21
23
|
|
22
|
-
def initialize: (Counter rule_counter, Counter midrule_action_counter, ?Integer position_in_original_rule_rhs, ?skip_preprocess_references: bool) -> void
|
24
|
+
def initialize: (Counter rule_counter, Counter midrule_action_counter, ?Integer position_in_original_rule_rhs, ?lhs_tag: Lexer::Token::Tag?, ?skip_preprocess_references: bool) -> void
|
23
25
|
def add_rhs: (Lexer::Token rhs) -> void
|
24
|
-
def user_code=: (Lexer::Token::UserCode user_code) -> void
|
25
|
-
def precedence_sym=: (Lexer::Token
|
26
|
+
def user_code=: (Lexer::Token::UserCode? user_code) -> void
|
27
|
+
def precedence_sym=: (Lexer::Token? precedence_sym) -> void
|
26
28
|
def complete_input: () -> void
|
27
|
-
def setup_rules: (Grammar::
|
29
|
+
def setup_rules: (Grammar::ParameterizingRule::Resolver parameterizing_rule_resolver) -> void
|
28
30
|
def rules: () -> Array[Rule]
|
29
31
|
|
30
32
|
private
|
@@ -32,7 +34,8 @@ module Lrama
|
|
32
34
|
def freeze_rhs: () -> void
|
33
35
|
def preprocess_references: () -> void
|
34
36
|
def build_rules: () -> void
|
35
|
-
def process_rhs: (Grammar::
|
37
|
+
def process_rhs: (Grammar::ParameterizingRule::Resolver parameterizing_rule_resolver) -> void
|
38
|
+
def lhs_s_value: (Lexer::Token::InstantiateRule token, Grammar::Binding bindings) -> String
|
36
39
|
def numberize_references: () -> void
|
37
40
|
def flush_user_code: () -> void
|
38
41
|
end
|
@@ -2,10 +2,12 @@ module Lrama
|
|
2
2
|
class Lexer
|
3
3
|
class Token
|
4
4
|
class InstantiateRule < Token
|
5
|
-
|
5
|
+
attr_reader args: Array[Lexer::Token]
|
6
|
+
attr_reader lhs_tag: Lexer::Token::Tag?
|
6
7
|
|
7
|
-
def initialize: (s_value: String, ?alias_name: String, ?location: Location, ?args: Array[Lexer::Token]) -> void
|
8
|
+
def initialize: (s_value: String, ?alias_name: String, ?location: Location, ?args: Array[Lexer::Token], ?lhs_tag: Lexer::Token::Tag?) -> void
|
8
9
|
def rule_name: () -> String
|
10
|
+
def args_count: () -> Integer
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
data/sig/lrama/lexer/token.rbs
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lrama
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuichiro Kaneko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: LALR (1) parser generator written by Ruby
|
14
14
|
email:
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/lrama/digraph.rb
|
49
49
|
- lib/lrama/grammar.rb
|
50
50
|
- lib/lrama/grammar/auxiliary.rb
|
51
|
+
- lib/lrama/grammar/binding.rb
|
51
52
|
- lib/lrama/grammar/code.rb
|
52
53
|
- lib/lrama/grammar/code/initial_action_code.rb
|
53
54
|
- lib/lrama/grammar/code/no_reference_code.rb
|
@@ -56,9 +57,9 @@ files:
|
|
56
57
|
- lib/lrama/grammar/counter.rb
|
57
58
|
- lib/lrama/grammar/error_token.rb
|
58
59
|
- lib/lrama/grammar/parameterizing_rule.rb
|
59
|
-
- lib/lrama/grammar/
|
60
|
-
- lib/lrama/grammar/
|
61
|
-
- lib/lrama/grammar/
|
60
|
+
- lib/lrama/grammar/parameterizing_rule/resolver.rb
|
61
|
+
- lib/lrama/grammar/parameterizing_rule/rhs.rb
|
62
|
+
- lib/lrama/grammar/parameterizing_rule/rule.rb
|
62
63
|
- lib/lrama/grammar/parameterizing_rules/builder.rb
|
63
64
|
- lib/lrama/grammar/parameterizing_rules/builder/base.rb
|
64
65
|
- lib/lrama/grammar/parameterizing_rules/builder/list.rb
|
@@ -112,14 +113,15 @@ files:
|
|
112
113
|
- sig/lrama/bitmap.rbs
|
113
114
|
- sig/lrama/digraph.rbs
|
114
115
|
- sig/lrama/grammar.rbs
|
116
|
+
- sig/lrama/grammar/binding.rbs
|
115
117
|
- sig/lrama/grammar/code.rbs
|
116
118
|
- sig/lrama/grammar/code/printer_code.rbs
|
117
119
|
- sig/lrama/grammar/counter.rbs
|
118
120
|
- sig/lrama/grammar/error_token.rbs
|
119
121
|
- sig/lrama/grammar/parameterizing_rule.rbs
|
120
|
-
- sig/lrama/grammar/
|
121
|
-
- sig/lrama/grammar/
|
122
|
-
- sig/lrama/grammar/
|
122
|
+
- sig/lrama/grammar/parameterizing_rule/resolver.rbs
|
123
|
+
- sig/lrama/grammar/parameterizing_rule/rhs.rbs
|
124
|
+
- sig/lrama/grammar/parameterizing_rule/rule.rbs
|
123
125
|
- sig/lrama/grammar/parameterizing_rules/builder.rbs
|
124
126
|
- sig/lrama/grammar/parameterizing_rules/builder/base.rbs
|
125
127
|
- sig/lrama/grammar/parameterizing_rules/builder/list.rbs
|
@@ -168,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
170
|
- !ruby/object:Gem::Version
|
169
171
|
version: '0'
|
170
172
|
requirements: []
|
171
|
-
rubygems_version: 3.5.
|
173
|
+
rubygems_version: 3.5.3
|
172
174
|
signing_key:
|
173
175
|
specification_version: 4
|
174
176
|
summary: LALR (1) parser generator written by Ruby
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module Lrama
|
2
|
-
class Grammar
|
3
|
-
class ParameterizingRuleBuilder
|
4
|
-
attr_reader :name, :parameters, :rhs
|
5
|
-
|
6
|
-
def initialize(name, parameters, rhs)
|
7
|
-
@name = name
|
8
|
-
@parameters = parameters
|
9
|
-
@rhs = rhs
|
10
|
-
@required_parameters_count = parameters.count
|
11
|
-
end
|
12
|
-
|
13
|
-
def build_rules(token, actual_args, rule_counter, lhs_tag, line, rule_builders)
|
14
|
-
validate_argument_number!(token)
|
15
|
-
lhs = lhs(actual_args)
|
16
|
-
@rhs.map do |rhs|
|
17
|
-
rhs.build_rules(token, actual_args, parameters, rule_counter, lhs, lhs_tag, line, rule_builders)
|
18
|
-
end.flatten
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def validate_argument_number!(token)
|
24
|
-
unless @required_parameters_count == token.args.count
|
25
|
-
raise "Invalid number of arguments. expect: #{@required_parameters_count} actual: #{token.args.count}"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def lhs(actual_args)
|
30
|
-
Lrama::Lexer::Token::Ident.new(s_value: "#{name}_#{actual_args.map(&:s_value).join('_')}")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Lrama
|
2
|
-
class Grammar
|
3
|
-
class ParameterizingRuleResolver
|
4
|
-
def initialize
|
5
|
-
@parameterizing_rule_builders = []
|
6
|
-
end
|
7
|
-
|
8
|
-
def add_parameterizing_rule_builder(builder)
|
9
|
-
@parameterizing_rule_builders << builder
|
10
|
-
end
|
11
|
-
|
12
|
-
def defined?(name)
|
13
|
-
!rule_builders(name).empty?
|
14
|
-
end
|
15
|
-
|
16
|
-
def build_rules(token, rule_counter, lhs_tag, line)
|
17
|
-
builder = rule_builders(token.s_value).last
|
18
|
-
raise "Unknown parameterizing rule #{token.s_value} at line #{token.line}" unless builder
|
19
|
-
|
20
|
-
builder.build_rules(token, token.args, rule_counter, lhs_tag, line, @parameterizing_rule_builders)
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def rule_builders(name)
|
26
|
-
@parameterizing_rule_builders.select { |builder| builder.name == name }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Lrama
|
2
|
-
class Grammar
|
3
|
-
class ParameterizingRuleRhsBuilder
|
4
|
-
attr_accessor :symbols, :user_code, :precedence_sym
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
@symbols = []
|
8
|
-
@user_code = nil
|
9
|
-
@precedence_sym = nil
|
10
|
-
end
|
11
|
-
|
12
|
-
def build_rules(token, actual_args, parameters, rule_counter, lhs, lhs_tag, line, rule_builders)
|
13
|
-
nested_rules = build_nested_rules(token, actual_args, parameters, rule_counter, lhs_tag, line, rule_builders)
|
14
|
-
rule = Rule.new(id: rule_counter.increment, _lhs: lhs, _rhs: rhs(token, actual_args, parameters, nested_rules.last), lhs_tag: lhs_tag, token_code: user_code, precedence_sym: precedence_sym, lineno: line)
|
15
|
-
ParameterizingRule.new(rules: nested_rules.map(&:rules) + [rule], token: lhs)
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def build_nested_rules(token, actual_args, parameters, rule_counter, lhs_tag, line, rule_builders)
|
21
|
-
symbols.each_with_index.map do |sym, i|
|
22
|
-
next unless sym.is_a?(Lexer::Token::InstantiateRule)
|
23
|
-
|
24
|
-
builder = rule_builders.select { |builder| builder.name == sym.s_value }.last
|
25
|
-
raise "Unknown parameterizing rule #{token.s_value} at line #{token.line}" unless builder
|
26
|
-
|
27
|
-
builder.build_rules(sym, nested_actual_args(actual_args, parameters, i), rule_counter, lhs_tag, line, rule_builders)
|
28
|
-
end.flatten.compact
|
29
|
-
end
|
30
|
-
|
31
|
-
def nested_actual_args(actual_args, parameters, idx)
|
32
|
-
symbols[idx].args.map do |arg|
|
33
|
-
i = parameters.index { |parameter| parameter.s_value == arg.s_value }
|
34
|
-
i.nil? ? arg : actual_args[i]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def rhs(token, actual_args, parameters, nested_rule)
|
39
|
-
symbols.map do |sym|
|
40
|
-
if sym.is_a?(Lexer::Token::InstantiateRule)
|
41
|
-
sym.args.map do |arg|
|
42
|
-
idx = parameters.index { |parameter| parameter.s_value == arg.s_value }
|
43
|
-
idx.nil? ? sym : nested_rule&.token
|
44
|
-
end
|
45
|
-
else
|
46
|
-
idx = parameters.index { |parameter| parameter.s_value == sym.s_value }
|
47
|
-
idx.nil? ? sym : actual_args[idx]
|
48
|
-
end
|
49
|
-
end.flatten
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Lrama
|
2
|
-
class Grammar
|
3
|
-
class ParameterizingRuleBuilder
|
4
|
-
attr_reader name: String
|
5
|
-
attr_reader parameters: Array[Lexer::Token]
|
6
|
-
attr_reader rhs: Array[Grammar::ParameterizingRuleRhsBuilder]
|
7
|
-
|
8
|
-
@required_parameters_count: Integer
|
9
|
-
|
10
|
-
def initialize: (String name, Array[Lexer::Token] parameters, Array[Grammar::ParameterizingRuleRhsBuilder] rhs) -> void
|
11
|
-
def build_rules: (Lexer::Token::InstantiateRule token, Array[Lexer::Token] actual_args, Counter rule_counter, untyped lhs_tag, Integer? line, Array[ParameterizingRuleBuilder] rule_builders) -> Array[Grammar::ParameterizingRule]
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def validate_argument_number!: (Lexer::Token::InstantiateRule token) -> void
|
16
|
-
def lhs: (Array[Lexer::Token] actual_args) -> Lexer::Token
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Lrama
|
2
|
-
class Grammar
|
3
|
-
class ParameterizingRuleResolver
|
4
|
-
@parameterizing_rule_builders: Array[Grammar::ParameterizingRuleBuilder]
|
5
|
-
|
6
|
-
def initialize: () -> void
|
7
|
-
def add_parameterizing_rule_builder: (Grammar::ParameterizingRuleBuilder builder) -> void
|
8
|
-
def defined?: (String) -> bool
|
9
|
-
def build_rules: (Lexer::Token::InstantiateRule token, Counter rule_counter, untyped lhs_tag, Integer? line) -> Array[Grammar::ParameterizingRule]
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def rule_builders: (String) -> Array[Grammar::ParameterizingRuleBuilder]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Lrama
|
2
|
-
class Grammar
|
3
|
-
class ParameterizingRuleRhsBuilder
|
4
|
-
attr_reader symbols: Array[untyped]
|
5
|
-
attr_reader user_code: Lexer::Token::UserCode?
|
6
|
-
attr_reader precedence_sym: Lexer::Token?
|
7
|
-
|
8
|
-
def initialize: () -> void
|
9
|
-
def build_rules: (Lexer::Token::InstantiateRule token, Array[Lexer::Token] actual_args, Array[Lexer::Token] parameters, Counter rule_counter, Lexer::Token lhs, untyped lhs_tag, Integer? line, Array[ParameterizingRuleBuilder] rule_builders) -> Grammar::ParameterizingRule
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def build_nested_rules: (Lexer::Token::InstantiateRule token, Array[Lexer::Token] actual_args, Array[Lexer::Token] parameters, Counter rule_counter, untyped lhs_tag, Integer? line, Array[ParameterizingRuleBuilder] rule_builders) -> Array[Grammar::ParameterizingRule]
|
14
|
-
def nested_actual_args: (Array[Lexer::Token] actual_args, Array[Lexer::Token] parameters, Integer idx) -> Array[Lexer::Token]
|
15
|
-
def rhs: (Lexer::Token token, Array[Lexer::Token] actual_args, Array[Lexer::Token] parameters, ParameterizingRule? nested_rule) -> Array[Lexer::Token]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|