-
Notifications
You must be signed in to change notification settings - Fork 12
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
draft: add "commented cursor" classes and use them #206
Conversation
At the risk of duplication, add more dedicated _get_header_line() to make it easier to understand what is needed where.
Start by moving all the cursor related helpers to a separate file
Modify class hierarchy to achieve this
This used to fail with clang 15 and earlier.
Juicy. I'll need to set aside some time for this, but out of curiosity, did you find anything useful in the work I had done earlier? I'm guessing not. |
I forgot to check 🤦 I just started on something else, and one thing lead to another... |
Ahah, no worries, I also didn't advertise it loud enough. Likelier than not, there isn't much in there of any real interest anyway. |
Yes! 100% yes. I read it through a couple of times and the overall approach matches what we discussed in #180 and I like it! A major difference in the version I had played around in is that I had a On the other hand I was getting to a point in my version where the parser became / would become a tiny loop building There are other small differences, but nothing to consider right now. And as for the name... Other than that, I left my branch in a really bad state, I had a look over and I don't think there's much to take from it, especially with how old an out of date it is. Yours on the other hand seems like a good sketch of how it could go in. How would you want to proceed here? Do you want to polish this up a bit? Should I? |
Sorry, I saw your comment, it deserved a decent reply I didn't have time for. 😞 One thing was that I thought multiple cursor classes really helped me wrap my head around the whole thing when reading the code. |
No worries of course.
Yeah, I get that, but still think I'm on to something regarding the cursor type (as in which class it is) and cursor kind, which don't match and would just be odd. And this is to be public facing API if we pass the cursors to the extensions. Also, I quite like the elegant way we can generate the cursors here and use Let it stew a bit longer then and let me know how you see that playing out. I'll keep playing with my idea for now. |
Forgot to mention, I'm thinking of maybe using multiple classes actually, but internal ones, used compositing style instead of inheritance. That would allow us to manage readability a bit better while maintaining a single point of entry API wise I think. This is not reflected in my branch at the moment though. |
@BrunoMSantos I looked at your branch, and it looks nice! It's just that there's not enough to tell where it'll go next... I'd like to see the cleanup to I wonder if we should use different variable names for Anyway, I'm not hung up on the implementation I've got here. I just wanted to test where we could go with this, and I think something like this is the way to go. If you've got the time and energy to take this forward, by all means do! |
@BrunoMSantos Please shove https://gitlab.com/bms-contrib/hawkmoth/-/commit/458f797b4c27d22594a0d9c505035d01db8cb836 to a branch and send a pull request! |
Literally working on that 😅
I did, didn't I? At least where they are mixed, in parse:
👍 |
Yup, that was the intention, I was just not in a hurry, but I'll do that now ;) |
I just didn't realize |
I'm closing this one in favour of #217 |
This is some early drafting for passing cursors around. Basically add an abstraction for a "commented cursor" (naming sucks) that consists of two cursors, the comment and the actual object. Some of the intermediate steps are ugly, but I don't want to try to do a mass conversion either. Towards the end there's more clarity. parser.py is only about parsing and creating commentedcursors, commentedcursor.py is only about presenting a cleaner interface to the cursors clang gives us, and docstring.py is more about converting those commentedcursors to something presentable to Sphinx.
I guess there's not much point in detailed review at this point, but maybe have a look at the end result, and see if that is the direction we should be going? I think it does look neater, and looks like will be easier to understand.