-
Notifications
You must be signed in to change notification settings - Fork 18
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
Strict or relaxed parser mode #27
Comments
I would think that it would be better to have a |
Would you mind giving an example or a function signature? (like in my post) I understood it like this; fn parse_optioned(input: &str, config: Option<Config>) -> crate::Result<_>;
fn parse(input: &str, config: Config) -> crate::Result<_>; // variable strictness?
fn parse_relaxed(input: &str) -> crate::Result<_>;
// this would call parse_optioned with `None` I like the idea of having a |
I think of it like this fn parse_optioned(input: &str, config: Config) -> Result<_>;
fn parse(input: &str) -> crate::Result<_> {
parse_optioned(input, Config{/* Strict config */}
}
fn parse_relaxed(input: &str) -> crate::Result<_> {
parse_optioned(input, Config{/* Relaxed config */}
} |
Wouldn't this defeat the purpose, of having a fn parse(input: &str); // relaxed
fn parse_with(|config| {
// edit config here
config
}); |
In the example I provided the Cofig is user configurable. You could for
example have a config builder or similar.
But there are just default configs if tuning is not required.
Den man. 23. sep. 2019 kl. 20.53 skrev Lucas <[email protected]>:
… Wouldn't this defeat the purpose, of having a Config? If there is a
Config, it should be configurable by the user, for example like this;
fn parse(input: &str); // relaxedfn parse_with(|config| {
// edit config here
config
});
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#27?email_source=notifications&email_token=AA35PJE66ANB72HIQIGCFXLQLEGD7A5CNFSM4IYGP3Z2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7L4O7Q#issuecomment-534235006>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA35PJAEG35FJKFL2WZC6WTQLEGD7ANCNFSM4IYGP3ZQ>
.
|
By default the parser should try to parse everything possible without erroring. Sometimes it might be useful to check for any malformed input/errors and this could be done by a "strict" flag?
The text was updated successfully, but these errors were encountered: