Author: Tom Sydney Kerckhove <syd@cs-syd.eu>
Committer: Tom Sydney Kerckhove <NorfairKing@users.noreply.github.com>
ical: read a two-digit BYDAY ordinal
GREEN for the tests in the previous commit.
'specificP' now takes the digits as a run instead of one at a time, so the
ordinals the grammar allows can be read:
weekdaynum = [[plus / minus] ordwk] weekday
ordwk = 1*2DIGIT ;1 to 53
10MO through 53SU used to fail to parse: the first digit was read as the
whole ordinal and the rest was handed to 'parseDayOfWeek', which could
make nothing of "0MO". A leading '+' is accepted too, which the grammar
allows and which the old code also could not read.
'ByDay' declares its ordinal between -53 and 53 rather than -5 and 5. The
tighter bound fits a MONTHLY rule, where a weekday recurs at most five
times, but this type does not know the frequency and the same section says
the ordinal is an offset within the year for a YEARLY rule without
BYMONTH. A restriction that depends on the frequency belongs in
'Validity RecurrenceRule', which already carries one for BYDAY.
Between the old parser and the old bound, 6MO through 9MO parsed into
values that failed their own 'Validity'. Both ends of that are gone.
'GenValid ByDay' and its shrinker widen to match, so the roundtrip
property in 'recurrenceRulePartSpec' now actually exercises two-digit
ordinals. The recurrence implementation needs no change: it compares the
ordinal against a computed index, so one that cannot occur simply matches
nothing.