comparison src/ex_eval.c @ 20113:2c23053c654a v8.2.0612

patch 8.2.0612: Vim9: no check for space before #comment Commit: https://github.com/vim/vim/commit/2c5ed4e3300378ce76c8d9c3818d6f73e5119f68 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 20 19:42:10 2020 +0200 patch 8.2.0612: Vim9: no check for space before #comment Problem: Vim9: no check for space before #comment. Solution: Add space checks.
author Bram Moolenaar <Bram@vim.org>
date Mon, 20 Apr 2020 19:45:03 +0200
parents 8fb1cf4c44d5
children c225be44692a
comparison
equal deleted inserted replaced
20112:b209e0dd46a4 20113:2c23053c654a
1019 } 1019 }
1020 1020
1021 if (eap->cmdidx == CMD_elseif) 1021 if (eap->cmdidx == CMD_elseif)
1022 { 1022 {
1023 result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); 1023 result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip);
1024
1024 // When throwing error exceptions, we want to throw always the first 1025 // When throwing error exceptions, we want to throw always the first
1025 // of several errors in a row. This is what actually happens when 1026 // of several errors in a row. This is what actually happens when
1026 // a conditional error was detected above and there is another failure 1027 // a conditional error was detected above and there is another failure
1027 // when parsing the expression. Since the skip flag is set in this 1028 // when parsing the expression. Since the skip flag is set in this
1028 // case, the parsing error will be ignored by emsg(). 1029 // case, the parsing error will be ignored by emsg().
1029
1030 if (!skip && !error) 1030 if (!skip && !error)
1031 { 1031 {
1032 if (result) 1032 if (result)
1033 cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE | CSF_TRUE; 1033 cstack->cs_flags[cstack->cs_idx] = CSF_ACTIVE | CSF_TRUE;
1034 else 1034 else
1516 else 1516 else
1517 rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR, 1517 rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
1518 &cstack->cs_looplevel); 1518 &cstack->cs_looplevel);
1519 } 1519 }
1520 1520
1521 if (ends_excmd(*eap->arg)) // no argument, catch all errors 1521 if (ends_excmd2(eap->cmd, eap->arg)) // no argument, catch all errors
1522 { 1522 {
1523 pat = (char_u *)".*"; 1523 pat = (char_u *)".*";
1524 end = NULL; 1524 end = NULL;
1525 eap->nextcmd = find_nextcmd(eap->arg); 1525 eap->nextcmd = find_nextcmd(eap->arg);
1526 } 1526 }
1527 else 1527 else
1528 { 1528 {
1529 pat = eap->arg + 1; 1529 pat = eap->arg + 1;
1530 end = skip_regexp(pat, *eap->arg, TRUE); 1530 end = skip_regexp_err(pat, *eap->arg, TRUE);
1531 if (end == NULL)
1532 give_up = TRUE;
1531 } 1533 }
1532 1534
1533 if (!give_up) 1535 if (!give_up)
1534 { 1536 {
1535 /* 1537 /*
1546 * exception is not checked (THROWN is not set then). 1548 * exception is not checked (THROWN is not set then).
1547 */ 1549 */
1548 if (!skip && (cstack->cs_flags[idx] & CSF_THROWN) 1550 if (!skip && (cstack->cs_flags[idx] & CSF_THROWN)
1549 && !(cstack->cs_flags[idx] & CSF_CAUGHT)) 1551 && !(cstack->cs_flags[idx] & CSF_CAUGHT))
1550 { 1552 {
1551 if (end != NULL && *end != NUL && !ends_excmd(*skipwhite(end + 1))) 1553 if (end != NULL && *end != NUL
1554 && !ends_excmd2(end, skipwhite(end + 1)))
1552 { 1555 {
1553 emsg(_(e_trailing)); 1556 emsg(_(e_trailing));
1554 return; 1557 return;
1555 } 1558 }
1556 1559