python / python/cpython

The elements in `Grammar/python.gram` stripped by `peg_lexer.py` still shows in generated PO files

未关闭
#142,714 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

docs topic-parser
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

My original question has answered by Stan. I leave it here as a record:

Click to expand

I'm not sure if it's done deliberately, but it seems odd to me and I can't find out why it happens so far.


The reference/grammar.rst includes Grammar/python.gram

https://github.com/python/cpython/blob/78a50ee10ef73296eba98899d496bff3915ddc41/Doc/reference/grammar.rst#L18-L19

and Grammar/python.gram has a section for invalid rules at the bottom.

https://github.com/python/cpython/blob/78a50ee10ef73296eba98899d496bff3915ddc41/Grammar/python.gram#L1193-L1202

However, the content after START OF INVALID RULES is missing on the page

snapshot Image

I checked the previous version and found out the doc has this issue since 3.11 (after PEG parser is introduced).


Other info:
I translated this page into Traditional Chinese (zh-tw) recently and somehow it shows correctly on the translated page

snapshot Image

So here's the revised issue description:

Some elements in Grammar/python.gram are stripped by peg_lexer.py, and hence they're hidden on the reference/grammar docs. However, the full content of Grammar/python.gram is still remained in the generated PO files (e.g. the one in zh-tw).

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Doc/tools/extensions/lexers/peg_lexer.py 开始,将其对 Grammar/python.gram 的处理方式与其在 Doc/reference/grammar.rst 中的包含方式进行比较。检查生成的 reference/grammar.po 示例,以了解被剥离的内容仍保留在哪里。Done 应定义预期的处理方式,并在渲染后的文档和生成的 PO 文件中一致地应用该处理方式。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
documentation, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。