To: vim_dev@googlegroups.com Subject: Patch 8.2.1243 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1243 Problem: Vim9: cannot have a comment or empty line halfway a list at script level. Solution: Skip more than one line if needed. Files: src/vim9compile.c, src/proto/vim9compile.pro, src/eval.c, src/scriptfile.c *** ../vim-8.2.1242/src/vim9compile.c 2020-07-19 14:03:05.063941901 +0200 --- src/vim9compile.c 2020-07-19 14:20:57.765016821 +0200 *************** *** 2463,2469 **** /* * Return TRUE if "p" points at a "#" but not at "#{". */ ! static int vim9_comment_start(char_u *p) { return p[0] == '#' && p[1] != '{'; --- 2463,2469 ---- /* * Return TRUE if "p" points at a "#" but not at "#{". */ ! int vim9_comment_start(char_u *p) { return p[0] == '#' && p[1] != '{'; *** ../vim-8.2.1242/src/proto/vim9compile.pro 2020-07-19 14:03:05.063941901 +0200 --- src/proto/vim9compile.pro 2020-07-19 14:21:02.413004139 +0200 *************** *** 11,16 **** --- 11,17 ---- char *type_name(type_T *type, char **tofree); int get_script_item_idx(int sid, char_u *name, int check_writable); imported_T *find_imported(char_u *name, size_t len, cctx_T *cctx); + int vim9_comment_start(char_u *p); char_u *peek_next_line_from_context(cctx_T *cctx); char_u *next_line_from_context(cctx_T *cctx, int skip_comment); char_u *to_name_const_end(char_u *arg); *** ../vim-8.2.1242/src/eval.c 2020-07-13 22:28:41.286857378 +0200 --- src/eval.c 2020-07-19 14:20:53.277029062 +0200 *************** *** 1913,1919 **** && evalarg != NULL && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL) && (*arg == NUL || (VIM_ISWHITE(arg[-1]) ! && *arg == '#' && arg[1] != '{'))) { char_u *p; --- 1913,1919 ---- && evalarg != NULL && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL) && (*arg == NUL || (VIM_ISWHITE(arg[-1]) ! && vim9_comment_start(arg)))) { char_u *p; *** ../vim-8.2.1242/src/scriptfile.c 2020-07-12 17:07:01.024810908 +0200 --- src/scriptfile.c 2020-07-19 14:37:10.602386703 +0200 *************** *** 1763,1772 **** // backslash. We always need to read the next line, keep it in // sp->nextline. /* Also check for a comment in between continuation lines: "\ */ sp->nextline = get_one_sourceline(sp); if (sp->nextline != NULL && (*(p = skipwhite(sp->nextline)) == '\\' ! || (p[0] == '"' && p[1] == '\\' && p[2] == ' '))) { garray_T ga; --- 1763,1775 ---- // backslash. We always need to read the next line, keep it in // sp->nextline. /* Also check for a comment in between continuation lines: "\ */ + // Also check for a Vim9 comment and empty line. sp->nextline = get_one_sourceline(sp); if (sp->nextline != NULL && (*(p = skipwhite(sp->nextline)) == '\\' ! || (p[0] == '"' && p[1] == '\\' && p[2] == ' ') ! || (in_vim9script() ! && (*p == NUL || vim9_comment_start(p))))) { garray_T ga; *************** *** 1794,1801 **** } ga_concat(&ga, p + 1); } ! else if (p[0] != '"' || p[1] != '\\' || p[2] != ' ') break; } ga_append(&ga, NUL); vim_free(line); --- 1797,1807 ---- } ga_concat(&ga, p + 1); } ! else if (!(p[0] == '"' && p[1] == '\\' && p[2] == ' ') ! && !(in_vim9script() ! && (*p == NUL || vim9_comment_start(p)))) break; + /* drop a # comment or "\ comment line */ } ga_append(&ga, NUL); vim_free(line); *** ../vim-8.2.1242/src/version.c 2020-07-19 14:03:05.067941890 +0200 --- src/version.c 2020-07-19 14:41:41.757657607 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1243, /**/ -- Just remember...if the world didn't suck, we'd all fall off. /// 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 ///