Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Support XID_Start/XID_Continue Unicode chars in C++ identifiers (#14026)
  • Loading branch information
jagot committed Nov 5, 2025
commit 65c8288b99dd93602f771417b86c0455a699a7b6
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Contributors
* Slawek Figiel -- additional warning suppression
* Stefan Seefeld -- toctree improvements
* Stefan van der Walt -- autosummary extension
* Stefanos Carlström -- minor bug fix
* Steve Piercy -- documentation improvements
* Szymon Karpinski -- intersphinx improvements
* \T. Powers -- HTML output improvements
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Release 8.3.0 (in development)
Dependencies
------------

* #14026: Added `regex >= 2025.7.29`_, to support parsing for Unicode classes.

.. _regex >= 2025.7.29: _https://github.com/mrabarnett/mrab-regex

* #13786: Support `Docutils 0.22`_. Patch by Adam Turner.

.. _Docutils 0.22: https://docutils.sourceforge.io/RELEASE-NOTES.html#release-0-22-2026-07-29
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ dependencies = [
"packaging>=23.0",
"colorama>=0.4.6; sys_platform == 'win32'",
"ipython>=9.6.0",
"regex>=2025.7.29"
]
dynamic = ["version"]

Expand Down
8 changes: 6 additions & 2 deletions sphinx/util/cfamily.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""Utility functions common to the C and C++ domains."""

from __future__ import annotations

import re
import regex as re
from copy import deepcopy
from typing import TYPE_CHECKING

from docutils import nodes

from sphinx import addnodes
from sphinx.util import logging

Check failure on line 12 in sphinx/util/cfamily.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

sphinx/util/cfamily.py:3:1: I001 Import block is un-sorted or un-formatted

if TYPE_CHECKING:
from collections.abc import Callable, Sequence
Expand All @@ -30,9 +30,13 @@
( # This 'extends' _anon_identifier_re with the ordinary identifiers,
# make sure they are in sync.
(~?\b[a-zA-Z_]) # ordinary identifiers
| \p{XID_Start} # Unicode-allowed starting characters for identifiers
| (@[a-zA-Z0-9_]) # our extension for names of anonymous entities
)
[a-zA-Z0-9_]*\b
(
[a-zA-Z0-9_] # ordinary identifiers
| \p{XID_Continue} # Unicode-allowed continuing characters for identifiers
)*\b
""",
flags=re.VERBOSE,
)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_domains/test_domain_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,10 @@ def test_domain_cpp_ast_function_definitions() -> None:

check('function', 'decltype(auto) f()', {1: 'f', 2: '1fv'})

# Test derived from https://github.com/sphinx-doc/sphinx/issues/14026
# Unicode identifiers
check('function', 'void f(int *const ξ)', {1: 'f__iPC', 2: '1fPCi'})

# TODO: make tests for functions in a template, e.g., Test<int&&()>
# such that the id generation for function type types is correct.

Expand Down
Loading