Make a beginning of parsing GNU date items with nom#25
Make a beginning of parsing GNU date items with nom#25wanderinglethe wants to merge 3 commits intouutils:mainfrom
items with nom#25Conversation
| @@ -0,0 +1,22 @@ | |||
| ## General date syntax | |||
There was a problem hiding this comment.
would be nice to have examples
There was a problem hiding this comment.
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: |
| [dependencies] | ||
| regex = "1.8" | ||
| chrono = { version="0.4", default-features=false, features=["std", "alloc", "clock"] } | ||
| nom = "7.1" No newline at end of file |
There was a problem hiding this comment.
| 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.
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.