[devhelp] parser: handle stripping of non-breaking space before parentheses



commit b5c1595b450a4caec167c1b82c7c4a874405d7b6
Author: Frédéric Péters <fpeters 0d be>
Date:   Wed Jan 27 12:41:17 2016 +0100

    parser: handle stripping of non-breaking space before parentheses
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759692

 src/dh-parser.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/dh-parser.c b/src/dh-parser.c
index 5d2e6b4..60f24cb 100644
--- a/src/dh-parser.c
+++ b/src/dh-parser.c
@@ -334,8 +334,17 @@ parser_start_node_keyword (DhParser             *parser,
                 link_type = DH_LINK_TYPE_KEYWORD;
         }
 
-        /* Strip out trailing " () or "()". */
-        if (g_str_has_suffix (name, " ()")) {
+        /* Strip out trailing "() (handling variants with space or non-breaking
+         * space before the parentheses) */
+        if (g_str_has_suffix (name, "\xc2\xa0()")) {
+                tmp = g_strndup (name, strlen (name) - 4);
+
+                if (link_type == DH_LINK_TYPE_KEYWORD) {
+                        link_type = DH_LINK_TYPE_FUNCTION;
+                }
+                name = tmp;
+        }
+        else if (g_str_has_suffix (name, " ()")) {
                 tmp = g_strndup (name, strlen (name) - 3);
 
                 if (link_type == DH_LINK_TYPE_KEYWORD) {


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