callbacks: adjust formatting
Hi there I'm a maintainer of https://github.com/AllenDang/cimgui-go which uses this project via https://github.com/gucio321/cimmarkdown.
Would you be so kind to add this tiny change to make my generator work correctly on the upstream repo (I'd not need to maintain my fork) :pray: Thank you in advance!
Added brackets around names of callbacks typedefs.
This is for compatibility with https://github.com/gucio321/cimmarkdown
IIRC there was a problem to distinguish between callbacks typedefs and something else (cant remember what exactly). If you wish I can make the research again and tell what exactly was the problem
I'm not very fond of the extra syntactic sugar used here, but if it solves a real problem I'll consider it.
Do you know if it's possible to fix the generator so it correctly detects the typedef at the start of the lines in question?
The generator has this line:
https://github.com/gucio321/cimmarkdown/blob/master/generator/cpp2ffi.lua#L330
Which correctly detects the current syntax, but also the function pattern:
https://github.com/gucio321/cimmarkdown/blob/master/generator/cpp2ffi.lua#L319
Which also matches.
It looks like the parseItems loops through each pattern in turn, finding the first match. So I think one simple solution might be to move the functypedef_re expression above the function_re ones so that the typedef is found first and the generator breaks out of its search loop.
Fixing the generator this way, if possible, would be the preferred more future proof route in my view.