[gtk-doc] mkdb: join two regexp to simplify the code



commit 5002876f952c807cc24b2b0b8e716861ca672c49
Author: Stefan Sauer <ensonic users sf net>
Date:   Tue Apr 9 07:51:00 2019 +0200

    mkdb: join two regexp to simplify the code

 gtkdoc/mkdb.py | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py
index fff9de6..9652276 100644
--- a/gtkdoc/mkdb.py
+++ b/gtkdoc/mkdb.py
@@ -3780,20 +3780,16 @@ def SegmentCommentBlock(lines, line_number=0, ifile=''):
 
         # If we haven't found the symbol name yet, look for it.
         if not symbol:
-            m1 = re.search(r'^\s*(SECTION:\s*\S+)', line)
-            m2 = re.search(r'^\s*(PROGRAM:\s*\S+)', line)
-            m3 = re.search(r'^\s*([\w:-]*\w)\s*:?\s*(\(.+?\)\s*)*$', line)
+            m1 = re.search(r'^\s*((SECTION|PROGRAM):\s*\S+)', line)
+            m2 = re.search(r'^\s*([\w:-]*\w)\s*:?\s*(\(.+?\)\s*)*$', line)
             if m1:
                 symbol = m1.group(1)
-                logging.info("SECTION DOCS found in source for : '%s'", symbol)
+                logging.info("docs found in source for : '%s'", symbol)
             elif m2:
                 symbol = m2.group(1)
-                logging.info("PROGRAM DOCS found in source for : '%s'", symbol)
-            elif m3:
-                symbol = m3.group(1)
-                logging.info("SYMBOL DOCS found in source for : '%s'", symbol)
-                if m3.group(2):
-                    annotation = m3.group(2).strip()
+                logging.info("docs found in source for : '%s'", symbol)
+                if m2.group(2):
+                    annotation = m2.group(2).strip()
                     if annotation != '':
                         SymbolAnnotations[symbol] = annotation
                         logging.info("remaining text for %s: '%s'", symbol, annotation)


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