mirror of
https://github.com/littlefs-project/littlefs.git
synced 2025-12-01 12:20:02 +00:00
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.
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user