global seems not to support c++ namespace syntax like this :

namespace name1::name2::name3 { /*...*/ }

here is a patch that allow global to parse this :

----------------------------------------------------------------------------------------------------------------
diff -ur global-6.6.9/libparser/Cpp.c global-6.6.9-patched/libparser/Cpp.c
--- global-6.6.9/libparser/Cpp.c        2022-12-11 23:38:21.000000000 +0800
+++ global-6.6.9-patched/libparser/Cpp.c        2023-04-14
14:06:49.421958357 +0800
@@ -169,13 +169,20 @@
                        /*
                         * namespace name = ...;
                         * namespace [name] { ... }
+                        * namespace name[::name]* { ... }
                         */
+               cpp_namespace_loop:
                        if ((c = nexttoken(interested, cpp_reserved_word))
== SYMBOL) {
+                       cpp_namespace_token_loop:
                                PUT(PARSER_DEF, token, lineno, sp);
                                if ((c = nexttoken(interested,
cpp_reserved_word)) == '=') {
                                        crflag = 1;
                                        break;
                                }
+                               if (c == CPP_WCOLON)
+                                       goto cpp_namespace_loop;
+                               if (c == SYMBOL)
+                                       goto cpp_namespace_token_loop;
                        }
                        /*
                         * Namespace block doesn't have any influence on
level.
----------------------------------------------------------------------------------------------------------------

Reply via email to