mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
vim-patch:8.2.4702: C++ scope labels are hard-coded
Problem: C++ scope labels are hard-coded.
Solution: Add 'cinscopedecls' to define the labels. (Tom Praschan,
closes vim/vim#10109)
3506cf34c1
This commit is contained in:
@@ -512,24 +512,27 @@ static int cin_isdefault(const char_u *s)
|
||||
&& s[1] != ':';
|
||||
}
|
||||
|
||||
/*
|
||||
* Recognize a "public/private/protected" scope declaration label.
|
||||
*/
|
||||
bool cin_isscopedecl(const char_u *s)
|
||||
/// Recognize a scope declaration label set in 'cinscopedecls'.
|
||||
bool cin_isscopedecl(const char_u *p)
|
||||
{
|
||||
int i;
|
||||
const char_u *s = cin_skipcomment(p);
|
||||
|
||||
s = cin_skipcomment(s);
|
||||
if (STRNCMP(s, "public", 6) == 0) {
|
||||
i = 6;
|
||||
} else if (STRNCMP(s, "protected", 9) == 0) {
|
||||
i = 9;
|
||||
} else if (STRNCMP(s, "private", 7) == 0) {
|
||||
i = 7;
|
||||
} else {
|
||||
return false;
|
||||
const size_t cinsd_len = STRLEN(curbuf->b_p_cinsd) + 1;
|
||||
char_u *cinsd_buf = xmalloc(cinsd_len);
|
||||
|
||||
for (char_u *cinsd = curbuf->b_p_cinsd; *cinsd; ) {
|
||||
const size_t len = copy_option_part(&cinsd, cinsd_buf, cinsd_len, ",");
|
||||
if (STRNCMP(s, cinsd_buf, len) == 0) {
|
||||
const char_u *skip = cin_skipcomment(s + len);
|
||||
if (*skip == ':' && skip[1] != ':') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return *(s = cin_skipcomment(s + i)) == ':' && s[1] != ':';
|
||||
|
||||
xfree(cinsd_buf);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Maximum number of lines to search back for a "namespace" line.
|
||||
|
Reference in New Issue
Block a user