-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
misparsing floats/ints starting with zeroes #157
Comments
I think the bug appears in a smaller snippet already. If we remove the
but in Tvix (using rnix):
(AST is dumped on that link) |
This is how I fixed it in nixfmt: NixOS/nixfmt@a45763a |
This error happens at the tokenizer level already. But it is questionable if this is really an error and not a mistake in nix itself (as i will question)
gives the following rnix tokens
In contrast to that,
leading number chars I'd like to know what IEEE says about this. But I couldn't find if this is even specified. Maybe @RaitoBezarius knows where to look at? To describe nix's behavior:
Implementing this into rnix should solve this issue I think. (I will come back to this when I got some time) |
Update: it seem ieee doesnt specify leading 0‘s its the responsibility of the app to ignore leading 0‘s. So in summary this is a bug in the nix tokenizer. rnix is right, but doesnt follow nix‘s broken behavior. It may be up to the maintainer (@oberblastmeister ) to decide whether rnix should follow this logic. I‘ll open an issue for this in nix. |
Do you have a link to the issue? |
Describe the bug
rnix-parser does not parse floats/ints the same as the nix official parser.
Code Snippet to reproduce
(yes, this is valid nix)
Gets parsed into
[email protected] "001.22e01"
Expected behavior
semantically equivalent to
[ 1 2.2 "e" 0.3 0.4 ]
Additional context
The text was updated successfully, but these errors were encountered: