6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/pubid/bsi/identifier.rb', line 6
def self.parse(string)
if string.match?(/\bIEC\b/) &&
(string.match?(/\s+(CSV|CMV|RLV|SER|EXV|PAC|PRV)\b/) ||
string.match?(/\+AMD\d+:/) ||
string.match?(/\+COR\d+:/))
return Pubid::Iec.parse(string)
end
parser = Parser.new
scheme = Scheme.new
parsed = parser.parse(string)
Builder.build(parsed, scheme)
rescue Parslet::ParseFailed => e
raise StandardError, "Failed to parse '#{string}': #{e.message}"
end
|