1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:07:36 +00:00

LibJS: Implement parsing of TemporalCalendarString

This commit is contained in:
Linus Groh 2021-11-20 01:28:46 +00:00
parent 1583c7257c
commit 79a18b058f
6 changed files with 33 additions and 9 deletions

View file

@ -843,6 +843,24 @@ bool ISO8601Parser::parse_temporal_zoned_date_time_string()
return true;
}
// https://tc39.es/proposal-temporal/#prod-TemporalCalendarString
bool ISO8601Parser::parse_temporal_calendar_string()
{
// TemporalCalendarString :
// CalendarName
// TemporalInstantString
// CalendarDateTime
// Time
// DateSpecYearMonth
// DateSpecMonthDay
return parse_calendar_name()
// TODO: || parse_temporal_instant_string()
|| parse_calendar_date_time()
|| parse_date_spec_year_month()
|| parse_date_spec_month_day()
|| parse_time();
}
// https://tc39.es/proposal-temporal/#prod-TemporalRelativeToString
bool ISO8601Parser::parse_temporal_relative_to_string()
{
@ -863,6 +881,7 @@ bool ISO8601Parser::parse_temporal_relative_to_string()
__JS_ENUMERATE(TemporalTimeZoneString, parse_temporal_time_zone_string) \
__JS_ENUMERATE(TemporalYearMonthString, parse_temporal_year_month_string) \
__JS_ENUMERATE(TemporalZonedDateTimeString, parse_temporal_zoned_date_time_string) \
__JS_ENUMERATE(TemporalCalendarString, parse_temporal_calendar_string) \
__JS_ENUMERATE(TemporalRelativeToString, parse_temporal_relative_to_string)
Optional<ParseResult> parse_iso8601(Production production, StringView input)