comparison src/vim9compile.c @ 20059:de756b3f4dee v8.2.0585

patch 8.2.0585: Vim9: # comment not recognized after :vim9script Commit: https://github.com/vim/vim/commit/7a09224583b2ad0d9d0648b53cc2d989d45ae96e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 16 22:10:49 2020 +0200 patch 8.2.0585: Vim9: # comment not recognized after :vim9script Problem: Vim9: # comment not recognized after :vim9script. Solution: Check script type. Make comment after ":echo" work. And in several other places.
author Bram Moolenaar <Bram@vim.org>
date Thu, 16 Apr 2020 22:15:04 +0200
parents 686deb5959c2
children 336483164ca6
comparison
equal deleted inserted replaced
20058:bc03e6cae236 20059:de756b3f4dee
106 * Stores info about the local variables and condition stack. 106 * Stores info about the local variables and condition stack.
107 */ 107 */
108 struct cctx_S { 108 struct cctx_S {
109 ufunc_T *ctx_ufunc; // current function 109 ufunc_T *ctx_ufunc; // current function
110 int ctx_lnum; // line number in current function 110 int ctx_lnum; // line number in current function
111 char_u *ctx_line_start; // start of current line or NULL
111 garray_T ctx_instr; // generated instructions 112 garray_T ctx_instr; // generated instructions
112 113
113 garray_T ctx_locals; // currently visible local variables 114 garray_T ctx_locals; // currently visible local variables
114 int ctx_max_local; // maximum number of locals at one time 115 int ctx_max_local; // maximum number of locals at one time
115 116
2053 * Returns NULL when at the end. 2054 * Returns NULL when at the end.
2054 */ 2055 */
2055 static char_u * 2056 static char_u *
2056 next_line_from_context(cctx_T *cctx) 2057 next_line_from_context(cctx_T *cctx)
2057 { 2058 {
2058 char_u *line = NULL; 2059 char_u *line;
2059 2060
2060 do 2061 do
2061 { 2062 {
2062 ++cctx->ctx_lnum; 2063 ++cctx->ctx_lnum;
2063 if (cctx->ctx_lnum >= cctx->ctx_ufunc->uf_lines.ga_len) 2064 if (cctx->ctx_lnum >= cctx->ctx_ufunc->uf_lines.ga_len)
2065 {
2066 line = NULL;
2064 break; 2067 break;
2068 }
2065 line = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum]; 2069 line = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum];
2070 cctx->ctx_line_start = line;
2066 SOURCING_LNUM = cctx->ctx_ufunc->uf_script_ctx.sc_lnum 2071 SOURCING_LNUM = cctx->ctx_ufunc->uf_script_ctx.sc_lnum
2067 + cctx->ctx_lnum + 1; 2072 + cctx->ctx_lnum + 1;
2068 } while (line == NULL || *skipwhite(line) == NUL); 2073 } while (line == NULL || *skipwhite(line) == NUL);
2069 return line; 2074 return line;
2070 } 2075 }
5446 isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_catch_label; 5451 isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_catch_label;
5447 isn->isn_arg.jump.jump_where = instr->ga_len; 5452 isn->isn_arg.jump.jump_where = instr->ga_len;
5448 } 5453 }
5449 5454
5450 p = skipwhite(arg); 5455 p = skipwhite(arg);
5451 if (ends_excmd(*p)) 5456 if (ends_excmd2(arg, p))
5452 { 5457 {
5453 scope->se_u.se_try.ts_caught_all = TRUE; 5458 scope->se_u.se_try.ts_caught_all = TRUE;
5454 scope->se_u.se_try.ts_catch_label = 0; 5459 scope->se_u.se_try.ts_catch_label = 0;
5455 } 5460 }
5456 else 5461 else
5780 goto erret; 5785 goto erret;
5781 5786
5782 if (line != NULL && *line == '|') 5787 if (line != NULL && *line == '|')
5783 // the line continues after a '|' 5788 // the line continues after a '|'
5784 ++line; 5789 ++line;
5785 else if (line != NULL && *line != NUL) 5790 else if (line != NULL && *line != NUL
5791 && !(*line == '#' && (line == cctx.ctx_line_start
5792 || VIM_ISWHITE(line[-1]))))
5786 { 5793 {
5787 semsg(_("E488: Trailing characters: %s"), line); 5794 semsg(_("E488: Trailing characters: %s"), line);
5788 goto erret; 5795 goto erret;
5789 } 5796 }
5790 else 5797 else