about summary refs log tree commit diff
path: root/src/libexpr/lexer.l
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-08-19T10·35+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-08-19T10·35+0200
commitd308aeaf53b7324af98dfa949a747526c241ef30 (patch)
treeacae7f07b45d26007e8a6bbc3d6c8bfa1bf5e34c /src/libexpr/lexer.l
parent297b762513ad416582c0850095506f802ff5b1bb (diff)
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.l6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index 3b7c6bb57a06..76cd372013a5 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;
             }