[Temporal] Clean up parser

Remove unused parser function/rule
ParseTemporalTimeZoneString and ParseTemporalCalendarString
were obsoleted by PR 2385 and 2394
in https://chromium-review.googlesource.com/c/v8/v8/+/3893552
https://chromium-review.googlesource.com/c/v8/v8/+/3901196

This cl is purely unused code removal.

Bug: v8:11544
Change-Id: Ib7ff4a3860cffa09afe7c7f6866f8dc526273f34
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3917039
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83460}
This commit is contained in:
Frank Tang 2022-09-23 23:28:46 -07:00 committed by V8 LUCI CQ
parent 0c1457ea28
commit de1d7b33d6
3 changed files with 2 additions and 105 deletions

View File

@ -1055,31 +1055,6 @@ int32_t ScanTemporalZonedDateTimeString(base::Vector<Char> str, int32_t s,
SCAN_FORWARD(TemporalDateTimeString, CalendarDateTime, ParsedISO8601Result)
// Date [TimeSpecSeparator] TimeZone [Calendar]
template <typename Char>
int32_t ScanDate_TimeSpecSeparator_TimeZone_Calendar(base::Vector<Char> str,
int32_t s,
ParsedISO8601Result* r) {
int32_t cur = s;
int32_t len = ScanDate(str, cur, r);
if (len == 0) return 0;
cur = len;
cur += ScanTimeSpecSeparator(str, cur, r);
len = ScanTimeZone(str, cur, r);
if (len == 0) return 0;
cur += len;
cur += ScanCalendar(str, cur, r);
return cur - s;
}
// TemporalTimeZoneString:
// TimeZoneIdentifier
// Date [TimeSpecSeparator] TimeZone [Calendar]
// The lookahead is at most 8 chars.
SCAN_EITHER_FORWARD(TemporalTimeZoneString, TimeZoneIdentifier,
Date_TimeSpecSeparator_TimeZone_Calendar,
ParsedISO8601Result)
// TemporalMonthDayString
// DateSpecMonthDay
// CalendarDateTime
@ -1140,7 +1115,6 @@ SATISIFY(TemporalDateTimeString, ParsedISO8601Result)
SATISIFY(DateTime, ParsedISO8601Result)
SATISIFY(DateSpecYearMonth, ParsedISO8601Result)
SATISIFY(DateSpecMonthDay, ParsedISO8601Result)
SATISIFY(Date_TimeSpecSeparator_TimeZone_Calendar, ParsedISO8601Result)
SATISIFY(CalendarDateTime, ParsedISO8601Result)
SATISIFY(CalendarTime_L1, ParsedISO8601Result)
SATISIFY(CalendarTime_L2, ParsedISO8601Result)
@ -1160,32 +1134,11 @@ SATISIFY_EITHER(TemporalMonthDayString, DateSpecMonthDay, CalendarDateTime,
ParsedISO8601Result)
SATISIFY(TimeZoneNumericUTCOffset, ParsedISO8601Result)
SATISIFY(TimeZoneIdentifier, ParsedISO8601Result)
SATISIFY_EITHER(TemporalTimeZoneString, TimeZoneIdentifier,
Date_TimeSpecSeparator_TimeZone_Calendar, ParsedISO8601Result)
SATISIFY(TemporalInstantString, ParsedISO8601Result)
SATISIFY(TemporalZonedDateTimeString, ParsedISO8601Result)
SATISIFY(CalendarName, ParsedISO8601Result)
// TemporalCalendarString :
// CalendarName
// TemporalInstantString
// CalendarDateTime
// CalendarTime
// DateSpecYearMonth
// DateSpecMonthDay
template <typename Char>
bool SatisfyTemporalCalendarString(base::Vector<Char> str,
ParsedISO8601Result* r) {
IF_SATISFY_RETURN(CalendarName)
IF_SATISFY_RETURN(TemporalInstantString)
IF_SATISFY_RETURN(CalendarDateTime)
IF_SATISFY_RETURN(CalendarTime)
IF_SATISFY_RETURN(DateSpecYearMonth)
IF_SATISFY_RETURN(DateSpecMonthDay)
return false;
}
// Duration
// Digits : Digit [Digits]
@ -1445,9 +1398,7 @@ IMPL_PARSE_METHOD(ParsedISO8601Result, TemporalMonthDayString)
IMPL_PARSE_METHOD(ParsedISO8601Result, TemporalTimeString)
IMPL_PARSE_METHOD(ParsedISO8601Result, TemporalInstantString)
IMPL_PARSE_METHOD(ParsedISO8601Result, TemporalZonedDateTimeString)
IMPL_PARSE_METHOD(ParsedISO8601Result, TemporalTimeZoneString)
IMPL_PARSE_METHOD(ParsedISO8601Result, TimeZoneIdentifier)
IMPL_PARSE_METHOD(ParsedISO8601Result, TemporalCalendarString)
IMPL_PARSE_METHOD(ParsedISO8601Result, CalendarName)
IMPL_PARSE_METHOD(ParsedISO8601Result, TimeZoneNumericUTCOffset)
IMPL_PARSE_METHOD(ParsedISO8601Duration, TemporalDurationString)

View File

@ -15,9 +15,9 @@ namespace internal {
* ParsedISO8601Result contains the parsed result of ISO 8601 grammar
* documented in #sec-temporal-iso8601grammar
* for TemporalInstantString, TemporalZonedDateTimeString,
* TemporalCalendarString, TemporalDateString, TemporalDateTimeString,
* CalendarName, TemporalDateString, TemporalDateTimeString,
* TemporalMonthDayString, TemporalRelativeToString, TemporalTimeString,
* TemporalTimeZoneString, and TemporalYearMonthString. For all the fields
* TimeZoneIdentifier, and TemporalYearMonthString. For all the fields
* represented by int32_t, a special value kMinInt31 is used to represent the
* field is "undefined" after parsing.
*/
@ -143,10 +143,8 @@ class V8_EXPORT_PRIVATE TemporalParser {
DEFINE_PARSE_METHOD(ParsedISO8601Result, TemporalMonthDayString);
DEFINE_PARSE_METHOD(ParsedISO8601Result, TemporalInstantString);
DEFINE_PARSE_METHOD(ParsedISO8601Result, TemporalZonedDateTimeString);
DEFINE_PARSE_METHOD(ParsedISO8601Result, TemporalTimeZoneString);
DEFINE_PARSE_METHOD(ParsedISO8601Result, TimeZoneIdentifier);
DEFINE_PARSE_METHOD(ParsedISO8601Result, TemporalRelativeToString);
DEFINE_PARSE_METHOD(ParsedISO8601Result, TemporalCalendarString);
DEFINE_PARSE_METHOD(ParsedISO8601Result, CalendarName);
DEFINE_PARSE_METHOD(ParsedISO8601Duration, TemporalDurationString);
DEFINE_PARSE_METHOD(ParsedISO8601Result, TimeZoneNumericUTCOffset);

View File

@ -158,17 +158,6 @@ class TemporalParserTest : public TestWithIsolate {
}
}
void VerifyParseTemporalCalendarStringSuccess(
const char* str, const std::string& calendar_name) {
Handle<String> input = MakeString(str);
base::Optional<ParsedISO8601Result> result =
TemporalParser::ParseTemporalCalendarString(i_isolate(), input);
CHECK(result.has_value());
ParsedISO8601Result actual = *result;
CheckCalendar(i_isolate(), input, actual.calendar_name_start,
actual.calendar_name_length, calendar_name);
}
void VerifyParseCalendarNameSuccess(const char* str) {
Handle<String> input = MakeString(str);
base::Optional<ParsedISO8601Result> result =
@ -1627,47 +1616,6 @@ TEST_F(TemporalParserTest, TemporalZonedDateTimeStringIllegal) {
VERIFY_PARSE_FAIL_ON_ZONED_DATE_TIME(TemporalZonedDateTimeString);
}
TEST_F(TemporalParserTest, TemporalCalendarStringSuccess) {
// CalendarName
VerifyParseTemporalCalendarStringSuccess("chinese", "chinese");
VerifyParseTemporalCalendarStringSuccess("roc", "roc");
VerifyParseTemporalCalendarStringSuccess("indian", "indian");
VerifyParseTemporalCalendarStringSuccess("persian", "persian");
VerifyParseTemporalCalendarStringSuccess("abcd-efghi", "abcd-efghi");
VerifyParseTemporalCalendarStringSuccess("abcd-efghi", "abcd-efghi");
VerifyParseTemporalCalendarStringSuccess(
"a2345678-b2345678-c2345678-d7654321",
"a2345678-b2345678-c2345678-d7654321");
// TemporalInstantString
VerifyParseTemporalCalendarStringSuccess("2021-11-08z[ABCD]", "");
// CalendarDateTime
VerifyParseTemporalCalendarStringSuccess("2021-11-08[u-ca=chinese]",
"chinese");
VerifyParseTemporalCalendarStringSuccess("2021-11-08[ABCDEFG][u-ca=chinese]",
"chinese");
VerifyParseTemporalCalendarStringSuccess(
"2021-11-08[ABCDEFG/hijklmn][u-ca=roc]", "roc");
// Time
VerifyParseTemporalCalendarStringSuccess("23:45:59", "");
// DateSpecYearMonth
VerifyParseTemporalCalendarStringSuccess("2021-12", "");
// DateSpecMonthDay
VerifyParseTemporalCalendarStringSuccess("--12-31", "");
VerifyParseTemporalCalendarStringSuccess("12-31", "");
VerifyParseTemporalCalendarStringSuccess("--1231", "");
}
TEST_F(TemporalParserTest, TemporalCalendarStringIllegal) {
VERIFY_PARSE_FAIL(TemporalCalendarString, "20210304[u-ca=]");
VERIFY_PARSE_FAIL(TemporalCalendarString, "20210304[u-ca=a]");
VERIFY_PARSE_FAIL(TemporalCalendarString, "20210304[u-ca=ab]");
VERIFY_PARSE_FAIL(TemporalCalendarString, "20210304[u-ca=abcdef-ab]");
VERIFY_PARSE_FAIL(TemporalCalendarString, "20210304[u-ca=abcdefghijkl]");
// It is a Syntax Error if DateExtendedYear is "-000000"
VERIFY_PARSE_FAIL(TemporalCalendarString, "-0000000304[u-ca=abcdef-ab]");
VERIFY_PARSE_FAIL(TemporalCalendarString, "\u22120000000304[u-ca=abcdef-ab]");
}
constexpr int64_t empty = ParsedISO8601Duration::kEmpty;
// Test basic cases.