LibJS: Simplify TimeZoneNumericUTCOffsetNotAmbiguous
This is an editorial change in the Temporal spec. See: - https://github.com/tc39/proposal-temporal/commit/ccef468 - https://github.com/tc39/proposal-temporal/commit/5b38ab4
This commit is contained in:
parent
fec5d8d531
commit
7ef3b42685
Notes:
sideshowbarker
2024-07-17 09:41:19 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/7ef3b42685 Pull-request: https://github.com/SerenityOS/serenity/pull/14496 Reviewed-by: https://github.com/IdanHo ✅
1 changed files with 6 additions and 29 deletions
|
@ -769,36 +769,13 @@ bool ISO8601Parser::parse_time_zone_utc_offset()
|
|||
bool ISO8601Parser::parse_time_zone_numeric_utc_offset_not_ambiguous()
|
||||
{
|
||||
// TimeZoneNumericUTCOffsetNotAmbiguous :
|
||||
// + TimeZoneUTCOffsetHour
|
||||
// U+2212 TimeZoneUTCOffsetHour
|
||||
// TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour : TimeZoneUTCOffsetMinute
|
||||
// TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour TimeZoneUTCOffsetMinute
|
||||
// TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour : TimeZoneUTCOffsetMinute : TimeZoneUTCOffsetSecond TimeZoneUTCOffsetFraction[opt]
|
||||
// TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour TimeZoneUTCOffsetMinute TimeZoneUTCOffsetSecond TimeZoneUTCOffsetFraction[opt]
|
||||
// TimeZoneNumericUTCOffset but not - TimeZoneUTCOffsetHour
|
||||
StateTransaction transaction { *this };
|
||||
if (m_state.lexer.consume_specific('+') || m_state.lexer.consume_specific("\xE2\x88\x92"sv)) {
|
||||
if (!parse_time_zone_utc_offset_hour())
|
||||
return false;
|
||||
} else {
|
||||
if (!parse_time_zone_utc_offset_sign())
|
||||
return false;
|
||||
if (!parse_time_zone_utc_offset_hour())
|
||||
return false;
|
||||
if (m_state.lexer.consume_specific(':')) {
|
||||
if (!parse_time_zone_utc_offset_minute())
|
||||
return false;
|
||||
if (m_state.lexer.consume_specific(':')) {
|
||||
if (!parse_time_zone_utc_offset_second())
|
||||
return false;
|
||||
(void)parse_time_zone_utc_offset_fraction();
|
||||
}
|
||||
} else {
|
||||
if (!parse_time_zone_utc_offset_minute())
|
||||
return false;
|
||||
if (parse_time_zone_utc_offset_second())
|
||||
(void)parse_time_zone_utc_offset_fraction();
|
||||
}
|
||||
}
|
||||
if (!parse_time_zone_numeric_utc_offset())
|
||||
return false;
|
||||
auto parsed = *m_state.parse_result.time_zone_numeric_utc_offset;
|
||||
if (parsed.length() == 3 && parsed[0] == '-')
|
||||
return false;
|
||||
transaction.commit();
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue