Skip to content
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

Considered using https://github.com/coreutils/gnulib/blob/master/lib/parse-datetime.y ? #12

Open
scuzzycheese opened this issue Jun 17, 2020 · 2 comments

Comments

@scuzzycheese
Copy link

scuzzycheese commented Jun 17, 2020

It seems Coreutils has a very nice implementation of this that works super reliably?
https://github.com/coreutils/gnulib/blob/master/lib/parse-datetime.y

@evanjs
Copy link

evanjs commented Jun 17, 2020

This is something I've been wondering since realizing https://github.com/uutils/coreutils does not yet have this feature (IIRC).

I've never been too familiar with parsers or lexers, and while I'm very happy this crate exists, I have run into some issues with parsing, most lately, e.g. <week-day> 12pm

This simply returns "bad date".

I also wonder if there's a way to leverage the lexing and etc work done in coreutils.

@stevedonovan
Copy link
Owner

Ah, a yacc grammar! When I was first wondering how date did its magic, I looked for a formal specification. So this crate makes it up. I think we can tighten things up a lot, and produce better error messages (for me bringing in a grammar would be a nuclear option, only if we cannot resolve issues. But it is a useful reference)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants