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

is_hexdig is not pedantic #12

Closed
Stargateur opened this issue Aug 18, 2021 · 3 comments
Closed

is_hexdig is not pedantic #12

Stargateur opened this issue Aug 18, 2021 · 3 comments

Comments

@Stargateur
Copy link
Contributor

Stargateur commented Aug 18, 2021

abnf-core/src/lib.rs

Lines 42 to 44 in b1fcead

pub fn is_hexdig(c: char) -> bool {
c.is_ascii_hexdigit()
}

Currently is_hexdig allow for either uppercase or lowercase hex digit but abnf dictate:

HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"

That only allow uppercase. I don't know what to do cause this could make a big breaking to be pedantic, even if we introduce a is_hexdig_relaxed like in complete module.

@duesee
Copy link
Owner

duesee commented Aug 18, 2021

Hm... I think we should try to stick to the RFC as close as possible and deviate from it only for good reasons. So I would consider is_hexdig accepting lowercase alpha characters a mistake. I like the idea to allow this in a _relaxed version, though.

@Stargateur
Copy link
Contributor Author

nevermind:

ABNF strings are case insensitive and the character set for these strings is US-ASCII.

is_hexdig is expected to match "abcdef" too.

I didn't know this rule.

@duesee
Copy link
Owner

duesee commented Aug 18, 2021

Argh, you are right. I knew that strings are case-insensitive in ABNF, but my brain ignored that rule for single-char strings like "A", "B", ... somehow. ABNF can be confusing.

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

No branches or pull requests

2 participants