Skip to content

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

@mattwang44

Description

@mattwang44

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

.. literalinclude:: ../../Grammar/python.gram
:language: peg

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

cpython/Grammar/python.gram

Lines 1193 to 1202 in 78a50ee

# ========================= END OF THE GRAMMAR ===========================
# ========================= START OF INVALID RULES =======================
# From here on, there are rules for invalid syntax with specialised error messages
invalid_arguments:
| ((','.(starred_expression | ( assignment_expression | expression !':=') !'=')+ ',' kwargs) | kwargs) a=',' ','.(starred_expression !'=')+ {

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Todo

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions