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

gh-118235: Skip RAISE_SYNTAX_ERROR rules in the grammar spec #118237

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

encukou
Copy link
Member

@encukou encukou commented Apr 24, 2024

I'm not too comfortable with regular expressions, and this looks like piling on another hack, but this highlighter rule strips all the current RAISE_SYNTAX_ERROR alternatives:

A diff of the rendered page:

@@ -498,9 +498,7 @@
 
 type_param:
     | NAME [type_param_bound] 
-    | '*' NAME ':' expression 
     | '*' NAME 
-    | '**' NAME ':' expression 
     | '**' NAME 
 
 type_param_bound: ':' expression 
@@ -771,7 +769,6 @@
 for_if_clause:
     | 'async' 'for' star_targets 'in' ~ disjunction ('if' disjunction )* 
     | 'for' star_targets 'in' ~ disjunction ('if' disjunction )* 
-    | 'async'? 'for' (bitwise_or (',' bitwise_or)* [',']) !'in' 
 
 listcomp:
     | '[' named_expression for_if_clauses ']' 
@@ -802,7 +799,6 @@
 
 starred_expression:
     | '*' expression 
-    | '*' 
 
 kwarg_or_starred:
     | NAME '=' expression 

📚 Documentation preview 📚: https://cpython-previews--118237.org.readthedocs.build/

@pablogsal
Copy link
Member

pablogsal commented Apr 24, 2024

Another alternative it's to move all these rules to be inside an invalid_ rule and in general prevent by review or automation rules that have RAISE_SYNTAX_ERROR in the actions.

@encukou
Copy link
Member Author

encukou commented Apr 25, 2024

Thanks for the suggestion, I'll look into that!

I'm limiting the time I spend on grammar-in-docs; with beta1 and PyCon US coming up it might be a month before my next post here.

@pablogsal
Copy link
Member

Thanks for the suggestion, I'll look into that!

In any case I think meanwhile this is not a bad temporary solution, so let's merge it for now but let's keep an eye on the better one 👍

@encukou encukou merged commit ef940de into python:main Apr 26, 2024
31 checks passed
@encukou encukou deleted the skip-error-alts branch April 26, 2024 09:01
@encukou encukou added the needs backport to 3.12 bug and security fixes label Apr 26, 2024
@miss-islington-app
Copy link

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 26, 2024
…ythonGH-118237)

(cherry picked from commit ef940de)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Apr 26, 2024

GH-118309 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Apr 26, 2024
encukou added a commit that referenced this pull request Apr 26, 2024
…H-118237) (GH-118309)

gh-118235: Skip RAISE_SYNTAX_ERROR rules in the grammar spec (GH-118237)
(cherry picked from commit ef940de)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
encukou added a commit to encukou/cpython that referenced this pull request May 29, 2024
… spec (pythonGH-118237)"

This reverts commit ef940de.

The highlighter change is no longer needed, since all RAISE_SYNTAX_ERROR
actions are in invalid rules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants