Loading ...
Sorry, an error occurred while loading the content.
 

Patch 7.3.1019

Expand Messages
  • Bram Moolenaar
    Patch 7.3.1019 Problem: These do not work with the new regexp engine: %o123, %x123, %d123, %u123 and %U123. Solution: Implement these items. Files:
    Message 1 of 3 , May 25, 2013
      Patch 7.3.1019
      Problem: These do not work with the new regexp engine: \%o123, \%x123,
      \%d123, \%u123 and \%U123.
      Solution: Implement these items.
      Files: src/regexp_nfa.c


      *** ../vim-7.3.1018/src/regexp_nfa.c 2013-05-25 21:18:30.000000000 +0200
      --- src/regexp_nfa.c 2013-05-25 21:56:16.000000000 +0200
      ***************
      *** 604,610 ****
      char_u *endp;
      #ifdef FEAT_MBYTE
      char_u *old_regparse = regparse;
      - int clen;
      int i;
      #endif
      int extra = 0;
      --- 604,609 ----
      ***************
      *** 623,637 ****
      cpo_bsl = vim_strchr(p_cpo, CPO_BACKSL) != NULL;

      c = getchr();
      -
      - #ifdef FEAT_MBYTE
      - /* clen has the length of the current char, without composing chars */
      - clen = (*mb_char2len)(c);
      - if (has_mbyte && clen > 1)
      - goto nfa_do_multibyte;
      - #endif
      switch (c)
      {
      case Magic('^'):
      EMIT(NFA_BOL);
      break;
      --- 622,633 ----
      cpo_bsl = vim_strchr(p_cpo, CPO_BACKSL) != NULL;

      c = getchr();
      switch (c)
      {
      + case NUL:
      + syntax_error = TRUE;
      + EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely"));
      +
      case Magic('^'):
      EMIT(NFA_BOL);
      break;
      ***************
      *** 747,756 ****
      return FAIL; /* cascaded error */
      break;

      - case NUL:
      - syntax_error = TRUE;
      - EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely"));
      -
      case Magic('|'):
      case Magic('&'):
      case Magic(')'):
      --- 743,748 ----
      ***************
      *** 834,844 ****
      case 'x': /* %xab hex 2 */
      case 'u': /* %uabcd hex 4 */
      case 'U': /* %U1234abcd hex 8 */
      ! /* Not yet supported */
      ! return FAIL;

      ! c = coll_get_char();
      ! EMIT(c);
      break;

      /* Catch \%^ and \%$ regardless of where they appear in the
      --- 826,851 ----
      case 'x': /* %xab hex 2 */
      case 'u': /* %uabcd hex 4 */
      case 'U': /* %U1234abcd hex 8 */
      ! {
      ! int i;

      ! switch (c)
      ! {
      ! case 'd': i = getdecchrs(); break;
      ! case 'o': i = getoctchrs(); break;
      ! case 'x': i = gethexchrs(2); break;
      ! case 'u': i = gethexchrs(4); break;
      ! case 'U': i = gethexchrs(8); break;
      ! default: i = -1; break;
      ! }
      !
      ! if (i < 0)
      ! EMSG2_RET_FAIL(
      ! _("E678: Invalid character after %s%%[dxouU]"),
      ! reg_magic == MAGIC_ALL);
      ! /* TODO: what if a composing character follows? */
      ! EMIT(i);
      ! }
      break;

      /* Catch \%^ and \%$ regardless of where they appear in the
      ***************
      *** 1217,1225 ****
      int plen;

      nfa_do_multibyte:
      ! /* Length of current char with composing chars. */
      ! if (enc_utf8 && (clen != (plen = (*mb_ptr2len)(old_regparse))
      ! || utf_iscomposing(c)))
      {
      /* A base character plus composing characters, or just one
      * or more composing characters.
      --- 1224,1233 ----
      int plen;

      nfa_do_multibyte:
      ! /* plen is length of current char with composing chars */
      ! if (enc_utf8 && ((*mb_char2len)(c)
      ! != (plen = (*mb_ptr2len)(old_regparse))
      ! || utf_iscomposing(c)))
      {
      /* A base character plus composing characters, or just one
      * or more composing characters.
      *** ../vim-7.3.1018/src/version.c 2013-05-25 21:18:30.000000000 +0200
      --- src/version.c 2013-05-25 22:00:51.000000000 +0200
      ***************
      *** 730,731 ****
      --- 730,733 ----
      { /* Add new patch number below this line */
      + /**/
      + 1019,
      /**/

      --
      The budget process was invented by an alien race of sadistic beings who
      resemble large cats.
      (Scott Adams - The Dilbert principle)

      /// Bram Moolenaar -- Bram@... -- 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 ///

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • John Little
      This patch gives me a compile warning (from gcc -Wshadow) regexp_nfa.c: In function ‘nfa_regatom’: regexp_nfa.c:830:8: warning: declaration of ‘i’
      Message 2 of 3 , May 26, 2013
        This patch gives me a compile warning (from gcc -Wshadow)

        regexp_nfa.c: In function ‘nfa_regatom’:
        regexp_nfa.c:830:8: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
        regexp_nfa.c:607:10: warning: shadowed declaration is here [-Wshadow]

        The declaration of int i; at the beginning of nfa_regatom() is only used near the end; I suggest the declaration be moved to the scope where it is used.

        Regards, John Little

        --
        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Bram Moolenaar
        ... Thanks for reporting. Some variables used in a large scope have a simple name, that causes this kind of mistakes. I ll do a bit of renaming. -- While it s
        Message 3 of 3 , May 26, 2013
          John Little wrote:

          > This patch gives me a compile warning (from gcc -Wshadow)
          >
          > regexp_nfa.c: In function ‘nfa_regatom’:
          > regexp_nfa.c:830:8: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
          > regexp_nfa.c:607:10: warning: shadowed declaration is here [-Wshadow]
          >
          > The declaration of int i; at the beginning of nfa_regatom() is only
          > used near the end; I suggest the declaration be moved to the scope
          > where it is used.

          Thanks for reporting.

          Some variables used in a large scope have a simple name, that causes
          this kind of mistakes. I'll do a bit of renaming.

          --
          While it's true that many normal people whould prefer not to _date_ an
          engineer, most normal people harbor an intense desire to _mate_ with them,
          thus producing engineerlike children who will have high-paying jobs long
          before losing their virginity.
          (Scott Adams - The Dilbert principle)

          /// Bram Moolenaar -- Bram@... -- 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 ///

          --
          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.