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:
+1
-1
@@ -1129,7 +1129,7 @@ class CsvExpr:
|
|||||||
p.chomp()
|
p.chomp()
|
||||||
|
|
||||||
# floats
|
# floats
|
||||||
elif p.match('[+-]?(?:[_0-9]*\.[_0-9eE]*|nan)'):
|
elif p.match('[+-]?(?:[_0-9]*\.(?:[_0-9]|[eE][+-]?)*|nan)'):
|
||||||
a = CsvExpr.FloatLit(CsvFloat(p.chomp()))
|
a = CsvExpr.FloatLit(CsvFloat(p.chomp()))
|
||||||
|
|
||||||
# ints
|
# ints
|
||||||
|
|||||||
Reference in New Issue
Block a user