95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/fluent/compat/parser.rb', line 95
def self.lookup(format)
if format.nil?
raise ConfigError, "'format' parameter is required"
end
if format[0] == ?/ && format[format.length-1] == ?/
begin
regexp = Regexp.new(format[1..-2])
if regexp.named_captures.empty?
raise "No named captures"
end
rescue
raise ConfigError, "Invalid regexp '#{format[1..-2]}': #{$!}"
end
RegexpParser.new(regexp)
else
begin
Fluent::Plugin.new_parser(format)
rescue ConfigError raise ConfigError, "Unknown format template '#{format}'"
end
end
end
|