-
Notifications
You must be signed in to change notification settings - Fork 53
Expose value parser #423
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
base: 2025-christmas
Are you sure you want to change the base?
Expose value parser #423
Conversation
| date_literal = ${ date_fragment } | ||
| datetime_literal = ${ date_fragment ~ "T" ~ time } | ||
| datetime_tz_literal = ${ date_fragment ~ "T" ~ time ~ ( " " ~ iana_timezone | iso8601_timezone_offset ) } | ||
|
|
||
| duration_literal = ${ "P" ~ ( duration_weeks | duration_date ~ ( "T" ~ duration_time )? | "T" ~ duration_time ) ~ WB} | ||
| duration_literal = ${ "P" ~ ( duration_weeks | duration_date ~ ( "T" ~ duration_time )? | "T" ~ duration_time ) } |
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.
Do we need those WB at the end?
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.
If it's put there intentionally, it seems likely that we do.
PEST doesn't seem to have a lexer/tokenization stage so this is likely to prevent a "higher priority" rule from matching a prefix that should actually match a different rule.
E.g. 2025-12-22T11:44:56Z might be greedily matched by DATE instead of DATETIME, leaving T11:44:56Z to fail the rest of the query.
krishnangovindraj
left a comment
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.
The actual change looks fine. Please revert the WB, or establish we don't need it and remove everywhere in a separate PR.
| date_literal = ${ date_fragment } | ||
| datetime_literal = ${ date_fragment ~ "T" ~ time } | ||
| datetime_tz_literal = ${ date_fragment ~ "T" ~ time ~ ( " " ~ iana_timezone | iso8601_timezone_offset ) } | ||
|
|
||
| duration_literal = ${ "P" ~ ( duration_weeks | duration_date ~ ( "T" ~ duration_time )? | "T" ~ duration_time ) ~ WB} | ||
| duration_literal = ${ "P" ~ ( duration_weeks | duration_date ~ ( "T" ~ duration_time )? | "T" ~ duration_time ) } |
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.
If it's put there intentionally, it seems likely that we do.
PEST doesn't seem to have a lexer/tokenization stage so this is likely to prevent a "higher priority" rule from matching a prefix that should actually match a different rule.
E.g. 2025-12-22T11:44:56Z might be greedily matched by DATE instead of DATETIME, leaving T11:44:56Z to fail the rest of the query.
Product change and motivation
We expose value parsing as a top-level function, and update the value literal definitions.