LibJS: Combine TemporalTimeZoneIdentifier and TimeZoneBracketedName

This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6db76f4
This commit is contained in:
Linus Groh 2022-05-17 21:14:01 +01:00
parent 9b4aabbcf9
commit 0946f82c8c
Notes: sideshowbarker 2024-07-17 10:53:12 +09:00
2 changed files with 8 additions and 19 deletions

View file

@ -950,10 +950,10 @@ bool ISO8601Parser::parse_time_zone_iana_name()
return true;
}
// https://tc39.es/proposal-temporal/#prod-TimeZoneBracketedName
bool ISO8601Parser::parse_time_zone_bracketed_name()
// https://tc39.es/proposal-temporal/#prod-TimeZoneIdentifier
bool ISO8601Parser::parse_time_zone_identifier()
{
// TimeZoneBracketedName :
// TimeZoneIdentifier :
// TimeZoneIANAName
// TimeZoneUTCOffsetName
StateTransaction transaction { *this };
@ -970,11 +970,11 @@ bool ISO8601Parser::parse_time_zone_bracketed_name()
bool ISO8601Parser::parse_time_zone_bracketed_annotation()
{
// TimeZoneBracketedAnnotation :
// [ TimeZoneBracketedName ]
// [ TimeZoneIdentifier ]
StateTransaction transaction { *this };
if (!m_state.lexer.consume_specific('['))
return false;
if (!parse_time_zone_bracketed_name())
if (!parse_time_zone_identifier())
return false;
if (!m_state.lexer.consume_specific(']'))
return false;
@ -1650,24 +1650,14 @@ bool ISO8601Parser::parse_temporal_time_string()
|| parse_calendar_time();
}
// https://tc39.es/proposal-temporal/#prod-TemporalTimeZoneIdentifier
bool ISO8601Parser::parse_temporal_time_zone_identifier()
{
// TemporalTimeZoneIdentifier :
// TimeZoneNumericUTCOffset
// TimeZoneIANAName
return parse_time_zone_numeric_utc_offset()
|| parse_time_zone_iana_name();
}
// https://tc39.es/proposal-temporal/#prod-TemporalTimeZoneString
bool ISO8601Parser::parse_temporal_time_zone_string()
{
// TemporalTimeZoneString :
// TemporalTimeZoneIdentifier
// TimeZoneIdentifier
// Date TimeSpecSeparator[opt] TimeZone Calendar[opt]
StateTransaction transaction { *this };
if (!parse_temporal_time_zone_identifier()) {
if (!parse_time_zone_identifier()) {
if (!parse_date())
return false;
(void)parse_time_spec_separator();

View file

@ -136,7 +136,7 @@ public:
[[nodiscard]] bool parse_time_zone_iana_component();
[[nodiscard]] bool parse_time_zone_iana_name_tail();
[[nodiscard]] bool parse_time_zone_iana_name();
[[nodiscard]] bool parse_time_zone_bracketed_name();
[[nodiscard]] bool parse_time_zone_identifier();
[[nodiscard]] bool parse_time_zone_bracketed_annotation();
[[nodiscard]] bool parse_time_zone_offset_required();
[[nodiscard]] bool parse_time_zone_name_required();
@ -176,7 +176,6 @@ public:
[[nodiscard]] bool parse_temporal_duration_string();
[[nodiscard]] bool parse_temporal_month_day_string();
[[nodiscard]] bool parse_temporal_time_string();
[[nodiscard]] bool parse_temporal_time_zone_identifier();
[[nodiscard]] bool parse_temporal_time_zone_string();
[[nodiscard]] bool parse_temporal_year_month_string();
[[nodiscard]] bool parse_temporal_zoned_date_time_string();