gh-130587: Add hand-written docs for non-OP tokens (GH-130588)

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
Petr Viktorin 2025-03-19 16:42:11 +01:00 committed by GitHub
parent b8367e7cf3
commit 4bced29a74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 293 additions and 258 deletions

View file

@ -69,7 +69,7 @@ All input read from non-interactive files has the same form:
.. grammar-snippet::
:group: python-grammar
file_input: (NEWLINE | `statement`)*
file_input: (NEWLINE | `statement`)* ENDMARKER
This syntax is used in the following situations:
@ -90,7 +90,7 @@ Input in interactive mode is parsed using the following grammar:
.. grammar-snippet::
:group: python-grammar
interactive_input: [`stmt_list`] NEWLINE | `compound_stmt` NEWLINE
interactive_input: [`stmt_list`] NEWLINE | `compound_stmt` NEWLINE | ENDMARKER
Note that a (top-level) compound statement must be followed by a blank line in
interactive mode; this is needed to help the parser detect the end of the input.
@ -107,5 +107,7 @@ Expression input
:func:`eval` is used for expression input. It ignores leading whitespace. The
string argument to :func:`eval` must have the following form:
.. productionlist:: python-grammar
eval_input: `expression_list` NEWLINE*
.. grammar-snippet::
:group: python-grammar
eval_input: `expression_list` NEWLINE* ENDMARKER