From d04182b85ca7a318137965f38a01f957006dfa10 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Thu, 18 Nov 2010 08:51:43 +1300 Subject: [PATCH] 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. --- sphinx/domains/cpp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index 35afe1915..53c92cd82 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -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)