-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Hexidecimal value with underscore #331
Comments
Hi @dariodsa, thanks for reporting the issue! This indeed looks like a bug. It would be nice to add test-cases for such situations and to fix the problem itself, of course 🙂 Regarding issue #199: I've opened issue in the TOML repo itself a while ago about providing testable example: But there will be no example in the TOML repo. Instead, the implementation needs to be verified with the official compliance test-suite: So instead of walking through the examples in documentation, it's much better to perform automatic testing, as described in #167. But this also requires more work. I've also closed #199 as a duplicate of #167 due to some recent changes in the |
Ok, I will add test cases for such situations and try to fix the problem. |
@dariodsa No worries and thanks for the help! Just to give some more context, here is the parser for all integer numbers: tomland/src/Toml/Parser/Value.hs Lines 44 to 52 in 316c893
For binary, octal and hexadecimal numbers the primitive parsers from tomland/src/Toml/Parser/Value.hs Lines 33 to 42 in 316c893
But I imagine this will be quite a lot of work... |
…s for hex,oct and bin digits
…e using megaparsec lib function
* [#331] adding test for hexadecimal representation * [#331] adding test for octal representation * [#331] adding test for binary representation with underscore * [#331] corrected wrong types in function parseInteger * [#331] add Data.Char module for ascii value and parsec modules for hex,oct and bin digits * [#331] add more tests with underscore * [#331] implemented parser for hex, oct and bin with underscore feature * [#331] haskell style guide * [#331] removed trailing spaces * [#311] removed additional trailing spaces * [#331] changed tests to check for exceptions and added new test group * [#331] implemented parser for hex, oct and bin with underscore using megaparsec lib function * [#331] added test cases that check when number ends with underscore * [#331] resolved issues with code style and naming convention
Fixed by #332 |
Hi,
according to the TOML-0.5.0 version (link) hexadecimal, binary and octal values were introduced. I checked your test modules and you are checking for case insensitivity, negative, non-negative, etc but you missed one sentence in the specification.
Underscores are allowed between digits (but not between the prefix and the value).
So, for example, the following code snippet should pass:
The same problem is with binary and octal numbers, classic decimal numbers support underscores.
I noticed the issue #199 is still open. If you want I can look into that and made test cases which will check all changes made from version 0.4.0 to 0.5.0.
The text was updated successfully, but these errors were encountered: