From a32a61813ebaecf0c1e69fd1481bf09d8c8b1420 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 14 Jul 2026 18:08:44 +0200 Subject: Support more floating point literals --- boot/lexer.ll | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'boot/lexer.ll') diff --git a/boot/lexer.ll b/boot/lexer.ll index 4367caa..faae3d7 100644 --- a/boot/lexer.ll +++ b/boot/lexer.ll @@ -196,8 +196,20 @@ of { return yy::parser::make_WORD(result, this->location); } } -[[:digit:]]+\.[[:digit:]]+ { - float result = strtof(yytext, NULL); +[[:digit:]]+\.[[:digit:]]+([eE][+-]?[[:digit:]]+)? { + double result = strtod(yytext, NULL); + + if (errno == ERANGE) + { + REJECT; + } + else + { + return yy::parser::make_FLOAT(result, this->location); + } +} +[[:digit:]]+[eE][+-]?[[:digit:]]+ { + double result = strtod(yytext, NULL); if (errno == ERANGE) { -- cgit v1.2.3