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

Use of num-parse to parse integers #65

Merged
merged 6 commits into from
Jul 5, 2022
Merged

Conversation

phorward
Copy link
Member

@phorward phorward commented Jul 5, 2022

The num-parse-crate was established from the requirement that there is no existing JavaScript-like parseInt() or parseFloat() method in Rust.

This crate is developed apart from Tokay, but Tokay makes both use of it in terms of the internal string-to-int-conversion functions as well as the Int-token. For this case, the Reader needed to be modified to implement PeekableIterator from num-parse to use equal parsing features in all cases.

num-parse will be extended to support a parse_float() as well, which will be integrated into Tokay as well then.

phorward added 6 commits June 30, 2022 14:59
To simplify parseInt()-/parseFloat()-style value extraction from strings, a new crate num-parse was started to provide a generic implementation for this.
This commit allows to use num_parse to implement the Int token without headaches. Previous experiments failed as the Reader was wrapped by a Peekable, which doesn't work.

There should be some improvement on Reader as well regarding the internal input buffing, which is a little crank.
@phorward phorward merged commit 5f88a84 into tokay-lang:main Jul 5, 2022
@phorward phorward deleted the num-parse branch July 14, 2022 13:49
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.

1 participant