mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.1.0989: Vim9: Whitespace after the final enum value causes a syntax error
Problem: Vim9: Whitespace after the final enum value causes a syntax error Solution: Fix parsing to allow whitespace after the final enum value. (Doug Kearns) closes: #16383 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
cd96075cde
commit
dbe39edb29
@ -85,6 +85,7 @@ def Test_test_files()
|
|||||||
&& fname !~ 'test_let.vim'
|
&& fname !~ 'test_let.vim'
|
||||||
&& fname !~ 'test_tagjump.vim'
|
&& fname !~ 'test_tagjump.vim'
|
||||||
&& fname !~ 'test_vim9_cmd.vim'
|
&& fname !~ 'test_vim9_cmd.vim'
|
||||||
|
&& fname !~ 'test_vim9_enum.vim'
|
||||||
cursor(1, 1)
|
cursor(1, 1)
|
||||||
var lnum = search(
|
var lnum = search(
|
||||||
fname =~ 'test_vim9_assign.vim' ? '[^=]\s$'
|
fname =~ 'test_vim9_assign.vim' ? '[^=]\s$'
|
||||||
|
@ -908,6 +908,18 @@ def Test_enum_comments()
|
|||||||
END
|
END
|
||||||
v9.CheckSourceSuccess(lines)
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
enum Car # cars
|
||||||
|
# before enum
|
||||||
|
Honda(), # honda
|
||||||
|
# before enum
|
||||||
|
Ford() # ford
|
||||||
|
endenum
|
||||||
|
assert_equal(1, Car.Ford.ordinal)
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
# Test for using an unsupported comment
|
# Test for using an unsupported comment
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
@ -921,6 +933,29 @@ def Test_enum_comments()
|
|||||||
v9.CheckSourceFailure(lines, 'E1170: Cannot use #{ to start a comment', 4)
|
v9.CheckSourceFailure(lines, 'E1170: Cannot use #{ to start a comment', 4)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
|
" Test trailing whitespace after enum values
|
||||||
|
def Test_enum_whitespace()
|
||||||
|
var lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
enum Car
|
||||||
|
Honda,
|
||||||
|
Ford
|
||||||
|
endenum
|
||||||
|
defcompile
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
enum Car
|
||||||
|
Honda(),
|
||||||
|
Ford()
|
||||||
|
endenum
|
||||||
|
defcompile
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
enddef
|
||||||
|
|
||||||
" Test string() with enums
|
" Test string() with enums
|
||||||
def Test_enum_string()
|
def Test_enum_string()
|
||||||
var lines =<< trim END
|
var lines =<< trim END
|
||||||
|
@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
989,
|
||||||
/**/
|
/**/
|
||||||
988,
|
988,
|
||||||
/**/
|
/**/
|
||||||
|
@ -1623,6 +1623,8 @@ enum_parse_values(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p = skipwhite(p);
|
||||||
|
|
||||||
if (*p != NUL && *p != '#')
|
if (*p != NUL && *p != '#')
|
||||||
{
|
{
|
||||||
if (did_emsg == did_emsg_before)
|
if (did_emsg == did_emsg_before)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user