let Funky2: func = function('len')
let Party2: func = funcref('Test_syntax')
- " type becomes list<any>
+ # type becomes list<any>
let somelist = rand() > 0 ? [1, 2, 3] : ['a', 'b', 'c']
- " type becomes dict<any>
+ # type becomes dict<any>
let somedict = rand() > 0 ? #{a: 1, b: 2} : #{a: 'a', b: 'b'}
g:newvar = 'new'
call CheckDefFailure(['¬ex += 3'], 'E113:')
call CheckDefFailure(['&ts ..= "xxx"'], 'E1019:')
call CheckDefFailure(['&path += 3'], 'E1013:')
- " test freeing ISN_STOREOPT
+ # test freeing ISN_STOREOPT
call CheckDefFailure(['&ts = 3', 'let asdf'], 'E1022:')
&ts = 8
def Test_assignment_default()
- " Test default values.
+ # Test default values.
let thebool: bool
assert_equal(v:false, thebool)
*/
for (;;)
{
- int is_ex_command;
+ int is_ex_command = FALSE;
// Bail out on the first error to avoid a flood of errors and report
// the right line number when inside try/catch.
{
line = next_line_from_context(&cctx);
if (cctx.ctx_lnum >= ufunc->uf_lines.ga_len)
+ // beyond the last line
break;
}
emsg_before = called_emsg;
ea.cmdlinep = &line;
ea.cmd = skipwhite(line);
- // "}" ends a block scope
- if (*ea.cmd == '}')
+ // Some things can be recognized by the first character.
+ switch (*ea.cmd)
{
- scopetype_T stype = cctx.ctx_scope == NULL
- ? NO_SCOPE : cctx.ctx_scope->se_type;
+ case '#':
+ // "#" starts a comment, but not "#{".
+ if (ea.cmd[1] != '{')
+ {
+ line = (char_u *)"";
+ continue;
+ }
+ break;
- if (stype == BLOCK_SCOPE)
- {
- compile_endblock(&cctx);
- line = ea.cmd;
- }
- else
- {
- emsg(_("E1025: using } outside of a block scope"));
- goto erret;
- }
- if (line != NULL)
- line = skipwhite(ea.cmd + 1);
- continue;
- }
+ case '}':
+ {
+ // "}" ends a block scope
+ scopetype_T stype = cctx.ctx_scope == NULL
+ ? NO_SCOPE : cctx.ctx_scope->se_type;
- // "{" starts a block scope
- // "{'a': 1}->func() is something else
- if (*ea.cmd == '{' && ends_excmd(*skipwhite(ea.cmd + 1)))
- {
- line = compile_block(ea.cmd, &cctx);
- continue;
+ if (stype == BLOCK_SCOPE)
+ {
+ compile_endblock(&cctx);
+ line = ea.cmd;
+ }
+ else
+ {
+ emsg(_("E1025: using } outside of a block scope"));
+ goto erret;
+ }
+ if (line != NULL)
+ line = skipwhite(ea.cmd + 1);
+ continue;
+ }
+
+ case '{':
+ // "{" starts a block scope
+ // "{'a': 1}->func() is something else
+ if (ends_excmd(*skipwhite(ea.cmd + 1)))
+ {
+ line = compile_block(ea.cmd, &cctx);
+ continue;
+ }
+ break;
+
+ case ':':
+ is_ex_command = TRUE;
+ break;
}
- is_ex_command = *ea.cmd == ':';
/*
* COMMAND MODIFIERS