home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.1034 < prev    next >
Encoding:
Internet Message Format  |  2013-05-27  |  5.6 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.1034
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.1034
  11. Problem:    New regexp code using strange multi-byte code.
  12. Solution:   Use the normal code to advance and backup pointers.
  13. Files:        src/regexp_nfa.c
  14.  
  15.  
  16. *** ../vim-7.3.1033/src/regexp_nfa.c    2013-05-28 22:03:13.000000000 +0200
  17. --- src/regexp_nfa.c    2013-05-28 22:25:28.000000000 +0200
  18. ***************
  19. *** 188,195 ****
  20.   static int nfa_regcomp_start __ARGS((char_u*expr, int re_flags));
  21.   static int nfa_recognize_char_class __ARGS((char_u *start, char_u *end, int extra_newl));
  22.   static int nfa_emit_equi_class __ARGS((int c, int neg));
  23. - static void nfa_inc __ARGS((char_u **p));
  24. - static void nfa_dec __ARGS((char_u **p));
  25.   static int nfa_regatom __ARGS((void));
  26.   static int nfa_regpiece __ARGS((void));
  27.   static int nfa_regconcat __ARGS((void));
  28. --- 188,193 ----
  29. ***************
  30. *** 554,601 ****
  31.    */
  32.   
  33.   /*
  34. -  * Increments the pointer "p" by one (multi-byte) character.
  35. -  */
  36. -     static void
  37. - nfa_inc(p)
  38. -     char_u **p;
  39. - {
  40. - #ifdef FEAT_MBYTE
  41. -     if (has_mbyte)
  42. -     mb_ptr2char_adv(p);
  43. -     else
  44. - #endif
  45. -     *p = *p + 1;
  46. - }
  47. - /*
  48. -  * Decrements the pointer "p" by one (multi-byte) character.
  49. -  */
  50. -     static void
  51. - nfa_dec(p)
  52. -     char_u **p;
  53. - {
  54. - #ifdef FEAT_MBYTE
  55. -     char_u *p2, *oldp;
  56. -     if (has_mbyte)
  57. -     {
  58. -     oldp = *p;
  59. -     /* Try to find the multibyte char that advances to the current
  60. -      * position. */
  61. -     do
  62. -     {
  63. -         *p = *p - 1;
  64. -         p2 = *p;
  65. -         mb_ptr2char_adv(&p2);
  66. -     } while (p2 != oldp);
  67. -     }
  68. - #else
  69. -     *p = *p - 1;
  70. - #endif
  71. - }
  72. - /*
  73.    * Parse the lowest level.
  74.    *
  75.    * An atom can be one of a long list of items.  Many atoms match one character
  76. --- 552,557 ----
  77. ***************
  78. *** 963,969 ****
  79.               EMIT(NFA_OR);
  80.               }
  81.               regparse = endp;
  82. !             nfa_inc(®parse);
  83.               return OK;
  84.           }
  85.           /*
  86. --- 919,925 ----
  87.               EMIT(NFA_OR);
  88.               }
  89.               regparse = endp;
  90. !             mb_ptr_adv(regparse);
  91.               return OK;
  92.           }
  93.           /*
  94. ***************
  95. *** 978,984 ****
  96.           {
  97.               negated = TRUE;
  98.               glue = NFA_CONCAT;
  99. !             nfa_inc(®parse);
  100.           }
  101.           if (*regparse == '-')
  102.           {
  103. --- 934,940 ----
  104.           {
  105.               negated = TRUE;
  106.               glue = NFA_CONCAT;
  107. !             mb_ptr_adv(regparse);
  108.           }
  109.           if (*regparse == '-')
  110.           {
  111. ***************
  112. *** 986,992 ****
  113.               EMIT(startc);
  114.               TRY_NEG();
  115.               EMIT_GLUE();
  116. !             nfa_inc(®parse);
  117.           }
  118.           /* Emit the OR branches for each character in the [] */
  119.           emit_range = FALSE;
  120. --- 942,948 ----
  121.               EMIT(startc);
  122.               TRY_NEG();
  123.               EMIT_GLUE();
  124. !             mb_ptr_adv(regparse);
  125.           }
  126.           /* Emit the OR branches for each character in the [] */
  127.           emit_range = FALSE;
  128. ***************
  129. *** 1090,1096 ****
  130.               {
  131.               emit_range = TRUE;
  132.               startc = oldstartc;
  133. !             nfa_inc(®parse);
  134.               continue;        /* reading the end of the range */
  135.               }
  136.   
  137. --- 1046,1052 ----
  138.               {
  139.               emit_range = TRUE;
  140.               startc = oldstartc;
  141. !             mb_ptr_adv(regparse);
  142.               continue;        /* reading the end of the range */
  143.               }
  144.   
  145. ***************
  146. *** 1110,1116 ****
  147.                   )
  148.               )
  149.               {
  150. !             nfa_inc(®parse);
  151.   
  152.               if (*regparse == 'n')
  153.                   startc = reg_string ? NL : NFA_NEWL;
  154. --- 1066,1072 ----
  155.                   )
  156.               )
  157.               {
  158. !             mb_ptr_adv(regparse);
  159.   
  160.               if (*regparse == 'n')
  161.                   startc = reg_string ? NL : NFA_NEWL;
  162. ***************
  163. *** 1125,1131 ****
  164.                   /* TODO(RE) This needs more testing */
  165.                   startc = coll_get_char();
  166.                   got_coll_char = TRUE;
  167. !                 nfa_dec(®parse);
  168.                   }
  169.                   else
  170.                   {
  171. --- 1081,1087 ----
  172.                   /* TODO(RE) This needs more testing */
  173.                   startc = coll_get_char();
  174.                   got_coll_char = TRUE;
  175. !                 mb_ptr_back(old_regparse, regparse);
  176.                   }
  177.                   else
  178.                   {
  179. ***************
  180. *** 1210,1226 ****
  181.               EMIT_GLUE();
  182.               }
  183.   
  184. !             nfa_inc(®parse);
  185.           } /* while (p < endp) */
  186.   
  187. !         nfa_dec(®parse);
  188.           if (*regparse == '-')        /* if last, '-' is just a char */
  189.           {
  190.               EMIT('-');
  191.               TRY_NEG();
  192.               EMIT_GLUE();
  193.           }
  194. !         nfa_inc(®parse);
  195.   
  196.           if (extra == ADD_NL)        /* \_[] also matches \n */
  197.           {
  198. --- 1166,1182 ----
  199.               EMIT_GLUE();
  200.               }
  201.   
  202. !             mb_ptr_adv(regparse);
  203.           } /* while (p < endp) */
  204.   
  205. !         mb_ptr_back(old_regparse, regparse);
  206.           if (*regparse == '-')        /* if last, '-' is just a char */
  207.           {
  208.               EMIT('-');
  209.               TRY_NEG();
  210.               EMIT_GLUE();
  211.           }
  212. !         mb_ptr_adv(regparse);
  213.   
  214.           if (extra == ADD_NL)        /* \_[] also matches \n */
  215.           {
  216. ***************
  217. *** 1231,1237 ****
  218.   
  219.           /* skip the trailing ] */
  220.           regparse = endp;
  221. !         nfa_inc(®parse);
  222.           if (negated == TRUE)
  223.           {
  224.               /* Mark end of negated char range */
  225. --- 1187,1193 ----
  226.   
  227.           /* skip the trailing ] */
  228.           regparse = endp;
  229. !         mb_ptr_adv(regparse);
  230.           if (negated == TRUE)
  231.           {
  232.               /* Mark end of negated char range */
  233. *** ../vim-7.3.1033/src/version.c    2013-05-28 22:03:13.000000000 +0200
  234. --- src/version.c    2013-05-28 22:29:18.000000000 +0200
  235. ***************
  236. *** 730,731 ****
  237. --- 730,733 ----
  238.   {   /* Add new patch number below this line */
  239. + /**/
  240. +     1034,
  241.   /**/
  242.  
  243. -- 
  244. hundred-and-one symptoms of being an internet addict:
  245. 7. You finally do take that vacation, but only after buying a cellular modem
  246.    and a laptop.
  247.  
  248.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  249. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  250. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  251.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  252.