What is the scope searched by getCurrentResults.getResultByName(string)?

0 votes
asked Aug 18, 2018 in Python by hamiltont (360 points)
recategorized Aug 18, 2018 by hamiltont
For StructureMapper#getCurrentResults(), I would like to use the Results#getResultByName(string) method, but I don't see any clear guidance on the scope of the "name" we are searching for - anywhere in the grammar, anywhere in the current structure being processed, or some other option?

FYI - The other methods in StructureMapper tell you what they are returning e.g. "current grammar being processed", "current structure being mapped", "current structure element being mapped". However, the getCurrentResults doesn't seem to document as clearly what array of results it is returning. I did try to iterate over it to check manually, but it's not iterable in python

1 Answer

0 votes
answered Aug 23, 2018 by andreas (3,460 points)
selected Aug 23, 2018 by hamiltont
 
Best answer
The results represent the tree structure (not an array) you see in the GUI next to the hex editor.

So getResultByName() goes backward in the parsing results until it finds a result with the passed name (as seen in the GUI in the name column). Usually you want to find the most recently parsed value to take it into account in a script.

The results tree consists of all the start/end structures and values for the structure elements.

There's not necessarily a 1-to-1 relationship between grammar structures and nested levels in the results or structure elements in the grammar and result elements. (Because you can add results in a script)

The intent was to not repeat information present in the grammar in the results. So usually the parsing result contains a value and a reference to the element in the grammar that can be used to format the result. (like for decimal or hex number display or the like)
commented Aug 23, 2018 by hamiltont (360 points)
That helps, thanks. IIUC, the scope is the entire parsing tree which has been processed so far
...