[gtk-doc: 2/4] typedef can be followed by decorator



commit b922e1486e6fa34611527f2628fef34ce4ffd42e
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Fri Jan 3 06:47:47 2020 -0500

    typedef can be followed by decorator

 gtkdoc/scan.py | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py
index 7de08ad..5a5da92 100644
--- a/gtkdoc/scan.py
+++ b/gtkdoc/scan.py
@@ -96,19 +96,8 @@ CLINE_MATCHER = [
         (struct|union)\s*
         \w*\s*{""", re.VERBOSE),
     # 12-14: OTHER TYPEDEFS
-    re.compile(
-        r"""^\s*typedef\s+
-        (?:struct|union)\s+\w+[\s\*]+
-        (\w+)                                # 1: name
-        \s*;""", re.VERBOSE),
-    re.compile(
-        r"""^\s*
-        (?:G_GNUC_EXTENSION\s+)?
-        typedef\s+
-        (.+[\s\*])                           # 1: e.g. 'unsigned int'
-        (\w+)                                # 2: name
-        (?:\s*\[[^\]]+\])*
-        \s*;""", re.VERBOSE),
+    None,  # in InitScanner()
+    None,  # in InitScanner()
     re.compile(r'^\s*typedef\s+'),
     # 15: VARIABLES (extern'ed variables)
     None,  # in InitScanner()
@@ -267,6 +256,21 @@ def InitScanner(options):
         %s                                   # 3: optional decorator
         \s*;""" % optional_decorators_regex, re.VERBOSE)
     # OTHER TYPEDEFS
+    CLINE_MATCHER[12] = re.compile(
+        r"""^\s*typedef\s+
+        (?:struct|union)\s+\w+[\s\*]+
+        (\w+)                                # 1: name
+        %s                                   # 2: optional decorator
+        \s*;""" % optional_decorators_regex, re.VERBOSE)
+    CLINE_MATCHER[13] = re.compile(
+        r"""^\s*
+        (?:G_GNUC_EXTENSION\s+)?
+        typedef\s+
+        (.+?[\s\*])                          # 1: e.g. 'unsigned int'
+        (\w+)                                # 2: name
+        (?:\s*\[[^\]]+\])*
+        %s                                   # 3: optional decorator
+        \s*;""" % optional_decorators_regex, re.VERBOSE)
     CLINE_MATCHER[15] = re.compile(
         r"""^\s*
         (?:extern|[A-Za-z_]+VAR%s)\s+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]