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:
Andrew Boie 2017-04-18 11:22:50 -07:00 committed by Anas Nashif
commit 31e772de20

View file

@ -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):