Commit 87be851f authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Attempt to add optionality info in AST.

parent aae71b64
......@@ -62,18 +62,18 @@
# | | | |
# | +----------------+ |
# +-----------------------------+ ^ |
# | AsnEnumerated | | +------------------------+
# |-----------------------------| | | AsnSequenceOf/AsnSetOf |
# | _members list:(name, value) | | |------------------------|
# +-----------------------------+ | | _containedType |
# +-----------------------------+ | value: string, |
# | AsnSequence/AsnSet | | AsnBasicNode, |
# |-----------------------------| | AsnEnumerated |
# | _members list:(name, value) | +------------------------+
# | value: AsnBasicNode, |
# | AsnEnumerated, |
# | AsnMetaMember |
# +-----------------------------+
# | AsnEnumerated | | +------------------------+
# |-----------------------------| | | AsnSequenceOf/AsnSetOf |
# | _members list:(name, value) | | |------------------------|
# +-----------------------------+ | | _containedType |
# +------------------------------------+ | value: string, |
# | AsnSequence/AsnSet | | AsnBasicNode, |
# |----------------------------- | | AsnEnumerated |
# | _members list:(name, value, opt/al)| +------------------------+
# | value: AsnBasicNode, |
# | AsnEnumerated, |
# | AsnMetaMember |
# +------------------------------------+
from typing import List, Union, Dict, Any # NOQA pylint: disable=unused-import
......@@ -461,8 +461,9 @@ This class stores the semantic content of an ASN.1 SEQUENCE.
Members:
_name : the name of the type
_members : a tuple of all child elements. Each tuple contains
two elements: the name of the variable and the
type itself (as an AsnInt, AsnReal, ... or an AsnMetaMember).
three elements: the name of the variable, the type itself
(as an AsnInt, AsnReal, ... or an AsnMetaMember), and
an optionality boolean (true mean OPTIONAL)
'''
validOptions = ['members', 'lineno', 'asnFilename']
......
......@@ -741,7 +741,7 @@ def CommonSeqSetChoice(
if opti and opti == "True":
utility.warn("OPTIONAL attribute ignored (for field contained in %s,%s)" % (newModule._asnFilename, lineNo))
enumID = GetAttr(x, "EnumID")
myMembers.append([GetAttr(x, "VarName"), GenericFactory(newModule, GetChild(x, "Type"))])
myMembers.append([GetAttr(x, "VarName"), GenericFactory(newModule, GetChild(x, "Type")), opti == "True"])
myMembers[-1].append(enumID)
for tup in myMembers:
if isinstance(tup[1], AsnMetaType):
......
Markdown is supported
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