comparison src/scriptfile.c @ 21385:54a304e4dc57 v8.2.1243

patch 8.2.1243: Vim9: cannot have a comment line halfway a list Commit: https://github.com/vim/vim/commit/75783bd84e42e8431e4a62dfbabc9be1a1e56901 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 19 14:41:58 2020 +0200 patch 8.2.1243: Vim9: cannot have a comment line halfway a list Problem: Vim9: cannot have a comment or empty line halfway a list at script level. Solution: Skip more than one line if needed.
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jul 2020 14:45:03 +0200
parents 8d1d11afd8c8
children 6f5129b51c49
comparison
equal deleted inserted replaced
21384:0c7e050ddcf4 21385:54a304e4dc57
1761 1761
1762 // Get the next line and concatenate it when it starts with a 1762 // Get the next line and concatenate it when it starts with a
1763 // backslash. We always need to read the next line, keep it in 1763 // backslash. We always need to read the next line, keep it in
1764 // sp->nextline. 1764 // sp->nextline.
1765 /* Also check for a comment in between continuation lines: "\ */ 1765 /* Also check for a comment in between continuation lines: "\ */
1766 // Also check for a Vim9 comment and empty line.
1766 sp->nextline = get_one_sourceline(sp); 1767 sp->nextline = get_one_sourceline(sp);
1767 if (sp->nextline != NULL 1768 if (sp->nextline != NULL
1768 && (*(p = skipwhite(sp->nextline)) == '\\' 1769 && (*(p = skipwhite(sp->nextline)) == '\\'
1769 || (p[0] == '"' && p[1] == '\\' && p[2] == ' '))) 1770 || (p[0] == '"' && p[1] == '\\' && p[2] == ' ')
1771 || (in_vim9script()
1772 && (*p == NUL || vim9_comment_start(p)))))
1770 { 1773 {
1771 garray_T ga; 1774 garray_T ga;
1772 1775
1773 ga_init2(&ga, (int)sizeof(char_u), 400); 1776 ga_init2(&ga, (int)sizeof(char_u), 400);
1774 ga_concat(&ga, line); 1777 ga_concat(&ga, line);
1792 else 1795 else
1793 ga.ga_growsize = ga.ga_len; 1796 ga.ga_growsize = ga.ga_len;
1794 } 1797 }
1795 ga_concat(&ga, p + 1); 1798 ga_concat(&ga, p + 1);
1796 } 1799 }
1797 else if (p[0] != '"' || p[1] != '\\' || p[2] != ' ') 1800 else if (!(p[0] == '"' && p[1] == '\\' && p[2] == ' ')
1801 && !(in_vim9script()
1802 && (*p == NUL || vim9_comment_start(p))))
1798 break; 1803 break;
1804 /* drop a # comment or "\ comment line */
1799 } 1805 }
1800 ga_append(&ga, NUL); 1806 ga_append(&ga, NUL);
1801 vim_free(line); 1807 vim_free(line);
1802 line = ga.ga_data; 1808 line = ga.ga_data;
1803 } 1809 }