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
Date literal as @ notation #416
Conversation
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.
Changes look good @saig0! 🚀
I have some very minor suggestions for the documentation. But I'm mostly interested in the question I asked 😄
P( | ||
("duration" | "date and time" | "date" | "time").! ~ "(" ~ stringWithQuotes ~ ")" | ||
(("duration" | "date and time" | "date" | "time").! ~ "(" ~ stringWithQuotes ~ ")") | | ||
("@".! ~ stringWithQuotes) | ||
).map { |
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.
❓ Just verifying I understand what this does correctly. I'm not sure what the P
is, but it seems to be part of some parsing library (and it's different from the generic P used in the function definition).
I suppose it is matching an input string to see if it contains either duration
, date and time
, date
or time
followed by a string with quotes between parentheses. E.g. duration("P1Y")
.
Or it contains an @
followed by a string with quotes. E.g. @"P1Y"
.
I'm not sure what this P
function returns but we match this against the temporal and find the correct parsing function for it.
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.
You can read more about the underlying parser library here: https://com-lihaoyi.github.io/fastparse/
The docs are nicely written. But I'm also happy to talk about it and how it is used in the FEEL engine. Just ping me 🛎️
Description
@
- notation for temporal values (e.g.@"2022-04-22"
)date("2022-04-22")
)Note that I used the existing parser capabilities for temporal values to keep the changes small. At some point, we should refactor how temporal values are parsed. But not now 😅
Related issues
closes #297