diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-11-17 21:30:27 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-11-17 21:30:27 +0100 |
commit | ca8b8d6956dd881de6446fc32c38e817a364a6cc (patch) | |
tree | cb255499ccba4e5bfb57549a049491cf4d36007a /src/misc1.c | |
parent | 9f0e423c2818c0cacd0810f9c3c67cbb6b80963d (diff) | |
download | vim-ca8b8d6956dd881de6446fc32c38e817a364a6cc.zip |
patch 8.0.0092
Problem: C indenting does not support nested namespaces that C++ 17 has.
Solution: Add check that passes double colon inside a name. (Pauli, closes
#1214)
Diffstat (limited to 'src/misc1.c')
-rw-r--r-- | src/misc1.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/misc1.c b/src/misc1.c index 6bf7d7577..3630d7b3b 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -5762,6 +5762,7 @@ cin_is_cpp_namespace(char_u *s) { char_u *p; int has_name = FALSE; + int has_name_start = FALSE; s = cin_skipcomment(s); if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) @@ -5780,10 +5781,18 @@ cin_is_cpp_namespace(char_u *s) } else if (vim_iswordc(*p)) { + has_name_start = TRUE; if (has_name) return FALSE; /* word character after skipping past name */ ++p; } + else if (p[0] == ':' && p[1] == ':' && vim_iswordc(p[2])) + { + if (!has_name_start || has_name) + return FALSE; + /* C++ 17 nested namespace */ + p += 3; + } else { return FALSE; |