Content deleted Content added
check length of private-use subtag; make "throw" method returnable |
private-use subtag can have multiple following subtags not introduced separately by "x"? |
||
Line 466:
-- Not all potential subtags were matched. Check for private-use subtags.
-- https://tools.ietf.org/html/bcp47#section-2.2.7
-- consisting of 1 to 8 alphanumeric characters.
for subtag_i = last_matched_subtag_i + 1, #potential_subtags do▼
-- Alphanumericity has already been checked.
-- Check length of all following subtags.
end▼
return parsed_subtags:throw("invalid subtag", last_matched_subtag_i + 1)▼
return parsed_subtags
last_matched_subtag_i + 1)
▲ end
▲ -- Private-use subtags consist of "x-" followed by 1 to 8 alphanumeric characters.
end
last_matched_subtag_i + 1)
▲ parsed_subtags.private_use = parsed_subtags.private_use or {}
else
▲ local subtag = table.concat(potential_subtags, "-",
last_matched_subtag_i + 1)
▲ if not (3 <= #subtag and #subtag <= 10) then -- "u-x" - "u-xxxxxxxx"
▲ return parsed_subtags:throw("length of private-use subtag out of range",
end
end
|