static int
comment_start(char_u *p, int starts_with_colon UNUSED)
{
-#ifdef FEAT_EVAL
if (in_vim9script())
return p[0] == '#' && !starts_with_colon;
-#endif
return *p == '"';
}
int ni; // set when Not Implemented
char_u *cmd;
int starts_with_colon = FALSE;
-#ifdef FEAT_EVAL
int may_have_range;
int vim9script;
+#ifdef FEAT_EVAL
int did_set_expr_line = FALSE;
#endif
int sourcing = flags & DOCMD_VERBOSE;
if (parse_command_modifiers(&ea, &errormsg, &cmdmod, FALSE) == FAIL)
goto doend;
apply_cmdmod(&cmdmod);
-#ifdef FEAT_EVAL
- vim9script = in_vim9script();
-#endif
after_modifier = ea.cmd;
#ifdef FEAT_EVAL
* We need the command to know what kind of range it uses.
*/
cmd = ea.cmd;
-#ifdef FEAT_EVAL
+
// In Vim9 script a colon is required before the range. This may also be
// after command modifiers.
+ vim9script = in_vim9script();
if (vim9script && (flags & DOCMD_RANGEOK) == 0)
{
may_have_range = FALSE;
else
may_have_range = TRUE;
if (may_have_range)
-#endif
ea.cmd = skip_range(ea.cmd, TRUE, NULL);
-#ifdef FEAT_EVAL
if (vim9script && !may_have_range)
{
if (ea.cmd == cmd + 1 && *cmd == '$')
// should be "$VAR = val"
--ea.cmd;
+#ifdef FEAT_EVAL
p = find_ex_command(&ea, NULL, lookup_scriptitem, NULL);
+#else
+ p = find_ex_command(&ea, NULL, NULL, NULL);
+#endif
if (ea.cmdidx == CMD_SIZE)
{
char_u *ar = skip_range(ea.cmd, TRUE, NULL);
}
}
else
-#endif
p = find_ex_command(&ea, NULL, NULL, NULL);
#ifdef FEAT_EVAL
}
ea.cmd = cmd;
-#ifdef FEAT_EVAL
if (!may_have_range)
ea.line1 = ea.line2 = default_address(&ea);
- else
-#endif
- if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL)
- goto doend;
+ else if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL)
+ goto doend;
/*
* 5. Parse the command.
}
#endif
- // Check for '"': start of comment or '|': next command
+ // Check for '"'/'#': start of comment or '|': next command
// :@" and :*" do not start a comment!
// :redir @" doesn't either.
else if ((*p == '"'
-#ifdef FEAT_EVAL
&& !in_vim9script()
-#endif
&& !(eap->argt & EX_NOTRLCOM)
&& ((eap->cmdidx != CMD_at && eap->cmdidx != CMD_star)
|| p != eap->arg)
&& (eap->cmdidx != CMD_redir
|| p != eap->arg + 1 || p[-1] != '@'))
-#ifdef FEAT_EVAL
|| (*p == '#'
&& in_vim9script()
&& !(eap->argt & EX_NOTRLCOM)
&& p > eap->cmd && VIM_ISWHITE(p[-1]))
-#endif
|| *p == '|' || *p == '\n')
{
/*
{
int comment_char = '"';
-#ifdef FEAT_EVAL
if (in_vim9script())
comment_char = '#';
-#endif
return (c == NUL || c == '|' || c == comment_char || c == '\n');
}
if (c == NUL || c == '|' || c == '\n')
return TRUE;
-#ifdef FEAT_EVAL
if (in_vim9script())
// # starts a comment, #{ might be a mistake, #{{ can start a fold
return c == '#' && (cmd[1] != '{' || cmd[2] == '{')
&& (cmd == cmd_start || VIM_ISWHITE(cmd[-1]));
-#endif
return c == '"';
}