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

Improve parsing of numbers in util/str.rs #10861

Open
KiChjang opened this issue Apr 26, 2016 · 3 comments
Open

Improve parsing of numbers in util/str.rs #10861

KiChjang opened this issue Apr 26, 2016 · 3 comments

Comments

@KiChjang
Copy link
Member

@KiChjang KiChjang commented Apr 26, 2016

#10608 added support to parse double values from DOMStrings, but the mechanism it uses is messy - we have to keep track of how many digits we've parsed for the units part and the fraction part. We should make use of take_while_ref from the itertools crate.

Code: components/util/str.rs

@SunyDays
Copy link
Contributor

@SunyDays SunyDays commented Apr 29, 2016

I'd like to work on it.
I understand correctly, that tracking number of digits in unit and fraction parts need add to functions read_fraction and read_exponent for control that value which we parse can be stored in f64?

@KiChjang
Copy link
Member Author

@KiChjang KiChjang commented Apr 29, 2016

No, that's not the issue here. We want to not keep track of the number of digits parsed in read_fraction or read_numbers; instead, it should simply mutate the iterator, fast-forwarding to the index after the last digit was parsed. take_while_ref from the itertools crate is perfect for this, but it looks like there are some trait bounds that are not satisfied when I first tried to implement it in #10608.

@KiChjang
Copy link
Member Author

@KiChjang KiChjang commented Jun 9, 2016

Previous attempt at #10974.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.