From 2a4e0496b63ad5ca671f46f5868912556f0a845b Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Sun, 3 Aug 2025 13:22:37 -0500 Subject: [PATCH] scripts: csv.py: Fixed lexing of signed float exponents So now these lex correctly: - 1e9 => 1000000000 - 1e+9 => 1000000000 - 1e-9 => -1000000000 A bit tricky when you think about how these could be confused for binary addition/subtraction. To fix we just eagerly grab any signs after the e. These are particularly useful for manipulating simulated benchmarks, where we need to convert things to/from nanoseconds. --- scripts/csv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/csv.py b/scripts/csv.py index ad756840..702de7fb 100755 --- a/scripts/csv.py +++ b/scripts/csv.py @@ -1129,7 +1129,7 @@ class CsvExpr: p.chomp() # floats - elif p.match('[+-]?(?:[_0-9]*\.[_0-9eE]*|nan)'): + elif p.match('[+-]?(?:[_0-9]*\.(?:[_0-9]|[eE][+-]?)*|nan)'): a = CsvExpr.FloatLit(CsvFloat(p.chomp())) # ints