From 5d323e61c2378df32939ad192a9b11dd8ffd2e34 Mon Sep 17 00:00:00 2001 From: noname77 Date: Thu, 12 Oct 2023 00:24:10 +0200 Subject: [PATCH] fix generics in properties closes #17 --- sphinx_csharp/csharp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sphinx_csharp/csharp.py b/sphinx_csharp/csharp.py index e589d0f..6c0dbd5 100644 --- a/sphinx_csharp/csharp.py +++ b/sphinx_csharp/csharp.py @@ -53,7 +53,7 @@ r'^' + PARAM_MODIFIERS_RE.pattern + TYPE_RE.pattern + r'\s+(?P[^\s<{=]+)\s*(?:=\s*(?P.+))?$') PROP_SIG_RE = re.compile( - r'^([^\s]+\s+)*([^\s]+)\s+([^\s]+)\s*{\s*(get;)?\s*(set;)?\s*}\s*=?\s*(.+)?\s*$') + r'^(\w+\s+)*([\w.\[\]]+(<.*>)?)\s+(\w+)\s*\{\s*(get;)?\s*(set;)?\s*\}\s*=?\s*(.+)?\s*$') IDXR_SIG_RE = re.compile( r'^((?:(?:' + MODIFIERS_RE_SIMPLE + @@ -191,12 +191,12 @@ def parse_property_signature(sig: str, location): groups = match.groups() if groups[0] is not None: - modifiers = [x.strip() for x in groups[:-5]] - groups = groups[-5:] + modifiers = [x.strip() for x in groups[:-6]] + groups = groups[-6:] else: modifiers = [] groups = groups[1:] - typ, name, getter, setter, default_val = groups + typ, _, name, getter, setter, default_val = groups if CSDebug.parse_prop: logger.info(f"parsed prop: {modifiers, typ, name, getter is not None, setter is not None}")