1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 06:28:13 +00:00

LibJS: Implement parsing of TemporalInstantString

This commit is contained in:
Linus Groh 2021-11-20 16:50:56 +00:00
parent 79a18b058f
commit 783222f87a
5 changed files with 42 additions and 5 deletions

View file

@ -746,6 +746,27 @@ bool ISO8601Parser::parse_calendar_date_time()
return true;
}
// https://tc39.es/proposal-temporal/#prod-TemporalInstantString
bool ISO8601Parser::parse_temporal_instant_string()
{
// TemporalInstantString :
// Date TimeZoneOffsetRequired
// Date DateTimeSeparator TimeSpec TimeZoneOffsetRequired
StateTransaction transaction { *this };
if (!parse_date())
return false;
if (!parse_time_zone_offset_required()) {
if (!parse_date_time_separator())
return false;
if (!parse_time_spec())
return false;
if (!parse_time_zone_offset_required())
return false;
}
transaction.commit();
return true;
}
// https://tc39.es/proposal-temporal/#prod-TemporalDateString
bool ISO8601Parser::parse_temporal_date_string()
{
@ -874,6 +895,7 @@ bool ISO8601Parser::parse_temporal_relative_to_string()
}
#define JS_ENUMERATE_ISO8601_PRODUCTION_PARSERS \
__JS_ENUMERATE(TemporalInstantString, parse_temporal_instant_string) \
__JS_ENUMERATE(TemporalDateString, parse_temporal_date_string) \
__JS_ENUMERATE(TemporalDateTimeString, parse_temporal_date_time_string) \
__JS_ENUMERATE(TemporalMonthDayString, parse_temporal_month_day_string) \