Kotlin / kotlinx-datetime

KotlinX multiplatform date/time library
Apache License 2.0
2.43k stars 102 forks source link

Fix using `optional` between numbers #362

Closed dkhalanskyjb closed 6 months ago

dkhalanskyjb commented 8 months ago

See the commit message for details of the bug.

dkhalanskyjb commented 8 months ago

There is still a way to make parsers fail when their specification is unambiguous, for example, with something like

dayOfMonth(Padding.NONE)
monthName(MonthNames("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"))

as the trie doesn't get merged with the neighboring number consumers. Fixing it is completely doable, which is why we don't restrict this usage, but it would severely overcomplicate the code and would probably not help anyone at all.