Mercurial > vim
comparison src/vim9compile.c @ 21156:eb6c27af07dd v8.2.1129
patch 8.2.1129: Vim9: bar not recognized after not compiled command
Commit: https://github.com/vim/vim/commit/e9f262bdff2defa248e5d40b6520251799581ea4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 5 14:57:51 2020 +0200
patch 8.2.1129: Vim9: bar not recognized after not compiled command
Problem: Vim9: bar not recognized after not compiled command.
Solution: Check for bar for commands where this is possible. (closes https://github.com/vim/vim/issues/6391)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 05 Jul 2020 15:00:04 +0200 |
parents | 465d6e40e79c |
children | 157fe2d26e16 |
comparison
equal
deleted
inserted
replaced
21155:aae581cf2a1a | 21156:eb6c27af07dd |
---|---|
6560 static char_u * | 6560 static char_u * |
6561 compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx) | 6561 compile_exec(char_u *line, exarg_T *eap, cctx_T *cctx) |
6562 { | 6562 { |
6563 char_u *p; | 6563 char_u *p; |
6564 int has_expr = FALSE; | 6564 int has_expr = FALSE; |
6565 char_u *nextcmd = (char_u *)""; | |
6565 | 6566 |
6566 if (cctx->ctx_skip == SKIP_YES) | 6567 if (cctx->ctx_skip == SKIP_YES) |
6567 goto theend; | 6568 goto theend; |
6568 | 6569 |
6569 if (eap->cmdidx >= 0 && eap->cmdidx < CMD_SIZE) | 6570 if (eap->cmdidx >= 0 && eap->cmdidx < CMD_SIZE) |
6570 has_expr = (excmd_get_argt(eap->cmdidx) & (EX_XFILE | EX_EXPAND)); | 6571 { |
6572 long argt = excmd_get_argt(eap->cmdidx); | |
6573 int usefilter = FALSE; | |
6574 | |
6575 has_expr = argt & (EX_XFILE | EX_EXPAND); | |
6576 | |
6577 // If the command can be followed by a bar, find the bar and truncate | |
6578 // it, so that the following command can be compiled. | |
6579 // The '|' is overwritten with a NUL, it is put back below. | |
6580 if ((eap->cmdidx == CMD_write || eap->cmdidx == CMD_read) | |
6581 && *eap->arg == '!') | |
6582 // :w !filter or :r !filter or :r! filter | |
6583 usefilter = TRUE; | |
6584 if ((argt & EX_TRLBAR) && !usefilter) | |
6585 { | |
6586 separate_nextcmd(eap); | |
6587 if (eap->nextcmd != NULL) | |
6588 nextcmd = eap->nextcmd; | |
6589 } | |
6590 } | |
6591 | |
6571 if (eap->cmdidx == CMD_syntax && STRNCMP(eap->arg, "include ", 8) == 0) | 6592 if (eap->cmdidx == CMD_syntax && STRNCMP(eap->arg, "include ", 8) == 0) |
6572 { | 6593 { |
6573 // expand filename in "syntax include [@group] filename" | 6594 // expand filename in "syntax include [@group] filename" |
6574 has_expr = TRUE; | 6595 has_expr = TRUE; |
6575 eap->arg = skipwhite(eap->arg + 7); | 6596 eap->arg = skipwhite(eap->arg + 7); |
6624 } | 6645 } |
6625 else | 6646 else |
6626 generate_EXEC(cctx, line); | 6647 generate_EXEC(cctx, line); |
6627 | 6648 |
6628 theend: | 6649 theend: |
6629 return (char_u *)""; | 6650 if (*nextcmd != NUL) |
6651 { | |
6652 // the parser expects a pointer to the bar, put it back | |
6653 --nextcmd; | |
6654 *nextcmd = '|'; | |
6655 } | |
6656 | |
6657 return nextcmd; | |
6630 } | 6658 } |
6631 | 6659 |
6632 /* | 6660 /* |
6633 * Add a function to the list of :def functions. | 6661 * Add a function to the list of :def functions. |
6634 * This sets "ufunc->uf_dfunc_idx" but the function isn't compiled yet. | 6662 * This sets "ufunc->uf_dfunc_idx" but the function isn't compiled yet. |