-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multidimensional array dimensions not parsed when using variable #72
Comments
It's likely that cxxheaderparser can handle such constructs, recommend you give that a try as eventually I will abandon this fork in favor of cxxheaderparser. Alternatively, happy to accept a fix for this. If I recall correctly, CppHeaderParser's multi-dimensional array support was indeed quite terrible, so this doesn't surprise me at all. |
Thanks for the recommendation and quick reply. I will give that library a shot.
In the meantime, I managed to work around the issue with a fairly simple solution. I am running the parser twice, the first time to get all #defines, which I then do a string replace on in Python. This allows me to parse the parched code again and obtain the correct array dimensions. It’s far from elegant, but it works :)
On 22. Sep 2021, at 21:43, Dustin Spicuzza ***@***.***> wrote:
The following message was sent from an external e-mail address!
Be cautious when clicking on links, opening attachments or providing sensitive information.
…________________________________
It's likely that cxxheaderparser<https://github.com/robotpy/cxxheaderparser> can handle such constructs, recommend you give that a try as eventually I will abandon this fork in favor of cxxheaderparser.
Alternatively, happy to accept a fix for this. If I recall correctly, CppHeaderParser's multi-dimensional array support was indeed quite terrible, so this doesn't surprise me at all.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#72 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ALLMUUX2ELRU6R57RZTNLUDUDIWVVANCNFSM5EQXGJVQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
________________________________
TOYOTA GAZOO Racing Europe GmbH | Toyota-Allee 7 | 50858 Köln / Cologne | Deutschland / Germany
Geschäftsführer / Managing Directors: Koji Sato, Katsuyoshi Hikichi, Robertus Leupen, Matthew Harrison
Sitz der GmbH / Registered Office: Köln / Cologne | HRB 9846 | Tax-No.: 22358190628 | VAT-ID No.: DE123471187
T: +49 2234 1823 0 | F: +49 2234 1823 2800 | E: ***@***.*** | W: www.tgr-europe.com
TGR-E-Datenschutzinformationen / TGR-E‘s privacy policy: https://www.tgr-europe.com/en/privacy
DISCLAIMER
* This email and any attachment may contain confidential information. If you are not the intended recipient you are not authorised to copy or disclose all or any part of it without the prior written consent of TOYOTA GAZOO Racing Europe GmbH.
* TOYOTA GAZOO Racing Europe GmbH treats any information exchanged with business partners as confidential regardless whether they are marked as such or not and, therefore, rejects any request for marking documents.
* Please scan this email and any attachment for viruses. TOYOTA GAZOO Racing Europe GmbH does not accept any responsibility for problems caused by viruses whether it is the fault of TOYOTA GAZOO Racing Europe GmbH or not.
|
Are these "variables" actually
We don't implement macros in cxxheaderparser either. |
I am trying to parse C structs which contain array's defined using variables.
The single dimension arrays are parsed correctly, i.e.
long my1dArray[SOME_VAR];
which returns something like:
'array_size': 'SOME_VAR'
However, for multidimensional arrays the array size is not parsed correctly and returns an empty string:
long my2dArray[SOME_VAR][SOME_VAR];
'array_size':1
'multi_dimensional_array':1
'multi_dimensional_array_size':''
It would be great if array sizes using variable names for multi-dimensional arrays can be supported, since now I need to write a custom parser to retrieve the dimensions myself.
The text was updated successfully, but these errors were encountered: