aboutsummaryrefslogtreecommitdiff
path: root/boot/lexer.ll
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-07-14 18:08:44 +0200
committerEugen Wissner <belka@caraus.de>2026-07-14 18:08:44 +0200
commita32a61813ebaecf0c1e69fd1481bf09d8c8b1420 (patch)
treeecfb6140075e3c46b599755e220dbf560de2e31d /boot/lexer.ll
parent51e2f98e33ae10fc3052335cc6847bc93d0784fa (diff)
downloadelna-a32a61813ebaecf0c1e69fd1481bf09d8c8b1420.tar.gz
Support more floating point literals
Diffstat (limited to 'boot/lexer.ll')
-rw-r--r--boot/lexer.ll16
1 files changed, 14 insertions, 2 deletions
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)
{