rggen-core 0.29.0 → 0.31.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.
- checksums.yaml +4 -4
- data/lib/rggen/core/builder/feature_registry.rb +15 -14
- data/lib/rggen/core/builder/input_component_registry.rb +2 -2
- data/lib/rggen/core/builder/layer.rb +8 -4
- data/lib/rggen/core/builder/loader_registry.rb +3 -6
- data/lib/rggen/core/configuration/component_factory.rb +1 -1
- data/lib/rggen/core/configuration/error.rb +2 -5
- data/lib/rggen/core/input_base/component_factory.rb +5 -4
- data/lib/rggen/core/input_base/conversion_utility.rb +24 -0
- data/lib/rggen/core/input_base/error.rb +41 -0
- data/lib/rggen/core/input_base/feature.rb +20 -16
- data/lib/rggen/core/input_base/feature_factory.rb +12 -10
- data/lib/rggen/core/input_base/input_data.rb +5 -5
- data/lib/rggen/core/input_base/input_value.rb +3 -7
- data/lib/rggen/core/input_base/input_vaue_parser.rb +8 -3
- data/lib/rggen/core/input_base/{value_with_options_parser.rb → option_array_parser.rb} +1 -1
- data/lib/rggen/core/input_base/option_hash_parser.rb +104 -0
- data/lib/rggen/core/register_map/component_factory.rb +2 -2
- data/lib/rggen/core/register_map/error.rb +2 -5
- data/lib/rggen/core/register_map/input_data.rb +11 -2
- data/lib/rggen/core/version.rb +1 -1
- data/lib/rggen/core.rb +4 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0969d51d5ab39e5bf98ff6d7cb44ae8b9b4a7a9efea6d2c0eb47a8cd9685b4c2'
|
4
|
+
data.tar.gz: f5e71796fd8de70124491d20b3501680968edf8f12c15f3fc6e729791f7bdfd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c27bfff2f272e80ca16331a3071560962e80051e0c4e566ae277bff99a5097cd32ccc87519f4c37a466bacd826da60c882b3e032492439d7c282437fc4d4aeb
|
7
|
+
data.tar.gz: b8b2365ac6de6ec997dbb3054d91a46e5c761218460ec416dcaf126e35549f38643f94d446c3b865bdc9e0346a4d7e7ead38e0665e9b09510ef7d6083013cbd5
|
@@ -30,12 +30,11 @@ module RgGen
|
|
30
30
|
entry.define_feature(feature_name, context, &body)
|
31
31
|
end
|
32
32
|
|
33
|
-
def enable(
|
34
|
-
if
|
35
|
-
list_name = feature_or_list_names
|
33
|
+
def enable(list_name = nil, feature_names)
|
34
|
+
if list_name
|
36
35
|
(@enabled_features[list_name] ||= []).merge!(Array(feature_names))
|
37
36
|
else
|
38
|
-
Array(
|
37
|
+
Array(feature_names).each do |name|
|
39
38
|
@enabled_features.key?(name) || (@enabled_features[name] = nil)
|
40
39
|
end
|
41
40
|
end
|
@@ -45,21 +44,23 @@ module RgGen
|
|
45
44
|
@enabled_features.clear
|
46
45
|
end
|
47
46
|
|
48
|
-
def delete(
|
49
|
-
if
|
50
|
-
@feature_entries[
|
51
|
-
elsif feature_or_list_names
|
52
|
-
Array(feature_or_list_names).each(&@feature_entries.method(:delete))
|
47
|
+
def delete(list_name = nil, feature_names)
|
48
|
+
if list_name
|
49
|
+
@feature_entries[list_name]&.delete(feature_names)
|
53
50
|
else
|
54
|
-
|
51
|
+
Array(feature_names).each(&@feature_entries.method(:delete))
|
55
52
|
end
|
56
53
|
end
|
57
54
|
|
58
|
-
def
|
59
|
-
|
60
|
-
|
55
|
+
def delete_all
|
56
|
+
@feature_entries.clear
|
57
|
+
end
|
58
|
+
|
59
|
+
def feature?(list_name = nil, feature_name)
|
60
|
+
if list_name
|
61
|
+
list_feature?(list_name, feature_name)
|
61
62
|
else
|
62
|
-
@feature_entries.key?(
|
63
|
+
@feature_entries.key?(feature_name)
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
@@ -23,9 +23,9 @@ module RgGen
|
|
23
23
|
block_given? && yield(@loader_registries[loader_type])
|
24
24
|
end
|
25
25
|
|
26
|
-
def define_value_extractor(loader_type,
|
26
|
+
def define_value_extractor(loader_type, layers = nil, value, &body)
|
27
27
|
@loader_registries[loader_type]
|
28
|
-
.define_value_extractor(
|
28
|
+
.define_value_extractor(layers, value, &body)
|
29
29
|
end
|
30
30
|
|
31
31
|
def build_factory
|
@@ -94,9 +94,9 @@ module RgGen
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
def enable(
|
97
|
+
def enable(...)
|
98
98
|
@feature_registries.each_value do |registry|
|
99
|
-
registry.enable(
|
99
|
+
registry.enable(...)
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -104,12 +104,16 @@ module RgGen
|
|
104
104
|
@feature_registries.each_value(&:enable_all)
|
105
105
|
end
|
106
106
|
|
107
|
-
def delete(
|
107
|
+
def delete(...)
|
108
108
|
@feature_registries.each_value do |registry|
|
109
|
-
registry.delete(
|
109
|
+
registry.delete(...)
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
def delete_all
|
114
|
+
@feature_registries.each_value(&:delete_all)
|
115
|
+
end
|
116
|
+
|
113
117
|
private
|
114
118
|
|
115
119
|
def define_proxy_call(name)
|
@@ -18,18 +18,15 @@ module RgGen
|
|
18
18
|
@loaders.concat(Array(loaders))
|
19
19
|
end
|
20
20
|
|
21
|
-
def define_value_extractor(
|
22
|
-
value, layers = [value, layers_or_value].compact
|
21
|
+
def define_value_extractor(layers = nil, value, &body)
|
23
22
|
@extractors << create_extractor(layers, value, &body)
|
24
23
|
end
|
25
24
|
|
26
|
-
def ignore_value(
|
27
|
-
value, layers = [value, layers_or_value].compact
|
25
|
+
def ignore_value(layers = nil, value)
|
28
26
|
ignore_values(layers, [value])
|
29
27
|
end
|
30
28
|
|
31
|
-
def ignore_values(
|
32
|
-
values, layers = [values, layers_or_values].compact
|
29
|
+
def ignore_values(layers = nil, values)
|
33
30
|
[layers].flatten.each do |layer|
|
34
31
|
(@ignore_values[layer] ||= []).concat(Array(values))
|
35
32
|
end
|
@@ -7,16 +7,13 @@ module RgGen
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module RaiseError
|
10
|
+
include InputBase::RaiseError
|
11
|
+
|
10
12
|
private
|
11
13
|
|
12
14
|
def error_exception
|
13
15
|
ConfigurationError
|
14
16
|
end
|
15
|
-
|
16
|
-
def error(message, input_value = nil)
|
17
|
-
position = input_value.position if input_value.respond_to?(:position)
|
18
|
-
raise ConfigurationError.new(message, position || @position)
|
19
|
-
end
|
20
17
|
end
|
21
18
|
end
|
22
19
|
end
|
@@ -24,14 +24,15 @@ module RgGen
|
|
24
24
|
|
25
25
|
def preprocess(args)
|
26
26
|
if root_factory?
|
27
|
-
[*args[0..-2], load_files(args
|
27
|
+
[*args[0..-2], load_files(args)]
|
28
28
|
else
|
29
29
|
args
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def load_files(
|
34
|
-
|
33
|
+
def load_files(args)
|
34
|
+
files = args.last
|
35
|
+
create_input_data(*args[0..-2]) do |input_data|
|
35
36
|
files.each { |file| load_file(file, input_data) }
|
36
37
|
end
|
37
38
|
end
|
@@ -50,7 +51,7 @@ module RgGen
|
|
50
51
|
.transform_values(&->(f) { f.valid_value_list })
|
51
52
|
end
|
52
53
|
|
53
|
-
def create_input_data(&block)
|
54
|
+
def create_input_data(*_args, &block)
|
54
55
|
end
|
55
56
|
|
56
57
|
def create_features(component, *sources)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RgGen
|
4
|
+
module Core
|
5
|
+
module InputBase
|
6
|
+
module ConversionUtility
|
7
|
+
private
|
8
|
+
|
9
|
+
def to_int(value, position = nil)
|
10
|
+
v, pos =
|
11
|
+
if value.is_a?(InputValue)
|
12
|
+
[value.value, value.position]
|
13
|
+
else
|
14
|
+
[value, position]
|
15
|
+
end
|
16
|
+
Integer(v)
|
17
|
+
rescue ArgumentError, TypeError
|
18
|
+
message = yield(v)
|
19
|
+
error message, pos
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RgGen
|
4
|
+
module Core
|
5
|
+
module InputBase
|
6
|
+
ApproximatelyErrorPosition = Struct.new(:position) do
|
7
|
+
def self.create(position)
|
8
|
+
position && new(position)
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
"#{position} (approximately)"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module RaiseError
|
17
|
+
private
|
18
|
+
|
19
|
+
def error(message, position = nil)
|
20
|
+
pos = extract_error_position(position)
|
21
|
+
raise error_exception.new(message, pos)
|
22
|
+
end
|
23
|
+
|
24
|
+
def extract_error_position(position)
|
25
|
+
pos =
|
26
|
+
if position.respond_to?(:position)
|
27
|
+
position.position
|
28
|
+
else
|
29
|
+
position
|
30
|
+
end
|
31
|
+
pos ||
|
32
|
+
if respond_to?(:error_position)
|
33
|
+
error_position
|
34
|
+
else
|
35
|
+
@position
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -6,6 +6,7 @@ module RgGen
|
|
6
6
|
class Feature < Base::Feature
|
7
7
|
include Utility::RegexpPatterns
|
8
8
|
include Utility::TypeChecker
|
9
|
+
include ConversionUtility
|
9
10
|
|
10
11
|
class << self
|
11
12
|
def property(name, **options, &body)
|
@@ -29,15 +30,13 @@ module RgGen
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def build(&block)
|
32
|
-
@builders ||= []
|
33
|
-
@builders << block
|
33
|
+
(@builders ||= []) << block
|
34
34
|
end
|
35
35
|
|
36
36
|
attr_reader :builders
|
37
37
|
|
38
38
|
def post_build(&block)
|
39
|
-
@post_builders ||= []
|
40
|
-
@post_builders << block
|
39
|
+
(@post_builders ||= []) << block
|
41
40
|
end
|
42
41
|
|
43
42
|
attr_reader :post_builders
|
@@ -64,8 +63,7 @@ module RgGen
|
|
64
63
|
attr_reader :verifiers
|
65
64
|
|
66
65
|
def printable(name, &body)
|
67
|
-
@printables ||= {}
|
68
|
-
@printables[name] = body
|
66
|
+
(@printables ||= {})[name] = body
|
69
67
|
end
|
70
68
|
|
71
69
|
attr_reader :printables
|
@@ -119,11 +117,22 @@ module RgGen
|
|
119
117
|
end
|
120
118
|
|
121
119
|
def inspect
|
122
|
-
printable_values =
|
123
|
-
printables&.map { |name, value| "#{name}: #{value.inspect}" }
|
120
|
+
printable_values = printables&.map { |name, value| "#{name}: #{value.inspect}" }
|
124
121
|
(printable_values && "#{super}[#{printable_values.join(', ')}]") || super
|
125
122
|
end
|
126
123
|
|
124
|
+
attr_reader :position
|
125
|
+
|
126
|
+
def error_position
|
127
|
+
if position
|
128
|
+
position
|
129
|
+
else
|
130
|
+
approximate_position =
|
131
|
+
component.features.map(&:position).find(&:itself)
|
132
|
+
ApproximatelyErrorPosition.create(approximate_position)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
127
136
|
private
|
128
137
|
|
129
138
|
def do_build(args)
|
@@ -137,16 +146,12 @@ module RgGen
|
|
137
146
|
self.class.builders.each { |builder| instance_exec(*args, &builder) }
|
138
147
|
end
|
139
148
|
|
140
|
-
attr_reader :position
|
141
|
-
|
142
149
|
def match_automatically?
|
143
|
-
|
144
|
-
matcher&.match_automatically?
|
150
|
+
self.class.input_matcher&.match_automatically?
|
145
151
|
end
|
146
152
|
|
147
153
|
def match_pattern(rhs)
|
148
|
-
|
149
|
-
@match_data, @match_index = matcher&.match(rhs)
|
154
|
+
@match_data, @match_index = self.class.input_matcher&.match(rhs)
|
150
155
|
end
|
151
156
|
|
152
157
|
attr_reader :match_data
|
@@ -161,8 +166,7 @@ module RgGen
|
|
161
166
|
end
|
162
167
|
|
163
168
|
def do_verify(scope)
|
164
|
-
self.class.verifiers&.[](scope)
|
165
|
-
&.each { |verifier| verifier.verify(self) }
|
169
|
+
self.class.verifiers&.[](scope)&.each { |verifier| verifier.verify(self) }
|
166
170
|
(@verified ||= {})[scope] = true
|
167
171
|
end
|
168
172
|
|
@@ -18,8 +18,8 @@ module RgGen
|
|
18
18
|
@default_value
|
19
19
|
end
|
20
20
|
|
21
|
-
def value_format(format = nil)
|
22
|
-
@value_format = format if format
|
21
|
+
def value_format(format = nil, **options)
|
22
|
+
@value_format = [format, options] if format
|
23
23
|
@value_format
|
24
24
|
end
|
25
25
|
end
|
@@ -51,29 +51,31 @@ module RgGen
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def process_active_input_value(input_value)
|
54
|
-
|
54
|
+
parsed_value, options =
|
55
55
|
if self.class.value_format
|
56
56
|
parse_input_value(input_value, self.class.value_format)
|
57
57
|
end
|
58
|
-
override_input_value(input_value,
|
58
|
+
override_input_value(input_value, parsed_value, options) || input_value
|
59
59
|
end
|
60
60
|
|
61
61
|
VALUE_PARSERS = {
|
62
|
-
|
62
|
+
option_array: OptionArrayParser,
|
63
|
+
option_hash: OptionHashParser,
|
63
64
|
hash_list: HashListParser
|
64
65
|
}.freeze
|
65
66
|
|
66
67
|
def parse_input_value(input_value, value_format)
|
67
|
-
|
68
|
+
format, options = value_format
|
69
|
+
VALUE_PARSERS[format].new(error_exception, **options).parse(input_value)
|
68
70
|
end
|
69
71
|
|
70
|
-
def override_input_value(input_value,
|
71
|
-
(convert_value(input_value,
|
72
|
+
def override_input_value(input_value, parsed_value, options)
|
73
|
+
(convert_value(input_value, parsed_value) || parsed_value)
|
72
74
|
&.then { |v| InputValue.new(v, options, input_value.position) }
|
73
75
|
end
|
74
76
|
|
75
|
-
def convert_value(input_value,
|
76
|
-
value =
|
77
|
+
def convert_value(input_value, parsed_value)
|
78
|
+
value = parsed_value || input_value.value
|
77
79
|
if empty_value?(value)
|
78
80
|
evaluate_defalt_value(input_value.position)
|
79
81
|
else
|
@@ -4,7 +4,7 @@ module RgGen
|
|
4
4
|
module Core
|
5
5
|
module InputBase
|
6
6
|
class InputData
|
7
|
-
def initialize(layer, valid_value_lists)
|
7
|
+
def initialize(layer, valid_value_lists, *_args)
|
8
8
|
@layer = layer
|
9
9
|
@valid_value_lists = valid_value_lists
|
10
10
|
@values = Hash.new(NAValue)
|
@@ -21,8 +21,8 @@ module RgGen
|
|
21
21
|
assign_value(symbolized_name, value, position)
|
22
22
|
end
|
23
23
|
|
24
|
-
def []=(value_name,
|
25
|
-
value(value_name, value
|
24
|
+
def []=(value_name, position = nil, value)
|
25
|
+
value(value_name, value, position)
|
26
26
|
end
|
27
27
|
|
28
28
|
def [](value_name)
|
@@ -87,8 +87,8 @@ module RgGen
|
|
87
87
|
caller_location.path.include?('docile')
|
88
88
|
end
|
89
89
|
|
90
|
-
def create_child_data(layer, &block)
|
91
|
-
child_data_class.new(layer, @valid_value_lists, &block)
|
90
|
+
def create_child_data(layer, *args, &block)
|
91
|
+
child_data_class.new(layer, @valid_value_lists, *args, &block)
|
92
92
|
end
|
93
93
|
|
94
94
|
def child_data_class
|
@@ -6,14 +6,10 @@ module RgGen
|
|
6
6
|
class InputValue < ::SimpleDelegator
|
7
7
|
NoValue = Object.new
|
8
8
|
|
9
|
-
def initialize(value,
|
9
|
+
def initialize(value, options = NoValue, position)
|
10
10
|
super((value.is_a?(String) && value.strip) || value)
|
11
|
-
@options
|
12
|
-
|
13
|
-
[NoValue, options_or_position]
|
14
|
-
else
|
15
|
-
[options_or_position, position]
|
16
|
-
end
|
11
|
+
@options = options
|
12
|
+
@position = position
|
17
13
|
end
|
18
14
|
|
19
15
|
alias_method :value, :__getobj__
|
@@ -6,7 +6,7 @@ module RgGen
|
|
6
6
|
class InputValueParser
|
7
7
|
include Utility::TypeChecker
|
8
8
|
|
9
|
-
def initialize(exception)
|
9
|
+
def initialize(exception, **_option)
|
10
10
|
@exception = exception
|
11
11
|
end
|
12
12
|
|
@@ -16,8 +16,13 @@ module RgGen
|
|
16
16
|
string&.split(separator, limit)&.map(&:strip)
|
17
17
|
end
|
18
18
|
|
19
|
-
def error(message,
|
20
|
-
position =
|
19
|
+
def error(message, position_or_input_value = nil)
|
20
|
+
position =
|
21
|
+
if position_or_input_value.respond_to?(:position)
|
22
|
+
position_or_input_value.position
|
23
|
+
else
|
24
|
+
position_or_input_value
|
25
|
+
end
|
21
26
|
raise @exception.new(message, position)
|
22
27
|
end
|
23
28
|
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RgGen
|
4
|
+
module Core
|
5
|
+
module InputBase
|
6
|
+
class OptionHashParser < InputValueParser
|
7
|
+
def initialize(exception, allowed_options: nil, multiple_values: false)
|
8
|
+
super
|
9
|
+
@allowed_options = allowed_options
|
10
|
+
@multiple_values = multiple_values
|
11
|
+
end
|
12
|
+
|
13
|
+
def parse(input_value)
|
14
|
+
values, options = parse_input_value(input_value)
|
15
|
+
check_result(values, options, input_value)
|
16
|
+
pack_result(values, options)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def parse_input_value(input_value)
|
22
|
+
values, options =
|
23
|
+
if string?(input_value)
|
24
|
+
parse_string_value(input_value)
|
25
|
+
elsif array?(input_value)
|
26
|
+
parse_array_value(input_value)
|
27
|
+
elsif hash?(input_value)
|
28
|
+
[nil, input_value]
|
29
|
+
elsif !input_value.empty_value?
|
30
|
+
[[input_value.value]]
|
31
|
+
end
|
32
|
+
[values || [], symbolize_keys(options) || {}]
|
33
|
+
end
|
34
|
+
|
35
|
+
def parse_string_value(input_value)
|
36
|
+
value_string, option_string = split_string(input_value, ':', 2)
|
37
|
+
values = split_string(value_string, /[,\n]/, 0)
|
38
|
+
options = parse_option_string(option_string, input_value.position)
|
39
|
+
[values, options]
|
40
|
+
end
|
41
|
+
|
42
|
+
def parse_option_string(option_string, position)
|
43
|
+
split_string(option_string, /[,\n]/, 0)
|
44
|
+
&.to_h { |option| split_string(option, ':', 2) }
|
45
|
+
rescue ArgumentError, TypeError
|
46
|
+
error "invalid options are given: #{option_string.inspect}", position
|
47
|
+
end
|
48
|
+
|
49
|
+
def parse_array_value(input_value)
|
50
|
+
input_value.each_with_object([[], {}]) do |item, (values, options)|
|
51
|
+
if value_item?(item, values)
|
52
|
+
values << item
|
53
|
+
else
|
54
|
+
update_option_hash(options, item, input_value.position)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def value_item?(item, values)
|
60
|
+
!hash?(item) && (@multiple_values || values.empty?)
|
61
|
+
end
|
62
|
+
|
63
|
+
def update_option_hash(option_hash, item, position)
|
64
|
+
option_hash.update(item)
|
65
|
+
rescue ArgumentError, TypeError
|
66
|
+
error "invalid option is given: #{item.inspect}", position
|
67
|
+
end
|
68
|
+
|
69
|
+
def symbolize_keys(options)
|
70
|
+
options&.transform_keys { |k| string?(k) && k.to_sym || k }
|
71
|
+
end
|
72
|
+
|
73
|
+
def check_result(values, options, input_value)
|
74
|
+
no_values?(values, options) &&
|
75
|
+
(error "no input values are given: #{input_value.inspect}", input_value)
|
76
|
+
illegal_value_size?(values) &&
|
77
|
+
(error "multiple input values are given: #{values}", input_value)
|
78
|
+
check_option(options, input_value.position)
|
79
|
+
end
|
80
|
+
|
81
|
+
def no_values?(values, options)
|
82
|
+
values.empty? && !options.empty?
|
83
|
+
end
|
84
|
+
|
85
|
+
def illegal_value_size?(values)
|
86
|
+
!@multiple_values && values.size > 1
|
87
|
+
end
|
88
|
+
|
89
|
+
def check_option(options, position)
|
90
|
+
return if @allowed_options.nil? || @allowed_options.empty?
|
91
|
+
return if options.nil? || options.empty?
|
92
|
+
|
93
|
+
unknown_options = options.keys - @allowed_options
|
94
|
+
unknown_options.empty? ||
|
95
|
+
(error "unknown options are given: #{unknown_options}", position)
|
96
|
+
end
|
97
|
+
|
98
|
+
def pack_result(values, options)
|
99
|
+
[@multiple_values && values || values.first, options]
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -12,8 +12,8 @@ module RgGen
|
|
12
12
|
configuration
|
13
13
|
end
|
14
14
|
|
15
|
-
def create_input_data(&block)
|
16
|
-
InputData.new(:root, valid_value_lists, &block)
|
15
|
+
def create_input_data(configuration, &block)
|
16
|
+
InputData.new(:root, valid_value_lists, configuration, &block)
|
17
17
|
end
|
18
18
|
|
19
19
|
def find_child_factory(_configuration, register_map)
|
@@ -7,16 +7,13 @@ module RgGen
|
|
7
7
|
end
|
8
8
|
|
9
9
|
module RaiseError
|
10
|
+
include InputBase::RaiseError
|
11
|
+
|
10
12
|
private
|
11
13
|
|
12
14
|
def error_exception
|
13
15
|
RegisterMapError
|
14
16
|
end
|
15
|
-
|
16
|
-
def error(message, input_value = nil)
|
17
|
-
position = input_value.position if input_value.respond_to?(:position)
|
18
|
-
raise RegisterMapError.new(message, position || @position)
|
19
|
-
end
|
20
17
|
end
|
21
18
|
end
|
22
19
|
end
|
@@ -38,9 +38,18 @@ module RgGen
|
|
38
38
|
bit_field: BitField
|
39
39
|
}.freeze
|
40
40
|
|
41
|
-
def initialize(layer, valid_value_list)
|
41
|
+
def initialize(layer, valid_value_list, configuration)
|
42
42
|
extend(LAYER_EXTENSIONS[layer])
|
43
|
-
|
43
|
+
@configuration = configuration
|
44
|
+
super(layer, valid_value_list)
|
45
|
+
end
|
46
|
+
|
47
|
+
attr_reader :configuration
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def create_child_data(layer, &block)
|
52
|
+
super(layer, @configuration, &block)
|
44
53
|
end
|
45
54
|
end
|
46
55
|
end
|
data/lib/rggen/core/version.rb
CHANGED
data/lib/rggen/core.rb
CHANGED
@@ -42,6 +42,8 @@ require_relative 'core/base/feature_layer_extension'
|
|
42
42
|
require_relative 'core/input_base/input_value'
|
43
43
|
require_relative 'core/input_base/input_data'
|
44
44
|
require_relative 'core/input_base/input_value_extractor'
|
45
|
+
require_relative 'core/input_base/error'
|
46
|
+
require_relative 'core/input_base/conversion_utility'
|
45
47
|
require_relative 'core/input_base/loader'
|
46
48
|
require_relative 'core/input_base/json_loader'
|
47
49
|
require_relative 'core/input_base/toml_loader'
|
@@ -53,7 +55,8 @@ require_relative 'core/input_base/verifier'
|
|
53
55
|
require_relative 'core/input_base/property'
|
54
56
|
require_relative 'core/input_base/feature'
|
55
57
|
require_relative 'core/input_base/input_vaue_parser'
|
56
|
-
require_relative 'core/input_base/
|
58
|
+
require_relative 'core/input_base/option_array_parser'
|
59
|
+
require_relative 'core/input_base/option_hash_parser'
|
57
60
|
require_relative 'core/input_base/hash_list_parser'
|
58
61
|
require_relative 'core/input_base/feature_factory'
|
59
62
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rggen-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.31.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docile
|
@@ -144,6 +144,8 @@ files:
|
|
144
144
|
- lib/rggen/core/generator.rb
|
145
145
|
- lib/rggen/core/input_base/component.rb
|
146
146
|
- lib/rggen/core/input_base/component_factory.rb
|
147
|
+
- lib/rggen/core/input_base/conversion_utility.rb
|
148
|
+
- lib/rggen/core/input_base/error.rb
|
147
149
|
- lib/rggen/core/input_base/feature.rb
|
148
150
|
- lib/rggen/core/input_base/feature_factory.rb
|
149
151
|
- lib/rggen/core/input_base/hash_list_parser.rb
|
@@ -154,9 +156,10 @@ files:
|
|
154
156
|
- lib/rggen/core/input_base/input_vaue_parser.rb
|
155
157
|
- lib/rggen/core/input_base/json_loader.rb
|
156
158
|
- lib/rggen/core/input_base/loader.rb
|
159
|
+
- lib/rggen/core/input_base/option_array_parser.rb
|
160
|
+
- lib/rggen/core/input_base/option_hash_parser.rb
|
157
161
|
- lib/rggen/core/input_base/property.rb
|
158
162
|
- lib/rggen/core/input_base/toml_loader.rb
|
159
|
-
- lib/rggen/core/input_base/value_with_options_parser.rb
|
160
163
|
- lib/rggen/core/input_base/verifier.rb
|
161
164
|
- lib/rggen/core/input_base/yaml_loader.rb
|
162
165
|
- lib/rggen/core/options.rb
|
@@ -219,8 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
222
|
- !ruby/object:Gem::Version
|
220
223
|
version: '0'
|
221
224
|
requirements: []
|
222
|
-
rubygems_version: 3.4.
|
225
|
+
rubygems_version: 3.4.17
|
223
226
|
signing_key:
|
224
227
|
specification_version: 4
|
225
|
-
summary: rggen-core-0.
|
228
|
+
summary: rggen-core-0.31.0
|
226
229
|
test_files: []
|