bug-global
[Top][All Lists]
Advanced

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

patch proposal to support multiple c++ namespace opening with a single b


From: Sam
Subject: patch proposal to support multiple c++ namespace opening with a single brace
Date: Fri, 14 Apr 2023 14:25:01 +0800

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

[Prev in Thread] Current Thread [Next in Thread]