Mercurial > vim
comparison src/scriptfile.c @ 24786:524120691c3d v8.2.2931
patch 8.2.2931: Vim9: line continuation comment uses legacy syntax
Commit: https://github.com/vim/vim/commit/5072b47a223fb044041b8e7db59a17b3b1d8a625
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 3 21:56:10 2021 +0200
patch 8.2.2931: Vim9: line continuation comment uses legacy syntax
Problem: Vim9: line continuation comment still uses legacy syntax in one
place.
Solution: Check for #\ instead of "\ earlier. (closes #8316)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 03 Jun 2021 22:00:04 +0200 |
parents | 8bf9726097d8 |
children | 14b0b35d8488 |
comparison
equal
deleted
inserted
replaced
24785:cbbb6681c0ba | 24786:524120691c3d |
---|---|
1786 // Only concatenate lines starting with a \ when 'cpoptions' doesn't | 1786 // Only concatenate lines starting with a \ when 'cpoptions' doesn't |
1787 // contain the 'C' flag. | 1787 // contain the 'C' flag. |
1788 if (line != NULL && options != GETLINE_NONE | 1788 if (line != NULL && options != GETLINE_NONE |
1789 && vim_strchr(p_cpo, CPO_CONCAT) == NULL) | 1789 && vim_strchr(p_cpo, CPO_CONCAT) == NULL) |
1790 { | 1790 { |
1791 int comment_char = in_vim9script() ? '#' : '"'; | |
1792 | |
1791 // compensate for the one line read-ahead | 1793 // compensate for the one line read-ahead |
1792 --sp->sourcing_lnum; | 1794 --sp->sourcing_lnum; |
1793 | 1795 |
1794 // Get the next line and concatenate it when it starts with a | 1796 // Get the next line and concatenate it when it starts with a |
1795 // backslash. We always need to read the next line, keep it in | 1797 // backslash. We always need to read the next line, keep it in |
1798 // Also check for a Vim9 comment, empty line, line starting with '|', | 1800 // Also check for a Vim9 comment, empty line, line starting with '|', |
1799 // but not "||". | 1801 // but not "||". |
1800 sp->nextline = get_one_sourceline(sp); | 1802 sp->nextline = get_one_sourceline(sp); |
1801 if (sp->nextline != NULL | 1803 if (sp->nextline != NULL |
1802 && (*(p = skipwhite(sp->nextline)) == '\\' | 1804 && (*(p = skipwhite(sp->nextline)) == '\\' |
1803 || (p[0] == '"' && p[1] == '\\' && p[2] == ' ') | 1805 || (p[0] == comment_char |
1806 && p[1] == '\\' && p[2] == ' ') | |
1804 || (do_vim9_all && (*p == NUL | 1807 || (do_vim9_all && (*p == NUL |
1805 || vim9_comment_start(p))) | 1808 || vim9_comment_start(p))) |
1806 || (do_bar_cont && p[0] == '|' && p[1] != '|'))) | 1809 || (do_bar_cont && p[0] == '|' && p[1] != '|'))) |
1807 { | 1810 { |
1808 garray_T ga; | 1811 garray_T ga; |
1840 { | 1843 { |
1841 ga_concat(&ga, (char_u *)" "); | 1844 ga_concat(&ga, (char_u *)" "); |
1842 ga_concat(&ga, p); | 1845 ga_concat(&ga, p); |
1843 } | 1846 } |
1844 } | 1847 } |
1845 else if (!(p[0] == (in_vim9script() ? '#' : '"') | 1848 else if (!(p[0] == (comment_char) |
1846 && p[1] == '\\' && p[2] == ' ') | 1849 && p[1] == '\\' && p[2] == ' ') |
1847 && !(do_vim9_all && (*p == NUL || vim9_comment_start(p)))) | 1850 && !(do_vim9_all && (*p == NUL || vim9_comment_start(p)))) |
1848 break; | 1851 break; |
1849 /* drop a # comment or "\ comment line */ | 1852 /* drop a # comment or "\ comment line */ |
1850 } | 1853 } |