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

Small parser refactor / cleanup #30

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Small parser refactor / cleanup #30

merged 1 commit into from
Feb 29, 2024

Conversation

nekevss
Copy link
Member

@nekevss nekevss commented Feb 29, 2024

This PR streamlines some of the ISO8601 parsing and removes unnecessary iterations.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactor! Makes it very clean for numeric parses.

if !(0..=23).contains(&hour_value) {
return Err(TemporalError::syntax().with_message("Hour must be in a range of 0-23"));
}
Ok(hour_value)
}

// NOTE: `TimeSecond` is a 60 inclusive `MinuteSecond`.
/// Parse `MinuteSecond`
/// Parse `MinuteSecond` value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link to the corresponding grammar rule?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do. Better documentation all the way around is definitely needed. Should we update the grammar rules as a whole in a follow-up PR or do you mind if I add them in on this PR?

Copy link
Member

@jedel1043 jedel1043 Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you plan on doing a PR only for documentation, you can postpone this change for that PR.

@jedel1043 jedel1043 merged commit daf4911 into main Feb 29, 2024
5 checks passed
@jedel1043 jedel1043 deleted the parser-cleanup branch February 29, 2024 19:42
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

Successfully merging this pull request may close these issues.

2 participants