Skip to content

Precompile jNumberRegex or move to manual verification #32

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

Closed
sirthias opened this issue Jul 4, 2017 · 2 comments
Closed

Precompile jNumberRegex or move to manual verification #32

sirthias opened this issue Jul 4, 2017 · 2 comments

Comments

@sirthias
Copy link

sirthias commented Jul 4, 2017

Currently jNumberRegex is a simple String, which means that for every application of the regex, i.e. every creation of a JNumber instance from a String the regex has to be compiled before it is run.

IMHO the regex should be precompiled or, even better, turned into a manual check.

Of course one could also debate whether the check is really necessary at all, since JNumber instances will typically be created either by a parser or by one of the non-string JNumber.apply overloads, which will never created illegal number strings anyway.

@mdedetrich
Copy link
Owner

mdedetrich commented Jul 4, 2017

@sirthias Are you aware of a regex precompiler for Scala/Java?

EDIT: nvm, just noticed the compile method. Will have a look into this.

mdedetrich added a commit that referenced this issue Jul 5, 2017
@mdedetrich
Copy link
Owner

Okay I have just pushed this, according to the Scala docs the .r method on Strings return a compiled regex

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