expr_parser: fix issue with hex values in environment
Hex mumeric values directly in the expression were cast correctly via the t_HEX rule, but ValueErrors would occur if a hex value was looked up due to the expansion of some environment symbol. Change-Id: Ia98dfea91eff4ed95778922d38d2967284f4e31b Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
76fc2f92df
commit
31e772de20
1 changed files with 5 additions and 1 deletions
|
@ -173,7 +173,11 @@ def ast_sym(ast, env):
|
|||
|
||||
def ast_sym_int(ast, env):
|
||||
if ast in env:
|
||||
return int(env[ast])
|
||||
v = env[ast]
|
||||
if v.startswith("0x") or v.startswith("0X"):
|
||||
return int(v, 16)
|
||||
else:
|
||||
return int(v, 10)
|
||||
return 0
|
||||
|
||||
def ast_expr(ast, env):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue