From: José Fonseca Date: Mon, 26 Nov 2012 19:49:17 +0000 (+0000) Subject: Fix parsing of floats without '.' X-Git-Url: https://git.cworth.org/git?p=apitrace-tests;a=commitdiff_plain;h=5271ee8ef3b3898b300f176120a29e51ae417ce6;ds=sidebyside Fix parsing of floats without '.' For example "1e+10" --- diff --git a/tracematch.py b/tracematch.py index c1e0948..aebbfd3 100755 --- a/tracematch.py +++ b/tracematch.py @@ -598,11 +598,12 @@ class TraceParser(Parser): return self.handleString(value) elif self.match(NUMBER): token = self.consume() - if '.' in token.text: + try: + value = int(token.text) + except ValueError: value = float(token.text) return self.handleFloat(value) else: - value = int(token.text) return self.handleInt(value) elif self.match(HEXNUM): token = self.consume()