This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ~ PEG operator in the grammar
Type: Stage: resolved
Components: Parser Versions: Python 3.10
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: RobEin, lys.nikolaou, pablogsal
Priority: normal Keywords:

Created on 2022-01-23 10:38 by RobEin, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg411360 - (view) Author: Robert Einhorn (RobEin) Date: 2022-01-23 10:38
This is probably not an error and I may misinterpret the PEP 617, but I don't know what the ~ PEG operator means in the next rule if there is no alternative:
assignment_expression:
    | NAME ':=' ~ expression


And similarly with this rule if there is no more alternative:
assignment:
    | NAME ':' expression ['=' annotated_rhs ] 
    | ('(' single_target ')' 
         | single_subscript_attribute_target) ':' expression ['=' annotated_rhs ] 
    | (star_targets '=' )+ (yield_expr | star_expressions) !'=' [TYPE_COMMENT] 
    | single_target augassign ~ (yield_expr | star_expressions)

Related links:
https://docs.python.org/3/reference/grammar.html
https://www.python.org/dev/peps/pep-0617/#id9
msg411361 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2022-01-23 11:22
It means the same as if there is alternatives: if it fails to parse then it will immediately fail. We place them in rules like this in preparation for extension or in case there are invalid_* rules in the same set (which doesn't appear in the grammar definition).
msg411362 - (view) Author: Robert Einhorn (RobEin) Date: 2022-01-23 11:38
Thanks
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90643
2022-01-23 14:12:52pablogsalsetstatus: open -> closed
resolution: not a bug
2022-01-23 11:38:14RobEinsetstatus: closed -> open
resolution: not a bug -> (no value)
messages: + msg411362
2022-01-23 11:22:40pablogsalsetstatus: open -> closed
resolution: not a bug
messages: + msg411361

stage: resolved
2022-01-23 10:38:56RobEincreate