Mercurial > vim
comparison src/vim9compile.c @ 19481:c27837cbe922 v8.2.0298
patch 8.2.0298: Vim9 script: cannot start command with a string constant
Commit: https://github.com/vim/vim/commit/0c6ceaf90389b41545d803458c4813013811c756
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 22 18:36:32 2020 +0100
patch 8.2.0298: Vim9 script: cannot start command with a string constant
Problem: Vim9 script: cannot start command with a string constant.
Solution: Recognize expression starting with '('.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 22 Feb 2020 18:45:04 +0100 |
parents | b09afbebffee |
children | 17f0d6dc6a73 |
comparison
equal
deleted
inserted
replaced
19480:341343c30a23 | 19481:c27837cbe922 |
---|---|
4819 // find what follows. Also "&opt = val", "$ENV = val" and "@r = | 4819 // find what follows. Also "&opt = val", "$ENV = val" and "@r = |
4820 // val". | 4820 // val". |
4821 p = (*ea.cmd == '&' || *ea.cmd == '$' || *ea.cmd == '@') | 4821 p = (*ea.cmd == '&' || *ea.cmd == '$' || *ea.cmd == '@') |
4822 ? ea.cmd + 1 : ea.cmd; | 4822 ? ea.cmd + 1 : ea.cmd; |
4823 p = to_name_end(p); | 4823 p = to_name_end(p); |
4824 if (p > ea.cmd && *p != NUL) | 4824 if ((p > ea.cmd && *p != NUL) || *p == '(') |
4825 { | 4825 { |
4826 int oplen; | 4826 int oplen; |
4827 int heredoc; | 4827 int heredoc; |
4828 | |
4829 // "funcname(" is always a function call. | |
4830 // "varname[]" is an expression. | |
4831 // "varname->expr" is an expression. | |
4832 if (*p == '(' | |
4833 || *p == '[' | |
4834 || ((p - ea.cmd) > 2 && ea.cmd[1] == ':') | |
4835 || (*p == '-' && p[1] == '>')) | |
4836 { | |
4837 // TODO | |
4838 } | |
4839 | 4828 |
4840 oplen = assignment_len(skipwhite(p), &heredoc); | 4829 oplen = assignment_len(skipwhite(p), &heredoc); |
4841 if (oplen > 0) | 4830 if (oplen > 0) |
4842 { | 4831 { |
4843 // Recognize an assignment if we recognize the variable | 4832 // Recognize an assignment if we recognize the variable |