|
@@ -10,6 +10,7 @@ _op_alias['add'] = '+'
|
10
|
10
|
_op_alias['sub'] = '-'
|
11
|
11
|
_op_alias['mul'] = '*'
|
12
|
12
|
_op_alias['div'] = '/'
|
|
13
|
+_op_alias['mod'] = '%'
|
13
|
14
|
_op_alias['bin_and'] = '&'
|
14
|
15
|
_op_alias['bin_or'] = '|'
|
15
|
16
|
_op_alias['bin_xor'] = '^'
|
|
@@ -146,12 +147,15 @@ class RpnSymbol(object):
|
146
|
147
|
if err:
|
147
|
148
|
msg = 'Invalid %s : "%s"' % (err_type, value.upper())
|
148
|
149
|
|
149
|
|
- def __str__(self):
|
|
150
|
+ def __str__(self, small=True):
|
150
|
151
|
''' @brief Return a string representation of current symbol '''
|
151
|
152
|
if self.optype == self.OPERATION:
|
152
|
153
|
return _op_list[self.value][0].__name__.upper()
|
153
|
154
|
elif self.optype == self.VALUE:
|
154
|
|
- return '0x%04X' % self.value
|
|
155
|
+ if small:
|
|
156
|
+ return '0x%X' % self.value
|
|
157
|
+ else:
|
|
158
|
+ return '0x%04X' % self.value
|
155
|
159
|
else:
|
156
|
160
|
return self.value.upper()
|
157
|
161
|
|