Content deleted Content added
place variant tags in array if there is more than one |
m easier to read |
||
Line 486:
-- Not all potential subtags were matched. Check for private-use subtags.
-- https://tools.ietf.org/html/bcp47#section-2.2.7
-- Private-use subtags consist of
-- alphanumeric characters preceded by "x-".
-- Alphanumericity has already been checked.
if potential_subtags[last_matched_subtag_i + 1]
-- Check length of all following subtags.▼
if not potential_subtags[last_matched_subtag_i + 2] then▼
return parsed_subtags:throw("empty private-use subtag",▼
last_matched_subtag_i + 1)▼
end▼
for i = last_matched_subtag_i + 2, #potential_subtags do▼
local length = #potential_subtags[i]▼
if not (1 <= length and length <= 8) then▼
return parsed_subtags▼
:throw("length of private-use subtag out of range",▼
last_matched_subtag_i + 1)▼
end▼
end▼
parsed_subtags.private_use = table.concat(potential_subtags, "-",▼
last_matched_subtag_i + 1)▼
return parsed_subtags:throw("invalid subtag",
last_matched_subtag_i + 1)
end
▲ last_matched_subtag_i + 1)
▲ end
end
|