8000 gh-111658: Improve parser to accept complicated block of code under interactive REPL by hsfzxjy · Pull Request #111659 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-111658: Improve parser to accept complicated block of code under interactive REPL #111659

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve grammar for interactive mode
  • Loading branch information
hsfzxjy committed Nov 3, 2023
commit 1604a57743d0c30f5987fbdfdee7d2888962a152
2 changes: 1 addition & 1 deletion Grammar/python.gram
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ statements[asdl_stmt_seq*]: a=statement+ { (asdl_stmt_seq*)_PyPegen_seq_flatten(
statement[asdl_stmt_seq*]: a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | a[asdl_stmt_seq*]=simple_stmts { a }

statement_newline[asdl_stmt_seq*]:
| a=compound_stmt NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
| a[asdl_seq*]=compound_stmt+ b=(simple_stmts | NEWLINE { _Py_asdl_stmt_seq_new(0, p->arena) }) { (asdl_stmt_seq*)_PyPegen_seq_concat(p, a, (asdl_seq*)b) }
| simple_stmts
| NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(stmt_ty, _PyAST_Pass(EXTRA))) }
| ENDMARKER { _PyPegen_interactive_exit(p) }
Expand Down
Loading
0