Commit 9d9d68c1 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Properly support named integers

Requires asn1scc 3.3.04 or more recent
parent cd97b109
......@@ -1898,7 +1898,7 @@ def _string_literal(primary):
@expression.register(ogAST.PrimConstant)
def _constant(primary):
''' Generate code for a reference to an ASN.1 constant '''
return [], unicode(primary.value[0]), []
return [], unicode(primary.constant_c_name), []
@expression.register(ogAST.PrimMantissaBaseExp)
......
......@@ -1133,8 +1133,10 @@ def primary_variable(root, context):
name = getattr(root.getChild(0), 'text', 'error')
errors, warnings = [], []
if is_asn1constant(name):
possible_constant = is_asn1constant(name)
if possible_constant:
prim = ogAST.PrimConstant()
prim.constant_c_name = possible_constant
elif is_fpar(name, context):
prim = ogAST.PrimFPAR()
else:
......@@ -1167,7 +1169,7 @@ def is_asn1constant(name):
try:
for varname, vartype in DV.variables.viewitems():
if varname.lower().replace('-', '_') == name:
return True
return vartype.varName
except AttributeError:
# Ignore - No DV - e.g. in syntax check mode
pass
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment