mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 01:40:46 +00:00
LibJS: Implement parsing of TemporalInstantString
This commit is contained in:
parent
79a18b058f
commit
783222f87a
Notes:
sideshowbarker
2024-07-18 00:56:06 +09:00
Author: https://github.com/linusg
Commit: 783222f87a
Pull-request: https://github.com/SerenityOS/serenity/pull/10971
Reviewed-by: https://github.com/IdanHo ✅
Reviewed-by: https://github.com/alimpfard
5 changed files with 42 additions and 5 deletions
|
@ -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) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue