Commit graph

34 commits

Author SHA1 Message Date
Linus Groh
7ef3b42685 LibJS: Simplify TimeZoneNumericUTCOffsetNotAmbiguous
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/ccef468
- https://github.com/tc39/proposal-temporal/commit/5b38ab4
2022-07-05 23:15:52 +02:00
Linus Groh
3720f4bd8f LibJS: Fix production for time zone name in time zone strings
This is a normative change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/caf013a
- https://github.com/tc39/proposal-temporal/commit/fb7cfa6
2022-06-29 07:35:42 +01:00
Linus Groh
3bb94dd62e LibJS: Refactor Temporal parse AOs
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/7fe29eb
2022-06-10 12:39:11 +02:00
Linus Groh
0946f82c8c LibJS: Combine TemporalTimeZoneIdentifier and TimeZoneBracketedName
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6db76f4
2022-05-17 21:14:01 +01:00
Linus Groh
03017be5bd LibJS: Remove redundant TemporalRelativeToString production
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/f85f953
2022-05-16 20:29:32 +01:00
Linus Groh
51e01b5a80 LibJS: Remove redundant TemporalDateString production
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/41a8a5c
2022-05-16 20:28:26 +01:00
Idan Horowitz
7ac9900023 LibJS: Reorder parsing for TimeSpecWithOptionalTimeZoneNotAmbiguous
Because `TimeHour TimeZoneNumericUTCOffsetNotAmbiguous[opt]
TimeZoneBracketedAnnotation[opt]` can be a subset of
`TimeHourNotValidMonth TimeZone` we would not exhaust the whole input
in some cases, which would result in an incorrectly thrown exception.
2022-04-30 18:36:10 +02:00
Linus Groh
b020b8eea2 LibJS: Handle Etc/GMT timezones properly in TimeZone{IANA,Bracketed}Name
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/8c73780
2022-03-31 17:09:10 +01:00
Linus Groh
54af3a5396 LibJS: Adjust grammar for DateExtendedYear to exclude -000000
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/fb3e656

We lose the custom error message, but it's not the end of the world.
2022-03-10 23:20:39 +01:00
Linus Groh
e16821f460 LibJS: Avoid ambiguity in TimeZone production
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/87a6b0d
2022-01-23 00:22:10 +00:00
Linus Groh
0e3def1d0b LibJS: Don't parse/re-format offset in parse_temporal_time_zone_string()
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6abe146
2022-01-23 00:22:10 +00:00
Linus Groh
3bd7f5b89e LibJS: Fully parse the TimeZoneIANAName production
Currently does nothing as we'll declare everything other than UTC as
invalid, but it's a first step towards supporting named time zones :^)
2022-01-06 22:40:09 +01:00
Linus Groh
3ab1c52e2b LibJS: Require 'T' prefix for ambiguous time-only strings
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/514ede3
2021-12-24 00:07:52 +01:00
Linus Groh
f7fe7f8c77 LibJS: Capture TimeFraction parse result instead of Fraction
Not much of a difference as TimeFraction just parses Fraction, but let's
do it correctly. Small mistake I did in 4b7f716.

Thanks to YouTube user gla3dr for noticing this :^)
2021-12-19 09:29:46 +00:00
Linus Groh
01eefc344a LibJS: Disallow date-only strings for PlainTime
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/b16a296
2021-12-18 22:32:39 +00:00
Linus Groh
6da6da73cc LibJS: Allow 'T' prefix in time-only strings
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/f5e8edf
2021-12-18 22:32:39 +00:00
Linus Groh
6d5e95d621 LibJS: Add optional calendar to Plain{Time,YearMonth,MonthDay} prod
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/7e58ba3
2021-12-18 22:32:39 +00:00
Linus Groh
4b7f716f21 LibJS: Fix ambiguity in FractionalPart grammar
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0f11bd6
2021-12-18 22:32:39 +00:00
Linus Groh
f1dafabbb9 LibJS: Simplify TemporalInstantString
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/271d71c
2021-12-08 19:57:19 +00:00
Linus Groh
f7ba81ac52 LibJS: Implement parsing of TemporalDurationString 2021-11-28 10:32:28 +00:00
Linus Groh
908d943e85 LibJS: Parse TemporalInstantString as part of TemporalCalendarString 2021-11-27 23:54:38 +00:00
Linus Groh
ad294ff2ee LibJS: Simplify TemporalRelativeToString
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/d3b2e90
2021-11-24 18:18:05 +00:00
Linus Groh
783222f87a LibJS: Implement parsing of TemporalInstantString 2021-11-20 23:10:09 +00:00
Linus Groh
79a18b058f LibJS: Implement parsing of TemporalCalendarString 2021-11-20 23:10:09 +00:00
Linus Groh
1583c7257c LibJS: Implement parsing of TemporalRelativeToString 2021-11-20 23:10:09 +00:00
Linus Groh
98b876ad3f LibJS: Implement parsing of TemporalZonedDateTimeString 2021-11-20 23:10:09 +00:00
Linus Groh
3b1de431cc LibJS: Implement parsing of TemporalYearMonthString 2021-11-20 23:10:09 +00:00
Linus Groh
3ddab2f4fe LibJS: Implement parsing of TemporalMonthDayString 2021-11-20 23:10:09 +00:00
Linus Groh
453c78215c LibJS: Implement parsing of TemporalTimeString 2021-11-20 23:10:09 +00:00
Linus Groh
b42b7d5f16 LibJS: Implement parsing of TemporalDateTimeString 2021-11-20 23:10:09 +00:00
Linus Groh
02e7de2cba LibJS: Implement parsing of TemporalDateString 2021-11-20 23:10:09 +00:00
Linus Groh
de23f0b68c LibJS: Start fleshing out an ISO 8601 parser for Temporal
This is the start of a parser for the ISO 8601 grammar used in the
Temporal spec:
https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar

We will, on purpose, not use a generic ISO 8601 parser from AK or
similar for two reasons:

- Many AOs make specific assumptions about which productions exist and
  access them directly, even when they're part of a larger production.
- The spec says "The grammar deviates from the standard given in ISO
  8601 in the following ways:" and then lists 17 of such deviations.
  Making that work with a general purpose parser is not worth it.

The public API is not being used anywhere yet, but will be in the next
couple of commits. Likewise, the Production enum will be populated with
all the productions accessed directly (e.g. TemporalDateString).

Many thanks to Ali for showing me how to improve my initial approach
full of macros with a nice RAII helper - it's much nicer :^)

Co-Authored-By: Ali Mohammad Pur <mpfard@serenityos.org>
2021-11-20 23:10:09 +00:00
Idan Horowitz
141c46feda AK: Add a DateTimeLexer
This is an AK::GenericLexer that exposes helper methods for parsing
date and time related literals (years, months, days, hours, minutes,
seconds, fractional seconds & more)
2021-07-12 19:05:17 +01:00
Linus Groh
265e89367e LibJS: Start implementing Temporal.TimeZone
Here we got our first Temporal object :^)
This patch adds the TimeZone object itself, its constructor and
prototype (currently empty), and a bunch of required abstract operations
2021-07-07 00:42:01 +01:00