Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-127833: Useproductionlist nodes to implement thegrammar-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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AA-Turner merged 18 commits intopython:mainfromAA-Turner:docs/productionlist-grammar
Mar 20, 2025

Conversation

AA-Turner
Copy link
Member

@AA-TurnerAA-Turner commentedFeb 20, 2025
edited by github-actionsbot
Loading

Split into individual commits for readability. I contend thatproductionlist 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/

Copy link
Member

@encukouencukou left a 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 hasneeds_sphinx = '8.1.3', and I got a very worrying result with that version: the entirereference directory was missing, without any error message I could see. Is that something you want to look into?

@encukou
Copy link
Member

The extension defines two directives, one with the new syntax but also aCompatProductionList thatoverrides Sphinx's.. productionlist::. We have syntax highlighting in existing productionlists too.

I added code to merge the lines of each multi-line production into a single production node.
Upstream Sphinx might need a similar change.

encukou reacted with thumbs up emoji

@encukou
Copy link
Member

OK, now each production should should have complete rawsource.

@AA-Turner
Copy link
MemberAuthor

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 ifgroup_dict is the right representation, as my understanding is that each dict must have exactly one key -- perhaps an enum would be a better fit? I'm not sure though, and we mustn't let perfect be the enemy of the good.

A

@encukou
Copy link
Member

Don't worry about delays; I've had more important things to deal with too :)

Do you think a(type, content) tuple makes it clearer? Like this:AA-Turner/cpython@docs/productionlist-grammar...encukou:cpython:docs/productionlist-grammar

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).

@encukou
Copy link
Member

I've pushed this change to the PR, and updated the branch to fix a conflict.

@AA-Turner
Copy link
MemberAuthor

@encukou I don't see any new commits...

@encukou
Copy link
Member

I think that was a GitHub glitch.

@AA-TurnerAA-Turner merged commit443c0cd intopython:mainMar 20, 2025
43 checks passed
@github-project-automationgithub-project-automationbot moved this fromTodo toDone inDocs PRsMar 20, 2025
@AA-TurnerAA-Turner deleted the docs/productionlist-grammar branchMarch 20, 2025 15:35
seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
…-snippet` directive (python#130376)Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Blaise Pabon <blaise@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@encukouencukouencukou approved these changes

@hugovkhugovkAwaiting requested review from hugovkhugovk is a code owner

Assignees
No one assigned
Labels
docsDocumentation in the Doc dirskip news
Projects
Status: Done
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@AA-Turner@encukou@blaisep

[8]ページ先頭

©2009-2025 Movatter.jp