Merge pull request #2378 from aszlig/int64

libexpr: Use int64_t for NixInt
This commit is contained in:
Eelco Dolstra 2018-08-29 13:30:50 +02:00 committed by GitHub
commit 20d74a3257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -12,6 +12,8 @@
%{
#include <boost/lexical_cast.hpp>
#include "nixexpr.hh"
#include "parser-tab.hh"
@ -124,9 +126,11 @@ or { return OR_KW; }
{ID} { yylval->id = strdup(yytext); return ID; }
{INT} { errno = 0;
yylval->n = strtol(yytext, 0, 10);
if (errno != 0)
try {
yylval->n = boost::lexical_cast<int64_t>(yytext);
} catch (const boost::bad_lexical_cast &) {
throw ParseError(format("invalid integer '%1%'") % yytext);
}
return INT;
}
{FLOAT} { errno = 0;

View file

@ -43,7 +43,7 @@ class XMLWriter;
class JSONPlaceholder;
typedef long NixInt;
typedef int64_t NixInt;
typedef double NixFloat;
/* External values must descend from ExternalValueBase, so that