-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-127833: Use productionlist
nodes to implement the grammar-snippet
directive
#130376
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
gh-127833: Use productionlist
nodes to implement the grammar-snippet
directive
#130376
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This looks like the way to go. I left a few notes inline.
conf.py
still has needs_sphinx = '8.1.3'
, and I got a very worrying result with that version: the entire reference
directory was missing, without any error message I could see. Is that something you want to look into?
The extension defines two directives, one with the new syntax but also a I added code to merge the lines of each multi-line production into a single production node. |
OK, now each production should should have complete rawsource. |
Sorry for the delay on my part. I've refactored to split the parsing of content lines into individual productions into its own method, as I think it is sufficiently complex to warrant a dedicated function (and this massively simplifies the creation of the actual production node). One open question is if A |
Don't worry about delays; I've had more important things to deal with too :) Do you think a I think Enum would be overengineering; we'd need to duplicate the names from the regex (unless we build the regex from the enum -- more overengineering). |
I've pushed this change to the PR, and updated the branch to fix a conflict. |
@encukou I don't see any new commits... |
I think that was a GitHub glitch. |
…-snippet` directive (python#130376) Co-authored-by: Petr Viktorin <[email protected]> Co-authored-by: Blaise Pabon <[email protected]>
Split into individual commits for readability. I contend that
productionlist
nodes are semantically the right thing to use here, the only reason we didn't before was due to a limitation in Sphinx.A
📚 Documentation preview 📚: https://cpython-previews--130376.org.readthedocs.build/