bpo-35054: Add more index entries for symbols. (GH-10064)

diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 638e160..592d6ca 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -21,6 +21,7 @@
 .. index::
    single: clause
    single: suite
+   single: ;
 
 A compound statement consists of one or more 'clauses.'  A clause consists of a
 header and a 'suite.'  The clause headers of a particular compound statement are
@@ -84,8 +85,7 @@
    statement: if
    keyword: elif
    keyword: else
-           keyword: elif
-           keyword: else
+   single: :; compound statement
 
 The :keyword:`if` statement is used for conditional execution:
 
@@ -111,6 +111,7 @@
    keyword: else
    pair: loop; statement
    keyword: else
+   single: :; compound statement
 
 The :keyword:`while` statement is used for repeated execution as long as an
 expression is true:
@@ -149,6 +150,7 @@
    keyword: else
    pair: target; list
    object: sequence
+   single: :; compound statement
 
 The :keyword:`for` statement is used to iterate over the elements of a sequence
 (such as a string, tuple or list) or other iterable object:
@@ -229,7 +231,9 @@
    statement: try
    keyword: except
    keyword: finally
-.. index:: keyword: except
+   keyword: else
+   keyword: as
+   single: :; compound statement
 
 The :keyword:`try` statement specifies exception handlers and/or cleanup code
 for a group of statements:
@@ -263,6 +267,8 @@
 the new exception in the surrounding code and on the call stack (it is treated
 as if the entire :keyword:`try` statement raised the exception).
 
+.. index:: single: as; except clause
+
 When a matching except clause is found, the exception is assigned to the target
 specified after the :keyword:`as` keyword in that except clause, if present, and
 the except clause's suite is executed.  All except clauses must have an
@@ -375,8 +381,11 @@
 =============================
 
 .. index::
-    statement: with
-    single: as; with statement
+   statement: with
+   keyword: as
+   single: as; with statement
+   single: ,; with statement
+   single: :; compound statement
 
 The :keyword:`with` statement is used to wrap the execution of a block with
 methods defined by a context manager (see section :ref:`context-managers`).
@@ -463,6 +472,10 @@
    object: function
    pair: function; name
    pair: name; binding
+   single: (; function definition
+   single: ); function definition
+   single: ,; parameter list
+   single: :; compound statement
 
 A function definition defines a user-defined function object (see section
 :ref:`types`):
@@ -492,7 +505,7 @@
 only when the function is called. [#]_
 
 .. index::
-  statement: @
+   single: @; function definition
 
 A function definition may be wrapped by one or more :term:`decorator` expressions.
 Decorator expressions are evaluated when the function is defined, in the scope
@@ -515,6 +528,7 @@
 .. index::
    triple: default; parameter; value
    single: argument; function definition
+   single: =; function definition
 
 When one or more :term:`parameters <parameter>` have the form *parameter* ``=``
 *expression*, the function is said to have "default parameter values."  For a
@@ -541,8 +555,8 @@
        return penguin
 
 .. index::
-  statement: *
-  statement: **
+   single: *; function definition
+   single: **; function definition
 
 Function call semantics are described in more detail in section :ref:`calls`. A
 function call always assigns values to all parameters mentioned in the parameter
@@ -555,7 +569,10 @@
 "``*identifier``" are keyword-only parameters and may only be passed
 used keyword arguments.
 
-.. index:: pair: function; annotations
+.. index::
+   pair: function; annotations
+   single: ->; function annotations
+   single: :; function annotations
 
 Parameters may have annotations of the form "``: expression``" following the
 parameter name.  Any parameter may have an annotation even those of the form
@@ -617,6 +634,10 @@
    pair: execution; frame
    single: inheritance
    single: docstring
+   single: (; class definition
+   single: ); class definition
+   single: ,; expression list
+   single: :; compound statement
 
 A class definition defines a class object (see section :ref:`types`):
 
@@ -655,6 +676,9 @@
 
 Class creation can be customized heavily using :ref:`metaclasses <metaclasses>`.
 
+.. index::
+   single: @; class definition
+
 Classes can also be decorated: just like when decorating functions, ::
 
    @f1(arg)
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 81467d0..efbc872 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -165,7 +165,9 @@
 
 
 Ellipsis
-   .. index:: object: Ellipsis
+   .. index::
+      object: Ellipsis
+      single: ...; ellipsis literal
 
    This type has a single value.  There is a single object with this value. This
    object is accessed through the literal ``...`` or the built-in name
@@ -1831,8 +1833,9 @@
 ^^^^^^^^^^^
 
 .. index::
-    single: metaclass
-    builtin: type
+   single: metaclass
+   builtin: type
+   single: =; class definition
 
 By default, classes are constructed using :func:`type`. The class body is
 executed in a new namespace and the class name is bound locally to the
diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst
index d08abdf..5c83181 100644
--- a/Doc/reference/executionmodel.rst
+++ b/Doc/reference/executionmodel.rst
@@ -52,7 +52,7 @@
 
 :dfn:`Names` refer to objects.  Names are introduced by name binding operations.
 
-.. index:: statement: from
+.. index:: single: from; import statement
 
 The following constructs bind names: formal parameters to functions,
 :keyword:`import` statements, class and function definitions (these bind the
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst
index f4b1618..fdbbba1 100644
--- a/Doc/reference/expressions.rst
+++ b/Doc/reference/expressions.rst
@@ -128,7 +128,10 @@
 Parenthesized forms
 -------------------
 
-.. index:: single: parenthesized form
+.. index::
+   single: parenthesized form
+   single: (; tuple display
+   single: ); tuple display
 
 A parenthesized form is an optional expression list enclosed in parentheses:
 
@@ -146,8 +149,9 @@
 tuple may or may not yield the same object).
 
 .. index::
-   single: comma
+   single: comma; tuple display
    pair: tuple; display
+   single: ,; tuple display
 
 Note that tuples are not formed by the parentheses, but rather by use of the
 comma operator.  The exception is the empty tuple, for which parentheses *are*
@@ -168,6 +172,11 @@
 * they are computed via a set of looping and filtering instructions, called a
   :dfn:`comprehension`.
 
+.. index::
+   single: for; in comprehensions
+   single: if; in comprehensions
+   single: async for; in comprehensions
+
 Common syntax elements for comprehensions are:
 
 .. productionlist::
@@ -198,6 +207,9 @@
 type, ``yield`` and ``yield from`` expressions are prohibited in the implicitly
 nested scope.
 
+.. index::
+   single: await; in comprehensions
+
 Since Python 3.6, in an :keyword:`async def` function, an :keyword:`async for`
 clause may be used to iterate over a :term:`asynchronous iterator`.
 A comprehension in an :keyword:`async def` function may consist of either a
@@ -227,6 +239,9 @@
    pair: list; comprehensions
    pair: empty; list
    object: list
+   single: [; list expression
+   single: ]; list expression
+   single: ,; expression list
 
 A list display is a possibly empty series of expressions enclosed in square
 brackets:
@@ -246,8 +261,12 @@
 Set displays
 ------------
 
-.. index:: pair: set; display
-           object: set
+.. index::
+   pair: set; display
+   object: set
+   single: {; set expression
+   single: }; set expression
+   single: ,; expression list
 
 A set display is denoted by curly braces and distinguishable from dictionary
 displays by the lack of colons separating keys and values:
@@ -270,9 +289,14 @@
 Dictionary displays
 -------------------
 
-.. index:: pair: dictionary; display
-           key, datum, key/datum pair
-           object: dictionary
+.. index::
+   pair: dictionary; display
+   key, datum, key/datum pair
+   object: dictionary
+   single: {; dictionary expression
+   single: }; dictionary expression
+   single: :; in dictionary expressions
+   single: ,; in dictionary displays
 
 A dictionary display is a possibly empty series of key/datum pairs enclosed in
 curly braces:
@@ -291,7 +315,9 @@
 that you can specify the same key multiple times in the key/datum list, and the
 final dictionary's value for that key will be the last one given.
 
-.. index:: unpacking; dictionary, **; in dictionary displays
+.. index::
+   unpacking; dictionary
+   single: **; in dictionary displays
 
 A double asterisk ``**`` denotes :dfn:`dictionary unpacking`.
 Its operand must be a :term:`mapping`.  Each mapping item is added
@@ -321,8 +347,11 @@
 Generator expressions
 ---------------------
 
-.. index:: pair: generator; expression
-           object: generator
+.. index::
+   pair: generator; expression
+   object: generator
+   single: (; generator expression
+   single: ); generator expression
 
 A generator expression is a compact generator notation in parentheses:
 
@@ -376,6 +405,7 @@
 
 .. index::
    keyword: yield
+   keyword: from
    pair: yield; expression
    pair: generator; function
 
@@ -439,6 +469,9 @@
 the generator-iterator's :meth:`~generator.close` method will be called,
 allowing any pending :keyword:`finally` clauses to execute.
 
+.. index::
+   single: from; yield from expression
+
 When ``yield from <expr>`` is used, it treats the supplied expression as
 a subiterator. All values produced by that subiterator are passed directly
 to the caller of the current generator's methods. Any values passed in with
@@ -718,7 +751,9 @@
 Attribute references
 --------------------
 
-.. index:: pair: attribute; reference
+.. index::
+   pair: attribute; reference
+   single: .; attribute reference
 
 An attribute reference is a primary followed by a period and a name:
 
@@ -744,7 +779,10 @@
 Subscriptions
 -------------
 
-.. index:: single: subscription
+.. index::
+   single: subscription
+   single: [; subscription
+   single: ]; subscription
 
 .. index::
    object: sequence
@@ -801,6 +839,8 @@
 .. index::
    single: slicing
    single: slice
+   single: :; slicing
+   single: ,; slicing
 
 .. index::
    object: sequence
@@ -850,6 +890,10 @@
    object: callable
    single: call
    single: argument; call semantics
+   single: (; call
+   single: ); call
+   single: ,; argument list
+   single: =; in function calls
 
 .. _calls:
 
@@ -1032,6 +1076,7 @@
    if that method was called.
 
 
+.. index:: keyword: await
 .. _await:
 
 Await expression
@@ -1051,6 +1096,10 @@
 The power operator
 ==================
 
+.. index::
+   pair: power; operation
+   operator: **
+
 The power operator binds more tightly than unary operators on its left; it binds
 less tightly than unary operators on its right.  The syntax is:
 
@@ -1093,15 +1142,21 @@
 .. index::
    single: negation
    single: minus
+   single: operator; -
+   single: -; unary operator
 
 The unary ``-`` (minus) operator yields the negation of its numeric argument.
 
-.. index:: single: plus
+.. index::
+   single: plus
+   single: operator; +
+   single: +; unary operator
 
 The unary ``+`` (plus) operator yields its numeric argument unchanged.
 
-.. index:: single: inversion
-
+.. index::
+   single: inversion
+   operator: ~
 
 The unary ``~`` (invert) operator yields the bitwise inversion of its integer
 argument.  The bitwise inversion of ``x`` is defined as ``-(x+1)``.  It only
@@ -1131,7 +1186,9 @@
          : `m_expr` "%" `u_expr`
    a_expr: `m_expr` | `a_expr` "+" `m_expr` | `a_expr` "-" `m_expr`
 
-.. index:: single: multiplication
+.. index::
+   single: multiplication
+   operator: *
 
 The ``*`` (multiplication) operator yields the product of its arguments.  The
 arguments must either both be numbers, or one argument must be an integer and
@@ -1151,6 +1208,8 @@
 .. index::
    exception: ZeroDivisionError
    single: division
+   operator: /
+   operator: //
 
 The ``/`` (division) and ``//`` (floor division) operators yield the quotient of
 their arguments.  The numeric arguments are first converted to a common type.
@@ -1159,7 +1218,9 @@
 applied to the result.  Division by zero raises the :exc:`ZeroDivisionError`
 exception.
 
-.. index:: single: modulo
+.. index::
+   single: modulo
+   operator: %
 
 The ``%`` (modulo) operator yields the remainder from the division of the first
 argument by the second.  The numeric arguments are first converted to a common
@@ -1184,14 +1245,20 @@
 function are not defined for complex numbers.  Instead, convert to a floating
 point number using the :func:`abs` function if appropriate.
 
-.. index:: single: addition
+.. index::
+   single: addition
+   single: operator; +
+   single: +; binary operator
 
 The ``+`` (addition) operator yields the sum of its arguments.  The arguments
 must either both be numbers or both be sequences of the same type.  In the
 former case, the numbers are converted to a common type and then added together.
 In the latter case, the sequences are concatenated.
 
-.. index:: single: subtraction
+.. index::
+   single: subtraction
+   single: operator; -
+   single: -; binary operator
 
 The ``-`` (subtraction) operator yields the difference of its arguments.  The
 numeric arguments are first converted to a common type.
@@ -1202,7 +1269,10 @@
 Shifting operations
 ===================
 
-.. index:: pair: shifting; operation
+.. index::
+   pair: shifting; operation
+   operator: <<
+   operator: >>
 
 The shifting operations have lower priority than the arithmetic operations:
 
@@ -1232,7 +1302,9 @@
    xor_expr: `and_expr` | `xor_expr` "^" `and_expr`
    or_expr: `xor_expr` | `or_expr` "|" `xor_expr`
 
-.. index:: pair: bitwise; and
+.. index::
+   pair: bitwise; and
+   operator: &
 
 The ``&`` operator yields the bitwise AND of its arguments, which must be
 integers.
@@ -1240,6 +1312,7 @@
 .. index::
    pair: bitwise; xor
    pair: exclusive; or
+   operator: ^
 
 The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, which
 must be integers.
@@ -1247,6 +1320,7 @@
 .. index::
    pair: bitwise; or
    pair: inclusive; or
+   operator: |
 
 The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which
 must be integers.
@@ -1257,9 +1331,15 @@
 Comparisons
 ===========
 
-.. index:: single: comparison
-
-.. index:: pair: C; language
+.. index::
+   single: comparison
+   pair: C; language
+   operator: <
+   operator: >
+   operator: <=
+   operator: >=
+   operator: ==
+   operator: !=
 
 Unlike C, all comparison operations in Python have the same priority, which is
 lower than that of any arithmetic, shifting or bitwise operation.  Also unlike
@@ -1577,6 +1657,8 @@
 .. index::
    pair: conditional; expression
    pair: ternary; operator
+   single: if; conditional expression
+   single: else; conditional expression
 
 .. productionlist::
    conditional_expression: `or_test` ["if" `or_test` "else" `expression`]
@@ -1603,10 +1685,11 @@
    pair: lambda; expression
    pair: lambda; form
    pair: anonymous; function
+   single: :; lambda expression
 
 .. productionlist::
-   lambda_expr: "lambda" [`parameter_list`]: `expression`
-   lambda_expr_nocond: "lambda" [`parameter_list`]: `expression_nocond`
+   lambda_expr: "lambda" [`parameter_list`] ":" `expression`
+   lambda_expr_nocond: "lambda" [`parameter_list`] ":" `expression_nocond`
 
 Lambda expressions (sometimes called lambda forms) are used to create anonymous
 functions. The expression ``lambda parameters: expression`` yields a function
@@ -1627,7 +1710,10 @@
 Expression lists
 ================
 
-.. index:: pair: expression; list
+.. index::
+   pair: expression; list
+   single: comma; expression list
+   single: ,; expression list
 
 .. productionlist::
    expression_list: `expression` ("," `expression`)* [","]
@@ -1689,7 +1775,8 @@
 Operator precedence
 ===================
 
-.. index:: pair: operator; precedence
+.. index::
+   pair: operator; precedence
 
 The following table summarizes the operator precedence in Python, from lowest
 precedence (least binding) to highest precedence (most binding).  Operators in
@@ -1737,7 +1824,7 @@
 +-----------------------------------------------+-------------------------------------+
 | ``**``                                        | Exponentiation [#]_                 |
 +-----------------------------------------------+-------------------------------------+
-| ``await`` ``x``                               | Await expression                    |
+| :keyword:`await` ``x``                        | Await expression                    |
 +-----------------------------------------------+-------------------------------------+
 | ``x[index]``, ``x[index:index]``,             | Subscription, slicing,              |
 | ``x(arguments...)``, ``x.attribute``          | call, attribute reference           |
diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst
index 44b5b81..7c4f275 100644
--- a/Doc/reference/import.rst
+++ b/Doc/reference/import.rst
@@ -127,8 +127,8 @@
 ------------------
 
 .. index::
-    pair:: package; namespace
-    pair:: package; portion
+    pair: package; namespace
+    pair: package; portion
 
 A namespace package is a composite of various :term:`portions <portion>`,
 where each portion contributes a subpackage to the parent package.  Portions
diff --git a/Doc/reference/lexical_analysis.rst b/Doc/reference/lexical_analysis.rst
index e1d88ef..b197f23 100644
--- a/Doc/reference/lexical_analysis.rst
+++ b/Doc/reference/lexical_analysis.rst
@@ -65,6 +65,7 @@
 --------
 
 .. index:: comment, hash character
+   single: #; comment
 
 A comment starts with a hash character (``#``) that is not part of a string
 literal, and ends at the end of the physical line.  A comment signifies the end
@@ -78,6 +79,7 @@
 ---------------------
 
 .. index:: source character set, encoding declarations (source file)
+   single: #; source encoding declaration
 
 If a comment in the first or second line of the Python script matches the
 regular expression ``coding[=:]\s*([-\w.]+)``, this comment is processed as an
@@ -349,6 +351,9 @@
    assert     del        global     not        with
    async      elif       if         or         yield
 
+.. index::
+   single: _, identifiers
+   single: __, identifiers
 .. _id-classes:
 
 Reserved classes of identifiers
@@ -395,13 +400,16 @@
 Literals are notations for constant values of some built-in types.
 
 
+.. index:: string literal, bytes literal, ASCII
+   single: '; string literal
+   single: "; string literal
+   single: u'; string literal
+   single: u"; string literal
 .. _strings:
 
 String and Bytes literals
 -------------------------
 
-.. index:: string literal, bytes literal, ASCII
-
 String literals are described by the following lexical definitions:
 
 .. productionlist::
@@ -434,6 +442,8 @@
 see section :ref:`encodings`.
 
 .. index:: triple-quoted string, Unicode Consortium, raw string
+   single: """; string literal
+   single: '''; string literal
 
 In plain English: Both types of literals can be enclosed in matching single quotes
 (``'``) or double quotes (``"``).  They can also be enclosed in matching groups
@@ -442,11 +452,19 @@
 characters that otherwise have a special meaning, such as newline, backslash
 itself, or the quote character.
 
+.. index::
+   single: b'; bytes literal
+   single: b"; bytes literal
+
 Bytes literals are always prefixed with ``'b'`` or ``'B'``; they produce an
 instance of the :class:`bytes` type instead of the :class:`str` type.  They
 may only contain ASCII characters; bytes with a numeric value of 128 or greater
 must be expressed with escapes.
 
+.. index::
+   single: r'; raw string literal
+   single: r"; raw string literal
+
 Both string and bytes literals may optionally be prefixed with a letter ``'r'``
 or ``'R'``; such strings are called :dfn:`raw strings` and treat backslashes as
 literal characters.  As a result, in string literals, ``'\U'`` and ``'\u'``
@@ -463,6 +481,10 @@
    to simplify the maintenance of dual Python 2.x and 3.x codebases.
    See :pep:`414` for more information.
 
+.. index::
+   single: f'; formatted string literal
+   single: f"; formatted string literal
+
 A string literal with ``'f'`` or ``'F'`` in its prefix is a
 :dfn:`formatted string literal`; see :ref:`f-strings`.  The ``'f'`` may be
 combined with ``'r'``, but not with ``'b'`` or ``'u'``, therefore raw
@@ -473,6 +495,19 @@
 "quote" is the character used to open the literal, i.e. either ``'`` or ``"``.)
 
 .. index:: physical line, escape sequence, Standard C, C
+   single: \; escape sequence
+   single: \\; escape sequence
+   single: \a; escape sequence
+   single: \b; escape sequence
+   single: \f; escape sequence
+   single: \n; escape sequence
+   single: \r; escape sequence
+   single: \t; escape sequence
+   single: \v; escape sequence
+   single: \x; escape sequence
+   single: \N; escape sequence
+   single: \u; escape sequence
+   single: \U; escape sequence
 
 Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string and
 bytes literals are interpreted according to rules similar to those used by
@@ -604,6 +639,10 @@
    single: string; formatted literal
    single: string; interpolated literal
    single: f-string
+   single: {; in formatted string literal
+   single: }; in formatted string literal
+   single: !; in formatted string literal
+   single: :; in formatted string literal
 .. _f-strings:
 
 Formatted string literals
@@ -738,6 +777,12 @@
 ``1``.
 
 
+.. index::
+   single: 0b; integer literal
+   single: 0o; integer literal
+   single: 0x; integer literal
+   single: _; in numeric literal
+
 .. _integers:
 
 Integer literals
@@ -778,6 +823,10 @@
    Underscores are now allowed for grouping purposes in literals.
 
 
+.. index::
+   single: .; in numeric literal
+   single: e; in numeric literal
+   single: _; in numeric literal
 .. _floating:
 
 Floating point literals
@@ -806,6 +855,8 @@
    Underscores are now allowed for grouping purposes in literals.
 
 
+.. index::
+   single: j; in numeric literal
 .. _imaginary:
 
 Imaginary literals
diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst
index f98721c..0ac7953 100644
--- a/Doc/reference/simple_stmts.rst
+++ b/Doc/reference/simple_stmts.rst
@@ -112,6 +112,12 @@
 given with the definition of the object types (see section :ref:`types`).
 
 .. index:: triple: target; list; assignment
+   single: ,; in target list
+   single: *; in assignment target list
+   single: [; in assignment target list
+   single: ]; in assignment target list
+   single: (; in assignment target list
+   single: ); in assignment target list
 
 Assignment of an object to a target list, optionally enclosed in parentheses or
 square brackets, is recursively defined as follows.
@@ -321,6 +327,7 @@
 .. index::
    pair: annotated; assignment
    single: statement; assignment, annotated
+   single: :; annotated variable
 
 Annotation assignment is the combination, in a single statement,
 of a variable or attribute annotation and an optional assignment statement:
@@ -372,6 +379,7 @@
 .. index::
    statement: assert
    pair: debugging; assertions
+   single: ,; expression list
 
 Assert statements are a convenient way to insert debugging assertions into a
 program:
@@ -712,6 +720,9 @@
    single: module; importing
    pair: name; binding
    keyword: from
+   keyword: as
+   exception: ImportError
+   single: ,; import statement
 
 .. productionlist::
    import_stmt: "import" `module` ["as" `identifier`] ("," `module` ["as" `identifier`])*
@@ -761,8 +772,7 @@
 
 .. index::
    pair: name; binding
-   keyword: from
-   exception: ImportError
+   single: from; import statement
 
 The :keyword:`from` form uses a slightly more complex process:
 
@@ -786,6 +796,8 @@
    from foo.bar import baz    # foo.bar.baz imported and bound as baz
    from foo import attr       # foo imported and foo.attr bound as attr
 
+.. index:: single: *; import statement
+
 If the list of identifiers is replaced by a star (``'*'``), all public
 names defined in the module are bound in the local namespace for the scope
 where the :keyword:`import` statement occurs.
@@ -831,7 +843,9 @@
 Future statements
 -----------------
 
-.. index:: pair: future; statement
+.. index::
+   pair: future; statement
+   single: __future__; future statement
 
 A :dfn:`future statement` is a directive to the compiler that a particular
 module should be compiled using syntax or semantics that will be available in a
@@ -918,6 +932,7 @@
 .. index::
    statement: global
    triple: global; name; binding
+   single: ,; identifier list
 
 .. productionlist::
    global_stmt: "global" `identifier` ("," `identifier`)*
@@ -962,6 +977,7 @@
 =================================
 
 .. index:: statement: nonlocal
+   single: ,; identifier list
 
 .. productionlist::
    nonlocal_stmt: "nonlocal" `identifier` ("," `identifier`)*