diff options
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/eval.cc | 2 | ||||
-rw-r--r-- | src/libexpr/lexer.l | 10 | ||||
-rw-r--r-- | src/libexpr/nixexpr.cc | 1 | ||||
-rw-r--r-- | src/libexpr/primops.cc | 1 | ||||
-rw-r--r-- | src/libexpr/print.cc | 1 |
5 files changed, 9 insertions, 6 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index c9a624eeb..c72b69af2 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -22,6 +22,7 @@ #include <algorithm> #include <chrono> #include <iostream> +#include <sstream> #include <cstring> #include <optional> #include <unistd.h> @@ -29,7 +30,6 @@ #include <sys/resource.h> #include <fstream> #include <functional> -#include <iostream> #include <sys/resource.h> #include <nlohmann/json.hpp> diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 1780f5cb9..1c1cdd673 100644 --- a/src/libexpr/lexer.l +++ b/src/libexpr/lexer.l @@ -26,10 +26,9 @@ #pragma clang diagnostic ignored "-Wimplicit-fallthrough" #endif -#include <boost/lexical_cast.hpp> - #include "nixexpr.hh" #include "parser-tab.hh" +#include "strings.hh" using namespace nix; @@ -132,9 +131,10 @@ or { return OR_KW; } {ID} { yylval->id = {yytext, (size_t) yyleng}; return ID; } {INT} { errno = 0; - try { - yylval->n = boost::lexical_cast<int64_t>(yytext); - } catch (const boost::bad_lexical_cast &) { + std::optional<int64_t> numMay = string2Int<int64_t>(yytext); + if (numMay.has_value()) { + yylval->n = *numMay; + } else { throw ParseError(ErrorInfo{ .msg = HintFmt("invalid integer '%1%'", yytext), .pos = state->positions[CUR_POS], diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 6a1aa8f35..664872882 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -6,6 +6,7 @@ #include "escape-string.hh" #include <cstdlib> +#include <sstream> namespace nix { diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index f8ce90ac1..3cc2659fb 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -25,6 +25,7 @@ #include <algorithm> #include <cstring> +#include <sstream> #include <regex> #include <dlfcn.h> diff --git a/src/libexpr/print.cc b/src/libexpr/print.cc index c56b0e72e..e387a09fb 100644 --- a/src/libexpr/print.cc +++ b/src/libexpr/print.cc @@ -1,6 +1,7 @@ #include <limits> #include <span> #include <unordered_set> +#include <sstream> #include "escape-string.hh" #include "print.hh" |