To: vim_dev@googlegroups.com Subject: Patch 8.2.1328 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1328 Problem: No space allowed before comma in list. Solution: Legacy Vim script allows it. (closes #6577) Files: src/dict.c, src/list.c, src/testdir/test_listdict.vim *** ../vim-8.2.1327/src/dict.c 2020-07-30 20:08:46.836890228 +0200 --- src/dict.c 2020-07-30 22:13:53.944513111 +0200 *************** *** 838,844 **** : eval1(arg, &tvkey, evalarg)) == FAIL) // recursive! goto failret; ! // The colon should come right after the key, but this wasn't checked // previously, so only require it in Vim9 script. if (!vim9script) *arg = skipwhite(*arg); --- 838,844 ---- : eval1(arg, &tvkey, evalarg)) == FAIL) // recursive! goto failret; ! // the colon should come right after the key, but this wasn't checked // previously, so only require it in Vim9 script. if (!vim9script) *arg = skipwhite(*arg); *************** *** 895,901 **** } clear_tv(&tvkey); ! // the comma must come after the value had_comma = **arg == ','; if (had_comma) { --- 895,904 ---- } clear_tv(&tvkey); ! // the comma should come right after the value, but this wasn't checked ! // previously, so only require it in Vim9 script. ! if (!vim9script) ! *arg = skipwhite(*arg); had_comma = **arg == ','; if (had_comma) { *** ../vim-8.2.1327/src/list.c 2020-07-30 20:08:46.836890228 +0200 --- src/list.c 2020-07-30 22:11:46.377180778 +0200 *************** *** 1194,1199 **** --- 1194,1202 ---- else clear_tv(&tv); } + // Legacy Vim script allowed a space before the comma. + if (!vim9script) + *arg = skipwhite(*arg); // the comma must come after the value had_comma = **arg == ','; *** ../vim-8.2.1327/src/testdir/test_listdict.vim 2020-07-27 21:43:24.137946109 +0200 --- src/testdir/test_listdict.vim 2020-07-30 22:12:58.100803091 +0200 *************** *** 23,28 **** --- 23,31 ---- call assert_equal(10, x) endfunc + " This was allowed in legacy Vim script + let s:list_with_spaces = [1 , 2 , 3] + " List slices func Test_list_slice() let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] *************** *** 202,207 **** --- 205,214 ---- call assert_fails("let d={'k' : i}", 'E121:') endfunc + " This was allowed in legacy Vim script + let s:dict_with_spaces = {'one' : 1 , 'two' : 2 , 'three' : 3} + let s:dict_with_spaces_lit = #{one : 1 , two : 2 , three : 3} + " Dictionary identity func Test_dict_identity() let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},} *** ../vim-8.2.1327/src/version.c 2020-07-30 20:18:04.407411723 +0200 --- src/version.c 2020-07-30 22:10:57.485442027 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1328, /**/ -- I AM THANKFUL... ...for a lawn that needs mowing, windows that need cleaning and gutters that need fixing because it means I have a home. /// 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 ///