Closed Phytolizer closed 2 years ago
When you create the struct D_Parser object with the function new_D_Parser it creates an extended object with more storage (struct Parser). You can add fields to struct D_Parser or struct Parser or realloc with additonal storage and cast (D_Parserp) to your struct (struct MyData)((char)p + sizeof(Parser)). I can add a 'struct D_Parser_User user_data' to struct D_Parser if you want to use the unmodified distribution then you can set it to your own struct during parser initialization.
That would be great, thank you! For now I'll do it myself, but having it in the original source would be neat!
Edit: actually the change required is really minimal, perhaps I can just make a PR
Done in version 1.34
The declaration of D_SyntaxErrorFn is simple:
However, as far as I see, I can't pass in any of my own data (in my case, a logger). Is there a way to do that without globals?