I have to perform text parsing using python, The sample text is as below
04h; ParIsa.Front.Area[0].ub_Y (BYTE)
0Dh; ParIsa.Front.Area[0].ub_X (BYTE)
00h; ParIsa.Front.Area[0].ub_P1 (BYTE)
01h; ParIsa.Front.Area[0].ub_P2 (BYTE)
40h; ParIsa.Front.Area[1].ub_Y (BYTE)
0Eh; ParIsa.Front.Area[1].ub_X (BYTE)
00h; ParIsa.Front.Area[1].ub_P1 (BYTE)
01h; ParIsa.Front.Area[1].ub_P2 (BYTE)
03h; ParIsa.Side.Area[0].ub_Y (BYTE)
0Dh; ParIsa.Side.Area[0].ub_X (BYTE)
00h; ParIsa.Side.Area[0].ub_P1 (BYTE)
01h; ParIsa.Side.Area[0].ub_P2 (BYTE)
41h; ParIsa.Side.Area[1].ub_Y (BYTE)
15h; ParIsa.Side.Area[1].ub_X (BYTE)
00h; ParIsa.Side.Area[1].ub_P1 (BYTE)
01h; ParIsa.Side.Area[1].ub_P2 (BYTE)
with such a text, I need to create a data structure in such a way that I can access the individual elements as well as the whole structure, for example
>> Side.Area[0].ub_X
'0x0d'
>> Front.Area
Area[0]
ub_X = 0x0d
ub_Y = 0x04
ub_P1 = 0x00
ub_P2 = 0x01
Area[1]
ub_X = 0x0e
ub_Y = 0x40
ub_P1 = 0x00
ub_P2 = 0x01
Accessing the structure as a whole is the difficult part, Can creation of tree be useful here? do you have any suggestions or ideas to implement this, please let me know