[gobject-introspection] giscanner: use "\s" instead of "[^\S\n\r]"



commit 6efa186af9fadc1cd9605bbb943169f2a3f04fce
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date:   Wed May 15 11:12:35 2013 +0200

    giscanner: use "\s" instead of "[^\S\n\r]"
    
    The original idea was to only match non breaking space, but
    there's really no reason to do things differently than gtkdoc-mkdb.

 giscanner/annotationparser.py |   96 ++++++++++++++++++++--------------------
 1 files changed, 48 insertions(+), 48 deletions(-)
---
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 40a0140..8c8c67f 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -226,10 +226,10 @@ OPT_TRANSFER_FLOATING = 'floating'
 COMMENT_START_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     /                                                    # 1 forward slash character
     \*{2}                                                # exactly 2 asterisk characters
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     $                                                    # end
     ''',
     re.VERBOSE)
@@ -243,12 +243,12 @@ COMMENT_START_RE = re.compile(
 COMMENT_END_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<description>.*?)                                 # description text
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     \*+                                                  # 1 or more asterisk characters
     /                                                    # 1 forward slash character
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     $                                                    # end
     ''',
     re.VERBOSE)
@@ -258,9 +258,9 @@ COMMENT_END_RE = re.compile(
 COMMENT_ASTERISK_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     \*                                                   # 1 asterisk character
-    [^\S\n\r]?                                           # 0 or 1 whitespace characters
+    \s?                                                  # 0 or 1 whitespace characters
                                                          #   WARNING: removing more than 1
                                                          #   whitespace character breaks
                                                          #   embedded example program indentation
@@ -275,7 +275,7 @@ COMMENT_ASTERISK_RE = re.compile(
 COMMENT_INDENTATION_RE = re.compile(
     r'''
     ^
-    (?P<indentation>[^\S\n\r]*)                          # 0 or more whitespace characters
+    (?P<indentation>\s*)                                 # 0 or more whitespace characters
     .*
     $
     ''',
@@ -285,7 +285,7 @@ COMMENT_INDENTATION_RE = re.compile(
 EMPTY_LINE_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     $                                                    # end
     ''',
     re.VERBOSE)
@@ -298,13 +298,13 @@ EMPTY_LINE_RE = re.compile(
 SECTION_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     SECTION                                              # SECTION
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<delimiter>:?)                                    # delimiter
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<section_name>\w\S+)?                             # section name
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     $
     ''',
     re.VERBOSE)
@@ -318,13 +318,13 @@ SECTION_RE = re.compile(
 SYMBOL_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<symbol_name>[\w-]*\w)                            # symbol name
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<delimiter>:?)                                    # delimiter
-    [^\S\n\r]*                                           # 0 or more whitespace characters
-    (?P<annotations>(?:\(.*?\)[^\S\n\r]*)*)              # annotations
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
+    (?P<annotations>(?:\(.*?\)\s*)*)                     # annotations
+    \s*                                                  # 0 or more whitespace characters
     $                                                    # end
     ''',
     re.VERBOSE)
@@ -339,17 +339,17 @@ SYMBOL_RE = re.compile(
 PROPERTY_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<class_name>[\w]+)                                # class name
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     :{1}                                                 # required colon
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<property_name>[\w-]*\w)                          # property name
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<delimiter>:?)                                    # delimiter
-    [^\S\n\r]*                                           # 0 or more whitespace characters
-    (?P<annotations>(?:\(.*?\)[^\S\n\r]*)*)              # annotations
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
+    (?P<annotations>(?:\(.*?\)\s*)*)                     # annotations
+    \s*                                                  # 0 or more whitespace characters
     $                                                    # end
     ''',
     re.VERBOSE)
@@ -364,17 +364,17 @@ PROPERTY_RE = re.compile(
 SIGNAL_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<class_name>[\w]+)                                # class name
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     :{2}                                                 # 2 required colons
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<signal_name>[\w-]*\w)                            # signal name
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<delimiter>:?)                                    # delimiter
-    [^\S\n\r]*                                           # 0 or more whitespace characters
-    (?P<annotations>(?:\(.*?\)[^\S\n\r]*)*)              # annotations
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
+    (?P<annotations>(?:\(.*?\)\s*)*)                     # annotations
+    \s*                                                  # 0 or more whitespace characters
     $                                                    # end
     ''',
     re.VERBOSE)
@@ -389,17 +389,17 @@ SIGNAL_RE = re.compile(
 PARAMETER_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     @                                                    # @ character
     (?P<parameter_name>[\w-]*\w|\.\.\.)                  # parameter name
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     :{1}                                                 # required colon
-    [^\S\n\r]*                                           # 0 or more whitespace characters
-    (?P<annotations>(?:\(.*?\)[^\S\n\r]*)*)              # annotations
+    \s*                                                  # 0 or more whitespace characters
+    (?P<annotations>(?:\(.*?\)\s*)*)                     # annotations
     (?P<delimiter>:?)                                    # delimiter
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<description>.*?)                                 # description
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     $                                                    # end
     ''',
     re.VERBOSE)
@@ -415,16 +415,16 @@ _all_tags = '|'.join(_ALL_TAGS).replace(' ', '\\ ')
 TAG_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<tag_name>''' + _all_tags + r''')                 # tag name
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     :{1}                                                 # required colon
-    [^\S\n\r]*                                           # 0 or more whitespace characters
-    (?P<annotations>(?:\(.*?\)[^\S\n\r]*)*)              # annotations
+    \s*                                                  # 0 or more whitespace characters
+    (?P<annotations>(?:\(.*?\)\s*)*)                     # annotations
     (?P<delimiter>:?)                                    # delimiter
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<description>.*?)                                 # description
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     $                                                    # end
     ''',
     re.VERBOSE | re.IGNORECASE)
@@ -440,12 +440,12 @@ TAG_RE = re.compile(
 MULTILINE_ANNOTATION_CONTINUATION_RE = re.compile(
     r'''
     ^                                                    # start
-    [^\S\n\r]*                                           # 0 or more whitespace characters
-    (?P<annotations>(?:\(.*?\)[^\S\n\r]*)*)              # annotations
+    \s*                                                  # 0 or more whitespace characters
+    (?P<annotations>(?:\(.*?\)\s*)*)                     # annotations
     (?P<delimiter>:)                                     # delimiter
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     (?P<description>.*?)                                 # description
-    [^\S\n\r]*                                           # 0 or more whitespace characters
+    \s*                                                  # 0 or more whitespace characters
     $                                                    # end
     ''',
     re.VERBOSE)


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