Skip to content
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

~ PEG operator in the grammar #90643

Closed
RobEin mannequin opened this issue Jan 23, 2022 · 3 comments
Closed

~ PEG operator in the grammar #90643

RobEin mannequin opened this issue Jan 23, 2022 · 3 comments
Labels
3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@RobEin
Copy link
Mannequin

RobEin mannequin commented Jan 23, 2022

BPO 46485
Nosy @lysnikolaou, @pablogsal, @RobEin

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2022-01-23.14:12:52.749>
created_at = <Date 2022-01-23.10:38:56.845>
labels = ['interpreter-core', 'invalid', '3.10']
title = '~ PEG operator in the grammar'
updated_at = <Date 2022-01-23.14:12:52.749>
user = 'https://github.com/RobEin'

bugs.python.org fields:

activity = <Date 2022-01-23.14:12:52.749>
actor = 'pablogsal'
assignee = 'none'
closed = True
closed_date = <Date 2022-01-23.14:12:52.749>
closer = 'pablogsal'
components = ['Parser']
creation = <Date 2022-01-23.10:38:56.845>
creator = 'RobEin'
dependencies = []
files = []
hgrepos = []
issue_num = 46485
keywords = []
message_count = 3.0
messages = ['411360', '411361', '411362']
nosy_count = 3.0
nosy_names = ['lys.nikolaou', 'pablogsal', 'RobEin']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue46485'
versions = ['Python 3.10']

@RobEin
Copy link
Mannequin Author

RobEin mannequin commented Jan 23, 2022

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

@RobEin RobEin mannequin added 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jan 23, 2022
@pablogsal
Copy link
Member

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

@RobEin
Copy link
Mannequin Author

RobEin mannequin commented Jan 23, 2022

Thanks

@RobEin RobEin mannequin reopened this Jan 23, 2022
@RobEin RobEin mannequin removed the invalid label Jan 23, 2022
@RobEin RobEin mannequin reopened this Jan 23, 2022
@RobEin RobEin mannequin removed the invalid label Jan 23, 2022
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

1 participant