[Nix-dev] isFloat
Christian Theune
ct at flyingcircus.io
Tue Jan 5 00:48:05 CET 2016
Hi,
alright. I was really interested in trying to see whether I can figure out what’s going on.
I didn’t quite get it working today and my lack of Flex/Bison understanding is blocking me from figuring out what’s going on. :/
Most changes were done by reviewing everything that touched the integer handling and following all traces of all things it touched.
My current work is here:
https://github.com/NixOS/nix/compare/master...ctheune:ctheune-floats?expand=1
For some reason, the lexer seems to fail picking up the FLOAT symbol _at all_ and complains:
nix-instantiate --eval -E '123.1'
error: syntax error, unexpected INT, expecting ID or OR_KW or DOLLAR_CURLY or '"', at (string):1:5
So it notices the first thing as an INT (I think, it might be a float, but I don’t think so) but the “.” seems to be interpreted as the attribute access operator. I didn’t find the rule for this - can someone point this out to me?
Overall, I hope I didn’t make too much of a mess. I picked up a few little things along the way that I think warranted a quick correction (NixInt vs. regular int references and using a custom parser instead of stoi - or should that be stol?).
If someone could help me figure out what I’m butchering in the Lexer (or elsewhere) …
Cheers,
Christian
> On 04 Jan 2016, at 17:27, Eelco Dolstra <eelco.dolstra at logicblox.com> wrote:
>
> Hi,
>
> On 04/01/16 17:12, Rok Garbas wrote:
>
>> should we add this to nixpkgs/lib? it is usefull (using it right now) :)
>
> IMHO, it would be cleaner to add floats to the Nix language. Before somebody
> decides to implement floating point arithmetic using a bunch of regexps ;-)
>
> --
> Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
--
Christian Theune · ct at flyingcircus.io · +49 345 219401 0
Flying Circus Internet Operations GmbH · http://flyingcircus.io
Forsterstraße 29 · 06112 Halle (Saale) · Deutschland
HR Stendal HRB 21169 · Geschäftsführer: Christian. Theune, Christian. Zagrodnick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160105/b5c1751c/attachment.bin
More information about the nix-dev
mailing list