Update cpp domain identifier regex to match destructors

Previously the regex would fail to match c++ destructors, as the presence of a
"~" would mean that the "\b" would no longer match the start of a word.

Now we try to find the optional "~" first then continue with the word as
normal.
This commit is contained in:
Michael Jones 2010-11-18 08:51:43 +13:00
parent ffd9268a65
commit d04182b85c

View File

@ -23,7 +23,7 @@ from sphinx.util.nodes import make_refnode
from sphinx.util.compat import Directive
_identifier_re = re.compile(r'\b(~?[a-zA-Z_][a-zA-Z0-9_]*)\b')
_identifier_re = re.compile(r'(~?\b[a-zA-Z_][a-zA-Z0-9_]*)\b')
_whitespace_re = re.compile(r'\s+(?u)')
_string_re = re.compile(r"[LuU8]?('([^'\\]*(?:\\.[^'\\]*)*)'"
r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S)