I think this patch, or one of the others around this same time, broke adding comments after "}", as in the following:
vim9script class Foo static const bar = { # {{{ baz: 'qux' } # }}} endclass Results in: Error detected while processing C:\Users\hepti\comment.vim: line 6: E488: Trailing characters: # }}} On Sat, Apr 27, 2024 at 4:00 AM Christian Brabandt <cbli...@256bit.org> wrote: > patch 9.1.0376: Vim9: Trailing commands after class/enum keywords ignored > > Commit: > https://github.com/vim/vim/commit/ac7731895c996acef4d02b784f9952749226e203 > Author: Yegappan Lakshmanan <yegap...@yahoo.com> > Date: Sat Apr 27 11:36:12 2024 +0200 > > patch 9.1.0376: Vim9: Trailing commands after class/enum keywords > ignored > > Problem: Vim9: Trailing commands after class/enum keywords ignored > Solution: Remove EX_TRLBAR keyword from command definition > (Yegappan Lakshmanan) > > closes: #14649 > > Signed-off-by: Yegappan Lakshmanan <yegap...@yahoo.com> > Signed-off-by: Christian Brabandt <c...@256bit.org> > > diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt > index 13c4d729b..6a7515a76 100644 > --- a/runtime/doc/cmdline.txt > +++ b/runtime/doc/cmdline.txt > @@ -1,4 +1,4 @@ > -*cmdline.txt* For Vim version 9.1. Last change: 2023 Dec 09 > +*cmdline.txt* For Vim version 9.1. Last change: 2024 Apr 27 > > > VIM REFERENCE MANUAL by Bram Moolenaar > @@ -650,6 +650,12 @@ followed by another Vim command: > :[range]! > a user defined command without the "-bar" argument |:command| > > + and the following |Vim9-script| keywords: > + :abstract > + :class > + :enum > + :interface > + > Note that this is confusing (inherited from Vi): With ":g" the '|' is > included > in the command, with ":s" it is not. > > diff --git a/src/ex_cmds.h b/src/ex_cmds.h > index 70e57708f..40dec4ce4 100644 > --- a/src/ex_cmds.h > +++ b/src/ex_cmds.h > @@ -129,7 +129,7 @@ EXCMD(CMD_aboveleft, "aboveleft", > ex_wrongmodifier, > EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM, > ADDR_NONE), > EXCMD(CMD_abstract, "abstract", ex_class, > - EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, > + EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, > ADDR_NONE), > EXCMD(CMD_all, "all", ex_all, > EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR, > @@ -357,7 +357,7 @@ EXCMD(CMD_clast, "clast", ex_cc, > EX_RANGE|EX_COUNT|EX_TRLBAR|EX_BANG, > ADDR_UNSIGNED), > EXCMD(CMD_class, "class", ex_class, > - EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, > + EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, > ADDR_NONE), > EXCMD(CMD_close, "close", ex_close, > EX_BANG|EX_RANGE|EX_COUNT|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, > @@ -597,7 +597,7 @@ EXCMD(CMD_enew, "enew", ex_edit, > EX_BANG|EX_TRLBAR, > ADDR_NONE), > EXCMD(CMD_enum, "enum", ex_class, > - EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, > + EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, > ADDR_NONE), > EXCMD(CMD_eval, "eval", ex_eval, > EX_EXTRA|EX_NOTRLCOM|EX_EXPR_ARG|EX_SBOXOK|EX_CMDWIN|EX_LOCK_OK, > @@ -759,7 +759,7 @@ EXCMD(CMD_intro, "intro", ex_intro, > EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, > ADDR_NONE), > EXCMD(CMD_interface, "interface", ex_class, > - EX_EXTRA|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, > + EX_EXTRA|EX_CMDWIN|EX_LOCK_OK|EX_EXPORT, > ADDR_NONE), > EXCMD(CMD_isearch, "isearch", ex_findpat, > > EX_BANG|EX_RANGE|EX_DFLALL|EX_WHOLEFOLD|EX_EXTRA|EX_CMDWIN|EX_LOCK_OK, > diff --git a/src/testdir/test_vim9_class.vim > b/src/testdir/test_vim9_class.vim > index 5957f57ae..bd06c6e28 100644 > --- a/src/testdir/test_vim9_class.vim > +++ b/src/testdir/test_vim9_class.vim > @@ -67,6 +67,42 @@ def Test_class_basic() > END > v9.CheckSourceFailure(lines, "E488: Trailing characters: | echo > 'done'", 3) > > + # Additional command after "class name" > + lines =<< trim END > + vim9script > + class Something | var x = 10 > + endclass > + END > + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = 10", > 2) > + > + # Additional command after "object variable" > + lines =<< trim END > + vim9script > + class Something > + var l: list<number> = [] | var y = 10 > + endclass > + END > + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", > 3) > + > + # Additional command after "class variable" > + lines =<< trim END > + vim9script > + class Something > + static var d = {a: 10} | var y = 10 > + endclass > + END > + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", > 3) > + > + # Additional command after "object method" > + lines =<< trim END > + vim9script > + class Something > + def Foo() | var y = 10 > + enddef > + endclass > + END > + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var y = 10", > 3) > + > # Try to define a class with the same name as an existing variable > lines =<< trim END > vim9script > @@ -2237,6 +2273,14 @@ def Test_interface_basics() > END > v9.CheckSourceFailure(lines, 'E1345: Not a valid command in an > interface: return 5', 6) > > + # Additional commands after "interface name" > + lines =<< trim END > + vim9script > + interface Something | var x = 10 | var y = 20 > + endinterface > + END > + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = 10", > 2) > + > lines =<< trim END > vim9script > export interface EnterExit > @@ -3233,6 +3277,14 @@ def Test_abstract_class() > END > v9.CheckSourceFailure(lines, 'E1316: Class can only be defined in Vim9 > script', 1) > > + # Additional commands after "abstract class" > + lines =<< trim END > + vim9script > + abstract class Something | var x = [] > + endclass > + END > + v9.CheckSourceFailure(lines, "E488: Trailing characters: | var x = []", > 2) > + > # Abstract class cannot have a "new" function > lines =<< trim END > vim9script > diff --git a/src/testdir/test_vim9_enum.vim > b/src/testdir/test_vim9_enum.vim > index 274b556b7..bc54bee3a 100644 > --- a/src/testdir/test_vim9_enum.vim > +++ b/src/testdir/test_vim9_enum.vim > @@ -97,7 +97,16 @@ def Test_enum_parse() > vim9script > enum Something | endenum > END > - v9.CheckSourceFailure(lines, 'E1420: Missing :endenum', 3) > + v9.CheckSourceFailure(lines, 'E488: Trailing characters: | endenum', 2) > + > + # another command follows the enum name > + lines =<< trim END > + vim9script > + enum Something | var x = 10 > + Foo > + endenum > + END > + v9.CheckSourceFailure(lines, 'E488: Trailing characters: | var x = 10', > 2) > > # Try to define an enum with the same name as an existing variable > lines =<< trim END > diff --git a/src/testdir/test_vim9_typealias.vim > b/src/testdir/test_vim9_typealias.vim > index 998079cf6..cf540c230 100644 > --- a/src/testdir/test_vim9_typealias.vim > +++ b/src/testdir/test_vim9_typealias.vim > @@ -172,6 +172,14 @@ def Test_typealias() > END > v9.CheckSourceSuccess(lines) > > + # another command follows a type alias > + lines =<< trim END > + vim9script > + type MyType = number | var x = 20 > + assert_equal(20, x) > + END > + v9.CheckSourceSuccess(lines) > + > # Sourcing a script twice (which will free script local variables) > # Uses "lines" from the previous test > new > diff --git a/src/version.c b/src/version.c > index c000e5989..cac24ffb5 100644 > --- a/src/version.c > +++ b/src/version.c > @@ -704,6 +704,8 @@ static char *(features[]) = > > static int included_patches[] = > { /* Add new patch number below this line */ > +/**/ > + 376, > /**/ > 375, > /**/ > diff --git a/src/vim9class.c b/src/vim9class.c > index 52c2f764d..4314b5290 100644 > --- a/src/vim9class.c > +++ b/src/vim9class.c > @@ -136,6 +136,13 @@ parse_member( > fill_evalarg_from_eap(&evalarg, eap, FALSE); > (void)skip_expr_concatenate(&init_arg, &expr_start, &expr_end, > &evalarg); > > + init_arg = skipwhite(init_arg); > + if (*init_arg != NUL) > + { > + semsg(_(e_trailing_characters_str), init_arg); > + return FAIL; > + } > + > // No type specified for the member. Set it to "any" and the > correct > // type will be set when the object is instantiated. > if (type == NULL) > > -- > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to vim_dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/vim_dev/E1s0eqh-000H30-K4%40256bit.org. > -- Christian J. Robinson <hept...@gmail.com> -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAK14FZLNdFbvSZg6Ho9voQzZiTvT_Z%2BS84rJLhkZy%2BGKVnbpyQ%40mail.gmail.com.