Closed sztomi closed 4 years ago
It isn't write which does this. It's causing the parse to begin. The parser is a pull based parser, so only if you pull tokens from its end does it parse the input, and call hooks etc. Everything then proceeds incrementally.
parse
is implemented as a Python generator, so when you call it, it suspends. You then need to iterate the generator returned to progress the parse.
I hope this helps, and sorry for the four month delay in replying. My kids went back to school yesterday, I missed a lot of stuff like this during the past eight months. Sorry.
No need to apologize, I appreciate the answer and the excellent library. Thanks a lot!
I was trying to locate some directives with their full extents in a header file. I figured using
on_directive_handle
would help me, but nothing I did seemed to call the hook functions. It turns out I had to callwrite
after parsing in order for the hooks to be called.Can you clarify what exactly
parse
does and if it's really needed to write the preprocessed output in order to get the hooks called? Is there a way to avoid that?