-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collapse grammar nonterminals that are only distinct for the purposes of disambiguation #2006
Comments
Related improvements are also possible with nonterminal parameterization, e.g. TimeZoneNumericUTCOffset :
- TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour
- TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour `:` TimeZoneUTCOffsetMinute
- TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour TimeZoneUTCOffsetMinute
- TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour `:` TimeZoneUTCOffsetMinute `:` TimeZoneUTCOffsetSecond TimeZoneUTCOffsetFraction?
- TimeZoneUTCOffsetSign TimeZoneUTCOffsetHour TimeZoneUTCOffsetMinute TimeZoneUTCOffsetSecond TimeZoneUTCOffsetFraction?
+ Sign HourComponents[+Extended]?
+ Sign HourComponents[~Extended]?
+
+ HourComponents[Extended] :
+ Hour
+ Hour TimeSeparator[?Extended] Minute
+ Hour TimeSeparator[?Extended] Minute TimeSeparator[?Extended] Second Fraction?
+
+ TimeSeparator[Extended] :
+ [+Extended] `:`
+ [~Extended] [empty] |
Offset grammar will be different between ISO string offsets and offset time zone identifiers after the minutes PR is merged. Does that change any of the simplifications planned here? |
Not really; UTCOffset nonterminals are now distinct for a legitimate reason and already incorporate parameterization as appropriate. But I still think some improvements are possible with respect to e.g. |TimeHour|/|TimeMinute|/|TimeFraction|/|TimeSpec| and the Duration productions. |
Prefer language like "the first |TemporalDecimalFraction|, if present" rather than defining several nonterminals such as |TimeFraction|, |DurationHoursFraction|, etc. Closes: #2006
Prefer language like "the first |TemporalDecimalFraction|, if present" rather than defining several nonterminals such as |TimeFraction|, |DurationHoursFraction|, etc. Closes: #2006
Prefer language like "the first |TemporalDecimalFraction|, if present" rather than defining several nonterminals such as |TimeFraction|, |DurationHoursFraction|, etc. Closes: #2006
@gibson042 pointed out that we don't need to have separate nonterminals such as TimeZoneNumericUTCOffset and TimeZoneUTCOffsetName in order to disambiguate in cases such as #1796. We can refer to things like "the first |FractionalPart|, if present", cf. https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forloopevaluation
The text was updated successfully, but these errors were encountered: