Fix parsing of floats without '.'
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 26 Nov 2012 19:49:17 +0000 (19:49 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 26 Nov 2012 19:49:17 +0000 (19:49 +0000)
For example "1e+10"

tracematch.py

index c1e0948210e8405ba8fdcca6ef3dc1a8680429f2..aebbfd3d5c2a3be001e4a736a9e881d6825c4d25 100755 (executable)
@@ -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()