Mercurial > vim
comparison src/vim9compile.c @ 19528:3b026343f398 v8.2.0321
patch 8.2.0321: Vim9: ":execute" does not work yet
Commit: https://github.com/vim/vim/commit/ad39c094d261109a695aba2c4f19fe336736cc55
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Feb 26 18:23:43 2020 +0100
patch 8.2.0321: Vim9: ":execute" does not work yet
Problem: Vim9: ":execute" does not work yet.
Solution: Add ISN_EXECUTE. (closes https://github.com/vim/vim/issues/5699) Also make :echo work with more
than one argument.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 26 Feb 2020 18:30:04 +0100 |
parents | 860b39ed0e0b |
children | 48e71f948360 |
comparison
equal
deleted
inserted
replaced
19527:b4e703999a84 | 19528:3b026343f398 |
---|---|
1110 | 1110 |
1111 if ((isn = generate_instr_drop(cctx, ISN_ECHO, count)) == NULL) | 1111 if ((isn = generate_instr_drop(cctx, ISN_ECHO, count)) == NULL) |
1112 return FAIL; | 1112 return FAIL; |
1113 isn->isn_arg.echo.echo_with_white = with_white; | 1113 isn->isn_arg.echo.echo_with_white = with_white; |
1114 isn->isn_arg.echo.echo_count = count; | 1114 isn->isn_arg.echo.echo_count = count; |
1115 | |
1116 return OK; | |
1117 } | |
1118 | |
1119 /* | |
1120 * Generate an ISN_EXECUTE instruction. | |
1121 */ | |
1122 static int | |
1123 generate_EXECUTE(cctx_T *cctx, int count) | |
1124 { | |
1125 isn_T *isn; | |
1126 | |
1127 if ((isn = generate_instr_drop(cctx, ISN_EXECUTE, count)) == NULL) | |
1128 return FAIL; | |
1129 isn->isn_arg.number = count; | |
1115 | 1130 |
1116 return OK; | 1131 return OK; |
1117 } | 1132 } |
1118 | 1133 |
1119 static int | 1134 static int |
4669 compile_echo(char_u *arg, int with_white, cctx_T *cctx) | 4684 compile_echo(char_u *arg, int with_white, cctx_T *cctx) |
4670 { | 4685 { |
4671 char_u *p = arg; | 4686 char_u *p = arg; |
4672 int count = 0; | 4687 int count = 0; |
4673 | 4688 |
4674 // for () | 4689 for (;;) |
4675 { | 4690 { |
4676 if (compile_expr1(&p, cctx) == FAIL) | 4691 if (compile_expr1(&p, cctx) == FAIL) |
4677 return NULL; | 4692 return NULL; |
4678 ++count; | 4693 ++count; |
4694 p = skipwhite(p); | |
4695 if (ends_excmd(*p)) | |
4696 break; | |
4679 } | 4697 } |
4680 | 4698 |
4681 generate_ECHO(cctx, with_white, count); | 4699 generate_ECHO(cctx, with_white, count); |
4700 return p; | |
4701 } | |
4702 | |
4703 /* | |
4704 * compile "execute expr" | |
4705 */ | |
4706 static char_u * | |
4707 compile_execute(char_u *arg, cctx_T *cctx) | |
4708 { | |
4709 char_u *p = arg; | |
4710 int count = 0; | |
4711 | |
4712 for (;;) | |
4713 { | |
4714 if (compile_expr1(&p, cctx) == FAIL) | |
4715 return NULL; | |
4716 ++count; | |
4717 p = skipwhite(p); | |
4718 if (ends_excmd(*p)) | |
4719 break; | |
4720 } | |
4721 | |
4722 generate_EXECUTE(cctx, count); | |
4682 | 4723 |
4683 return p; | 4724 return p; |
4684 } | 4725 } |
4685 | 4726 |
4686 /* | 4727 /* |
5015 line = compile_echo(p, TRUE, &cctx); | 5056 line = compile_echo(p, TRUE, &cctx); |
5016 break; | 5057 break; |
5017 case CMD_echon: | 5058 case CMD_echon: |
5018 line = compile_echo(p, FALSE, &cctx); | 5059 line = compile_echo(p, FALSE, &cctx); |
5019 break; | 5060 break; |
5061 case CMD_execute: | |
5062 line = compile_execute(p, &cctx); | |
5063 break; | |
5020 | 5064 |
5021 default: | 5065 default: |
5022 // Not recognized, execute with do_cmdline_cmd(). | 5066 // Not recognized, execute with do_cmdline_cmd(). |
5023 // TODO: | 5067 // TODO: |
5024 // CMD_echomsg | 5068 // CMD_echomsg |
5025 // CMD_execute | |
5026 // etc. | 5069 // etc. |
5027 generate_EXEC(&cctx, line); | 5070 generate_EXEC(&cctx, line); |
5028 line = (char_u *)""; | 5071 line = (char_u *)""; |
5029 break; | 5072 break; |
5030 } | 5073 } |
5148 case ISN_COMPARESTRING: | 5191 case ISN_COMPARESTRING: |
5149 case ISN_CONCAT: | 5192 case ISN_CONCAT: |
5150 case ISN_DCALL: | 5193 case ISN_DCALL: |
5151 case ISN_DROP: | 5194 case ISN_DROP: |
5152 case ISN_ECHO: | 5195 case ISN_ECHO: |
5196 case ISN_EXECUTE: | |
5153 case ISN_ENDTRY: | 5197 case ISN_ENDTRY: |
5154 case ISN_FOR: | 5198 case ISN_FOR: |
5155 case ISN_FUNCREF: | 5199 case ISN_FUNCREF: |
5156 case ISN_INDEX: | 5200 case ISN_INDEX: |
5157 case ISN_JUMP: | 5201 case ISN_JUMP: |