Patch 8.2.2013

6 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 18, 2020, 11:39:43 AM11/18/20
to vim...@googlegroups.com

Patch 8.2.2013
Problem: Vim9: not skipping white space after unary minus.
Solution: Skip whitespace. (closes #7324)
Files: src/vim9compile.c, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.2012/src/vim9compile.c 2020-11-18 16:34:59.266884583 +0100
--- src/vim9compile.c 2020-11-18 17:37:41.642151289 +0100
***************
*** 3362,3367 ****
--- 3362,3369 ----
while (p > start)
{
--p;
+ while (VIM_ISWHITE(*p))
+ --p;
if (*p == '-' || *p == '+')
{
int negate = *p == '-';
*** ../vim-8.2.2012/src/testdir/test_vim9_expr.vim 2020-11-18 17:17:11.961928659 +0100
--- src/testdir/test_vim9_expr.vim 2020-11-18 17:32:40.363107607 +0100
***************
*** 2300,2311 ****
CheckScriptSuccess(lines)
enddef

! def Test_expr7_negate()
assert_equal(-99, -99)
assert_equal(99, --99)
var nr = 88
assert_equal(-88, -nr)
! assert_equal(88, --nr)
enddef

def Echo(arg: any): string
--- 2300,2328 ----
CheckScriptSuccess(lines)
enddef

! def Test_expr7_negate_add()
assert_equal(-99, -99)
+ assert_equal(-99, - 99)
assert_equal(99, --99)
+ assert_equal(99, -- 99)
+ assert_equal(99, - - 99)
+ assert_equal(99, +99)
+ assert_equal(-99, -+99)
+ assert_equal(-99, -+ 99)
+ assert_equal(-99, - +99)
+ assert_equal(-99, - + 99)
+ assert_equal(-99, +-99)
+ assert_equal(-99, + -99)
+ assert_equal(-99, + - 99)
+
var nr = 88
assert_equal(-88, -nr)
! assert_equal(-88, - nr)
! assert_equal(-88, - +nr)
! assert_equal(88, -- nr)
! assert_equal(88, + nr)
! assert_equal(88, --+ nr)
! assert_equal(88, - - nr)
enddef

def Echo(arg: any): string
*** ../vim-8.2.2012/src/version.c 2020-11-18 17:17:11.965928644 +0100
--- src/version.c 2020-11-18 17:34:07.946831307 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2013,
/**/

--
A cow comes flying over the battlements, lowing aggressively. The cow
lands on GALAHAD'S PAGE, squashing him completely.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages