Skip to content

Commit e02ced8

Browse files
encukouAA-Turnerlysnikolaou
authored
Apply suggestions from code review
Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Lysandros Nikolaou <[email protected]>
1 parent dca268e commit e02ced8

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

Doc/library/token-list.inc

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/library/token.rst

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The token constants are:
4747
.. data:: NAME
4848

4949
Token value that indicates an :ref:`identifier <identifiers>`.
50-
Note that keywords are also identifiers.
50+
Note that keywords are also initially tokenized an ``NAME`` tokens.
5151

5252
.. data:: NUMBER
5353

@@ -56,10 +56,10 @@ The token constants are:
5656
.. data:: STRING
5757

5858
Token value that indicates a :ref:`string or byte literal <strings>`,
59-
excluding :ref:`f-strings <f-strings>`.
60-
The token string is not interpreted: it includes the prefix (if any)
61-
and the quote characters; escape sequences are included with their
62-
initial backslash.
59+
excluding :ref:`formatted string literals <f-strings>`.
60+
The token string is not interpreted:
61+
it includes the surrounding quotation marks and the prefix (if given);
62+
backslashes are included literally, without processing escape sequences.
6363

6464
.. data:: OP
6565

@@ -74,8 +74,7 @@ The token constants are:
7474

7575
.. data:: NEWLINE
7676

77-
Token value that indicates the end of a :ref:`logical line <logical-lines>`
78-
of Python code.
77+
Token value that indicates the end of a :ref:`logical line <logical-lines>`.
7978

8079
.. data:: NL
8180

@@ -95,17 +94,17 @@ The token constants are:
9594

9695
.. data:: FSTRING_START
9796

98-
Token value used to indicate the beginning of a
99-
:ref:`f-string <f-strings>`.
97+
Token value used to indicate the beginning of an
98+
:ref:`f-string literal <f-strings>`.
10099

101100
.. impl-detail::
102101

103-
The token string includes the prefix and the opening quote, but none
102+
The token string includes the prefix and the opening quote(s), but none
104103
of the contents of the literal.
105104

106105
.. data:: FSTRING_MIDDLE
107106

108-
Token value used for literal text inside an :ref:`f-string <f-strings>`,
107+
Token value used for literal text inside an :ref:`f-string literal <f-strings>`,
109108
including format specifications.
110109

111110
.. impl-detail::
@@ -121,7 +120,7 @@ The token constants are:
121120

122121
.. impl-detail::
123122

124-
The token string contains the closing quote.
123+
The token string contains the closing quote(s).
125124

126125
.. data:: ENDMARKER
127126

@@ -146,14 +145,14 @@ and are defined for special uses in the tokenizer or parser:
146145
.. data:: TYPE_IGNORE
147146

148147
Token value indicating that a ``type: ignore`` comment was recognized.
149-
Such tokens are produced instead of regular :data:`COMMENT` tokens only when
150-
:func:`ast.parse` is invoked with ``type_comments=True``.
148+
Such tokens are produced instead of regular :data:`COMMENT` tokens only
149+
with the :data:`~ast.PyCF_TYPE_COMMENTS` flag.
151150

152151
.. data:: TYPE_COMMENT
153152

154153
Token value indicating that a type comment was recognized.
155-
Such tokens are produced instead of regular :data:`COMMENT` tokens only when
156-
:func:`ast.parse` is invoked with ``type_comments=True``.
154+
Such tokens are produced instead of regular :data:`COMMENT` tokens only
155+
with the :data:`~ast.PyCF_TYPE_COMMENTS` flag.
157156

158157
.. data:: SOFT_KEYWORD
159158

Tools/build/generate_token.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ def make_c(infile, outfile='Parser/token.c'):
208208
.. {AUTO_GENERATED_BY_SCRIPT}
209209
210210
.. list-table::
211+
:align: left
211212
:header-rows: 1
212213
213214
* - Token

0 commit comments

Comments
 (0)