diff options
author | jade <lix@jade.fyi> | 2024-05-30 14:57:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@lix-systems> | 2024-05-30 14:57:37 +0000 |
commit | 18aa3e1d570b4ecbb9962376e5fba5757dad8da9 (patch) | |
tree | ad9edb3d85c7f3e9b6a33f65efeebbdbc9bd243b /src/libexpr/lexer.l | |
parent | 53d40888ffe8238ab5baf6a9d1a7481c29e9c65d (diff) | |
parent | 7575db522e9008685c4009423398f6900a16bcce (diff) |
Merge "Remove 100s of CPU time (10%) from build times (1465s -> 1302s)" into main
Diffstat (limited to 'src/libexpr/lexer.l')
-rw-r--r-- | src/libexpr/lexer.l | 10 |
1 files changed, 5 insertions, 5 deletions
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], |