To: vim_dev@googlegroups.com Subject: Patch 8.0.0092 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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) Files: src/misc1.c, src/testdir/test3.in, src/testdir/test3.ok *** ../vim-8.0.0091/src/misc1.c 2016-10-12 14:19:55.746357751 +0200 --- src/misc1.c 2016-11-17 21:21:03.040128865 +0100 *************** *** 5762,5767 **** --- 5762,5768 ---- { 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,5789 **** --- 5781,5798 ---- } 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; *** ../vim-8.0.0091/src/testdir/test3.in 2015-11-10 13:56:14.000000000 +0100 --- src/testdir/test3.in 2016-11-17 21:16:53.861790464 +0100 *************** *** 1932,1937 **** --- 1932,1957 ---- { 111111111111111111; } + namespace test::cpp17 + { + 111111111111111111; + } + namespace ::incorrectcpp17 + { + 111111111111111111; + } + namespace test::incorrectcpp17:: + { + 111111111111111111; + } + namespace test:incorrectcpp17 + { + 111111111111111111; + } + namespace test:::incorrectcpp17 + { + 111111111111111111; + } namespace{ 111111111111111111; } *** ../vim-8.0.0091/src/testdir/test3.ok 2015-11-10 13:56:40.000000000 +0100 --- src/testdir/test3.ok 2016-11-17 21:16:53.861790464 +0100 *************** *** 1730,1735 **** --- 1730,1755 ---- { 111111111111111111; } + namespace test::cpp17 + { + 111111111111111111; + } + namespace ::incorrectcpp17 + { + 111111111111111111; + } + namespace test::incorrectcpp17:: + { + 111111111111111111; + } + namespace test:incorrectcpp17 + { + 111111111111111111; + } + namespace test:::incorrectcpp17 + { + 111111111111111111; + } namespace{ 111111111111111111; } *** ../vim-8.0.0091/src/version.c 2016-11-17 19:44:56.627678988 +0100 --- src/version.c 2016-11-17 21:18:59.916949760 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 92, /**/ -- Due knot trussed yore spell chequer two fined awl miss steaks. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///