-
Notifications
You must be signed in to change notification settings - Fork 26
Make a beginning of parsing GNU date items
with nom
#25
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
Conversation
@@ -0,0 +1,22 @@ | |||
## General date syntax |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to have examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't knew I committed this file, not really sure if we should add this because it's straight out of the GNU docs.
Although I guess we can have some supported GNU features in the documentation.
And maybe some tracking issue for all GNU features.
I guess you saw:
|
@@ -10,3 +10,4 @@ readme = "README.md" | |||
[dependencies] | |||
regex = "1.8" | |||
chrono = { version="0.4", default-features=false, features=["std", "alloc", "clock"] } | |||
nom = "7.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nom = "7.1" | |
nom = "7.1" | |
Looks but could you please update the README?
|
@wanderinglethe ping? |
macro_rules! t12 { | ||
($name:ident : $input:literal => $hours:literal:$minutes:literal:$seconds:literal:$nanoseconds:literal + $tail:literal) => { | ||
ptest! { $name : time_of_day_12($input) => RawTimeOfDay { hours: $hours, minutes: $minutes, seconds: $seconds, nanoseconds: $nanoseconds }, $tail } | ||
}; | ||
($name:ident : $input:literal => X) => { | ||
ptest! { $name : time_of_day_12($input) => X } | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's too many macros that could be fairly simple functions. It's not really a problem if tests are a bit verbose :)
I think we should do this in another PR. I'd like to merge this relatively soon, so we can build further with it. |
@wanderinglethe are you still working on the pr or may i take over it? |
I am sorry @philolo1, I missed your question and wasn't able to participate. |
GNU date understands multiple "items", currently uutils date only supports a limited amount of formats.
To support more formats I looked into using nom to parse these items. These items then need to be verified and combined to calculate a single date time.
Since this is my first using nom and I don't have much experience with Rust, please give feedback on style, design.