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

Negative integers and floats. #24

Closed
ajpmaclean opened this issue Jun 6, 2019 · 3 comments
Closed

Negative integers and floats. #24

ajpmaclean opened this issue Jun 6, 2019 · 3 comments

Comments

@ajpmaclean
Copy link

Is it possible to input negative integers or floats? From what I can see -1 or -1.2e3 are being treated as optional arguments. Maybe std::is_integral and std::is_floating_point could be used to first test for integrals or floating points before testing for an optional argument.

@ajpmaclean ajpmaclean changed the title negative integers and floats. Negative integers and floats. Jun 6, 2019
@ajpmaclean
Copy link
Author

Maybe a regex like: [-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? could be used. This will validate integers and floats.

@p-ranav
Copy link
Owner

p-ranav commented Jun 7, 2019

Pushed some updates to support this, including 6 test cases. Please test and confirm.

@ajpmaclean
Copy link
Author

Tests are passing for me. Wow - argparse is looking really good!

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