diff python/ppci/assembler.py @ 384:94f5b719ad0b

Small refactor
author Windel Bouwman
date Sun, 27 Apr 2014 17:50:25 +0200
parents 0c44e494ef58
children 2a970e7270e2
line wrap: on
line diff
--- a/python/ppci/assembler.py	Sun Apr 27 17:40:39 2014 +0200
+++ b/python/ppci/assembler.py	Sun Apr 27 17:50:25 2014 +0200
@@ -2,7 +2,7 @@
 import re
 import pyyacc
 from baselex import BaseLexer
-from . import Token, CompilerError, SourceLocation
+from . import Token, CompilerError, SourceLocation, make_num
 from .target import Target, Label
 
 
@@ -37,10 +37,7 @@
         return (typ, val)
 
     def handle_number(self, typ, val):
-        if val.startswith('0x'):
-            val = int(val[2:], 16)
-        else:
-            val = int(val)
+        val = make_num(val)
         typ = bit_type(val)
         return typ, val