To: [email protected]
Subject: Patch 7.2a.007
Fcc: outbox
From: Bram Moolenaar <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.2a.007
Problem:    ":let v = 1.2.3" was OK in Vim 7.1, now it gives an error.
Solution:   Don't look for a floating point number after the "." operator.
Files:      src/eval.c


*** ../vim-7.2a.006/src/eval.c  Fri Jun 27 21:16:33 2008
--- src/eval.c  Sat Jun 28 15:03:26 2008
***************
*** 405,412 ****
 static int eval3 __ARGS((char_u **arg, typval_T *rettv, int evaluate));
 static int eval4 __ARGS((char_u **arg, typval_T *rettv, int evaluate));
 static int eval5 __ARGS((char_u **arg, typval_T *rettv, int evaluate));
! static int eval6 __ARGS((char_u **arg, typval_T *rettv, int evaluate));
! static int eval7 __ARGS((char_u **arg, typval_T *rettv, int evaluate));

 static int eval_index __ARGS((char_u **arg, typval_T *rettv, int evaluate, int verbose));
 static int get_option_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
--- 405,412 ----
 static int eval3 __ARGS((char_u **arg, typval_T *rettv, int evaluate));
 static int eval4 __ARGS((char_u **arg, typval_T *rettv, int evaluate));
 static int eval5 __ARGS((char_u **arg, typval_T *rettv, int evaluate));
! static int eval6 __ARGS((char_u **arg, typval_T *rettv, int evaluate, int want_string));
! static int eval7 __ARGS((char_u **arg, typval_T *rettv, int evaluate, int want_string));

 static int eval_index __ARGS((char_u **arg, typval_T *rettv, int evaluate, int verbose));
 static int get_option_tv __ARGS((char_u **arg, typval_T *rettv, int evaluate));
***************
*** 4458,4464 ****
     /*
      * Get the first variable.
      */
!     if (eval6(arg, rettv, evaluate) == FAIL)
       return FAIL;

     /*
--- 4458,4464 ----
     /*
      * Get the first variable.
      */
!     if (eval6(arg, rettv, evaluate, FALSE) == FAIL)
       return FAIL;

     /*
***************
*** 4494,4500 ****
        * Get the second variable.
        */
       *arg = skipwhite(*arg + 1);
!       if (eval6(arg, &var2, evaluate) == FAIL)
       {
           clear_tv(rettv);
           return FAIL;
--- 4494,4500 ----
        * Get the second variable.
        */
       *arg = skipwhite(*arg + 1);
!       if (eval6(arg, &var2, evaluate, op == '.') == FAIL)
       {
           clear_tv(rettv);
           return FAIL;
***************
*** 4624,4633 ****
  * Return OK or FAIL.
  */
     static int
! eval6(arg, rettv, evaluate)
     char_u    **arg;
     typval_T  *rettv;
     int               evaluate;
 {
     typval_T  var2;
     int               op;
--- 4624,4634 ----
  * Return OK or FAIL.
  */
     static int
! eval6(arg, rettv, evaluate, want_string)
     char_u    **arg;
     typval_T  *rettv;
     int               evaluate;
+     int               want_string;  /* after "." operator */
 {
     typval_T  var2;
     int               op;
***************
*** 4641,4647 ****
     /*
      * Get the first variable.
      */
!     if (eval7(arg, rettv, evaluate) == FAIL)
       return FAIL;

     /*
--- 4642,4648 ----
     /*
      * Get the first variable.
      */
!     if (eval7(arg, rettv, evaluate, want_string) == FAIL)
       return FAIL;

     /*
***************
*** 4676,4682 ****
        * Get the second variable.
        */
       *arg = skipwhite(*arg + 1);
!       if (eval7(arg, &var2, evaluate) == FAIL)
           return FAIL;

       if (evaluate)
--- 4677,4683 ----
        * Get the second variable.
        */
       *arg = skipwhite(*arg + 1);
!       if (eval7(arg, &var2, evaluate, FALSE) == FAIL)
           return FAIL;

       if (evaluate)
***************
*** 4790,4799 ****
  * Return OK or FAIL.
  */
     static int
! eval7(arg, rettv, evaluate)
     char_u    **arg;
     typval_T  *rettv;
     int               evaluate;
 {
     long      n;
     int               len;
--- 4791,4801 ----
  * Return OK or FAIL.
  */
     static int
! eval7(arg, rettv, evaluate, want_string)
     char_u    **arg;
     typval_T  *rettv;
     int               evaluate;
+     int               want_string;    /* after "." operator */
 {
     long      n;
     int               len;
***************
*** 4838,4845 ****

               /* We accept a float when the format matches
                * "[0-9]\+\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?".  This is very
!                * strict to avoid backwards compatibility problems. */
!               if (p[0] == '.' && vim_isdigit(p[1]))
               {
                   get_float = TRUE;
                   p = skipdigits(p + 2);
--- 4840,4849 ----

               /* We accept a float when the format matches
                * "[0-9]\+\.[0-9]\+\([eE][+-]\?[0-9]\+\)\?".  This is very
!                * strict to avoid backwards compatibility problems.
!                * Don't look for a float after the "." operator, so that
!                * ":let vers = 1.2.3" doesn't fail. */
!               if (!want_string && p[0] == '.' && vim_isdigit(p[1]))
               {
                   get_float = TRUE;
                   p = skipdigits(p + 2);
*** ../vim-7.2a.006/src/version.c       Sat Jun 28 13:03:00 2008
--- src/version.c       Sat Jun 28 15:08:14 2008
***************
*** 678,679 ****
--- 678,681 ----
 {   /* Add new patch number below this line */
+ /**/
+     7,
 /**/

--
hundred-and-one symptoms of being an internet addict:
110. You actually volunteer to become your employer's webmaster.

/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
\\\            help me help AIDS victims -- http://ICCF-Holland.org    ///