Skip to content

Commit

Permalink
Implement relative attribute parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph2 committed Jan 10, 2019
1 parent 344b5df commit 0685d83
Show file tree
Hide file tree
Showing 5 changed files with 438 additions and 427 deletions.
21 changes: 19 additions & 2 deletions pydbc/dbcListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,29 @@ def exitAttributeValueForObject(self, ctx):
ctx.value = dict(name = attributeName, **di)

def exitRelativeAttributeValues(self, ctx):
print("RelativeAttributeValues", ctx.items)
items = [x.value for x in ctx.items]
print("RelativeAttributeValues", items)
ctx.value = items

def exitRelativeAttributeValueForObject(self, ctx):
print("relativeAttributeValueForObject", ctx.attrType.value)
attrType = ctx.attrType.text
attributeName = ctx.attributeName.value
if attrType == "BU_BO_REL_":
nodeName = ctx.nodeName.value
nodeAddress = ctx.nodeAddress.value
parent = dict(nodeName = nodeName, nodeAddress = nodeAddress)
attrValue = ctx.attrValue.value
elif attrType == "BU_SG_REL_":
nodeName = ctx.nodeName.value
messageID = ctx.messageID.value
signalName = ctx.signalName.value
parent = dict(nodeName = nodeName, messageID = messageID, signalName = signalName)
attrValue = ctx.attrValue.value
elif attrType == "BU_EV_REL_":
evName = ctx.evName.value
parent = dict(evName = evName)
attrValue = ctx.attrValue.value
ctx.value = dict(attributeName = attributeName, attributeValue = attrValue, parent = parent)

def exitSignalGroups(self, ctx):
items = [x.value for x in ctx.items]
Expand Down
Loading

0 comments on commit 0685d83

Please sign in to comment.