* var1 isnot var2
*
* "arg" must point to the first non-white of the expression.
- * "arg" is advanced to the next non-white after the recognized expression.
+ * "arg" is advanced to just after the recognized expression.
*
* Return OK or FAIL.
*/
typval_T var2;
int ic;
int vim9script = in_vim9script();
+ int evaluate = evalarg == NULL
+ ? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
if (getnext)
*arg = eval_next_line(evalarg);
+ else if (evaluate && vim9script && !VIM_ISWHITE(**arg))
+ {
+ error_white_both(p, len);
+ clear_tv(rettv);
+ return FAIL;
+ }
if (vim9script && type_is && (p[len] == '?' || p[len] == '#'))
{
/*
* Get the second variable.
*/
+ if (evaluate && vim9script && !IS_WHITE_OR_NUL(p[len]))
+ {
+ error_white_both(p, 1);
+ clear_tv(rettv);
+ return FAIL;
+ }
*arg = skipwhite_and_linebreak(p + len, evalarg);
if (eval5(arg, &var2, evalarg) == FAIL)
{
clear_tv(rettv);
return FAIL;
}
- if (evalarg != NULL && (evalarg->eval_flags & EVAL_EVALUATE))
+ if (evaluate)
{
int ret;
* .. string concatenation
*
* "arg" must point to the first non-white of the expression.
- * "arg" is advanced to the next non-white after the recognized expression.
+ * "arg" is advanced to just after the recognized expression.
*
* Return OK or FAIL.
*/
* % number modulo
*
* "arg" must point to the first non-white of the expression.
- * "arg" is advanced to the next non-white after the recognized expression.
+ * "arg" is advanced to just after the recognized expression.
*
* Return OK or FAIL.
*/
* trailing ->name() method call
*
* "arg" must point to the first non-white of the expression.
- * "arg" is advanced to the next non-white after the recognized expression.
+ * "arg" is advanced to just after the recognized expression.
*
* Return OK or FAIL.
*/
set noignorecase
END
CheckScriptSuccess(lines)
+
+ # check missing white space
+ lines =<< trim END
+ vim9script
+ echo 2>3
+ END
+ CheckScriptFailure(lines, 'E1004:')
+ lines =<< trim END
+ vim9script
+ echo 2 >3
+ END
+ CheckScriptFailure(lines, 'E1004:')
+ lines =<< trim END
+ vim9script
+ echo 2> 3
+ END
+ CheckScriptFailure(lines, 'E1004:')
+ lines =<< trim END
+ vim9script
+ echo 2!=3
+ END
+ CheckScriptFailure(lines, 'E1004:')
+ lines =<< trim END
+ vim9script
+ echo 2 !=3
+ END
+ CheckScriptFailure(lines, 'E1004:')
+ lines =<< trim END
+ vim9script
+ echo 2!= 3
+ END
+ CheckScriptFailure(lines, 'E1004:')
enddef
func Test_expr4_fails()