diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-08-19 12:35:03 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-08-19 12:35:03 +0200 |
commit | d308aeaf53b7324af98dfa949a747526c241ef30 (patch) | |
tree | acae7f07b45d26007e8a6bbc3d6c8bfa1bf5e34c /src/libexpr/lexer.l | |
parent | 297b762513ad416582c0850095506f802ff5b1bb (diff) | |
download | guix-d308aeaf53b7324af98dfa949a747526c241ef30.tar.gz |
Store Nix integers as longs
So on 64-bit systems, integers are now 64-bit. Fixes #158.
Diffstat (limited to 'src/libexpr/lexer.l')
-rw-r--r-- | src/libexpr/lexer.l | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 3b7c6bb57a..76cd372013 100644 --- a/src/libexpr/lexer.l +++ b/src/libexpr/lexer.l @@ -110,8 +110,10 @@ or { return OR_KW; } \+\+ { return CONCAT; } {ID} { yylval->id = strdup(yytext); return ID; } -{INT} { int n = atoi(yytext); /* !!! overflow */ - yylval->n = n; +{INT} { errno = 0; + yylval->n = strtol(yytext, 0, 10); + if (errno != 0) + throw ParseError(format("invalid integer `%1%'") % yytext); return INT; } |