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

Patch 5.6.081

Expand Messages
  • Bram Moolenaar
    Patch 5.6.081 Problem: :syn include uses a level for the included file, this confuses contained items included at the same level. Solution: Use a unique
    Message 1 of 1 , Jun 5, 2000
    • 0 Attachment
      Patch 5.6.081
      Problem: ":syn include" uses a level for the included file, this confuses
      contained items included at the same level.
      Solution: Use a unique tag for each included file. Changed sp_syn_inc_lvl
      to sp_syn_inc_tag. (Scott Bigham)
      Files: src/syntax.c, src/structs.h


      *** ../vim-5.6.80/src/syntax.c Sat Mar 25 18:13:50 2000
      --- src/syntax.c Mon May 22 09:42:51 2000
      ***************
      *** 125,131 ****
      char sp_type; /* see SPTYPE_ defines below */
      char sp_syncing; /* this item used for syncing */
      short sp_flags; /* see HL_ defines below */
      ! int sp_syn_inc_lvl; /* ":syn include" level of item */
      short sp_syn_id; /* highlight group ID of item */
      short sp_syn_match_id; /* highlight group ID of pattern */
      char_u *sp_pattern; /* regexp to match, pattern */
      --- 125,131 ----
      char sp_type; /* see SPTYPE_ defines below */
      char sp_syncing; /* this item used for syncing */
      short sp_flags; /* see HL_ defines below */
      ! int sp_syn_inc_tag; /* ":syn include" unique tag */
      short sp_syn_id; /* highlight group ID of item */
      short sp_syn_match_id; /* highlight group ID of pattern */
      char_u *sp_pattern; /* regexp to match, pattern */
      ***************
      *** 232,242 ****
      static char_u **syn_cmdlinep;

      /*
      ! * Another Annoying Hack(TM): To prevent rules from higher or lower in the
      ! * ":syn include" stack from from leaking into ALLBUT lists, we track the
      ! * current stack "level".
      */
      ! static int current_syn_inc_lvl = 0;

      /*
      * To reduce the time spent in keepend(), remember at which level in the state
      --- 232,243 ----
      static char_u **syn_cmdlinep;

      /*
      ! * Another Annoying Hack(TM): To prevent rules from other ":syn include"'d
      ! * files from from leaking into ALLBUT lists, we assign a unique ID to the
      ! * rules in each ":syn include"'d file.
      */
      ! static int current_syn_inc_tag = 0;
      ! static int running_syn_inc_tag = 0;

      /*
      * To reduce the time spent in keepend(), remember at which level in the state
      ***************
      *** 1348,1361 ****
      && ((current_next_list != 0
      && in_id_list(current_next_list,
      spp->sp_syn_id,
      ! spp->sp_syn_inc_lvl, 0))
      || (current_next_list == 0
      && ((cur_si == NULL
      && !(spp->sp_flags & HL_CONTAINED))
      || (cur_si != NULL
      && in_id_list(cur_si->si_cont_list,
      spp->sp_syn_id,
      ! spp->sp_syn_inc_lvl,
      spp->sp_flags & HL_CONTAINED))))))
      {
      int lc_col;
      --- 1349,1362 ----
      && ((current_next_list != 0
      && in_id_list(current_next_list,
      spp->sp_syn_id,
      ! spp->sp_syn_inc_tag, 0))
      || (current_next_list == 0
      && ((cur_si == NULL
      && !(spp->sp_flags & HL_CONTAINED))
      || (cur_si != NULL
      && in_id_list(cur_si->si_cont_list,
      spp->sp_syn_id,
      ! spp->sp_syn_inc_tag,
      spp->sp_flags & HL_CONTAINED))))))
      {
      int lc_col;
      ***************
      *** 2157,2169 ****
      if ( STRCMP(keyword, ktab->keyword) == 0
      && ( (current_next_list != 0
      && in_id_list(current_next_list, ktab->syn_id,
      ! ktab->syn_inc_lvl, 0))
      || (current_next_list == 0
      && ((cur_si == NULL && !(ktab->flags & HL_CONTAINED))
      || (cur_si != NULL
      && in_id_list(cur_si->si_cont_list,
      ktab->syn_id,
      ! ktab->syn_inc_lvl,
      ktab->flags & HL_CONTAINED))))))
      {
      *endcol = startcol + len - 1;
      --- 2158,2170 ----
      if ( STRCMP(keyword, ktab->keyword) == 0
      && ( (current_next_list != 0
      && in_id_list(current_next_list, ktab->syn_id,
      ! ktab->syn_inc_tag, 0))
      || (current_next_list == 0
      && ((cur_si == NULL && !(ktab->flags & HL_CONTAINED))
      || (cur_si != NULL
      && in_id_list(cur_si->si_cont_list,
      ktab->syn_id,
      ! ktab->syn_inc_tag,
      ktab->flags & HL_CONTAINED))))))
      {
      *endcol = startcol + len - 1;
      ***************
      *** 3013,3019 ****
      return;
      STRCPY(ktab->keyword, name);
      ktab->syn_id = id;
      ! ktab->syn_inc_lvl = current_syn_inc_lvl;
      ktab->flags = flags;
      ktab->next_list = copy_id_list(next_list);

      --- 3014,3020 ----
      return;
      STRCPY(ktab->keyword, name);
      ktab->syn_id = id;
      ! ktab->syn_inc_tag = current_syn_inc_tag;
      ktab->flags = flags;
      ktab->next_list = copy_id_list(next_list);

      ***************
      *** 3238,3243 ****
      --- 3241,3247 ----
      char_u *rest;
      char_u *errormsg = NULL;
      int prev_toplvl_grp;
      + int prev_syn_inc_tag;

      eap->nextcmd = find_nextcmd(arg);
      if (eap->skip)
      ***************
      *** 3272,3286 ****

      /*
      * Save and restore the existing top-level grouplist id and ":syn
      ! * include" level around the actual inclusion.
      */
      ! current_syn_inc_lvl++;
      prev_toplvl_grp = curbuf->b_syn_topgrp;
      curbuf->b_syn_topgrp = sgl_id;
      if (do_source(eap->arg, FALSE, FALSE) == FAIL)
      emsg2(e_notopen, eap->arg);
      curbuf->b_syn_topgrp = prev_toplvl_grp;
      ! current_syn_inc_lvl--;
      }

      /*
      --- 3276,3291 ----

      /*
      * Save and restore the existing top-level grouplist id and ":syn
      ! * include" tag around the actual inclusion.
      */
      ! prev_syn_inc_tag = current_syn_inc_tag;
      ! current_syn_inc_tag = ++running_syn_inc_tag;
      prev_toplvl_grp = curbuf->b_syn_topgrp;
      curbuf->b_syn_topgrp = sgl_id;
      if (do_source(eap->arg, FALSE, FALSE) == FAIL)
      emsg2(e_notopen, eap->arg);
      curbuf->b_syn_topgrp = prev_toplvl_grp;
      ! current_syn_inc_tag = prev_syn_inc_tag;
      }

      /*
      ***************
      *** 3429,3435 ****
      SYN_ITEMS(curbuf)[idx].sp_syncing = syncing;
      SYN_ITEMS(curbuf)[idx].sp_type = SPTYPE_MATCH;
      SYN_ITEMS(curbuf)[idx].sp_syn_id = syn_id;
      ! SYN_ITEMS(curbuf)[idx].sp_syn_inc_lvl = current_syn_inc_lvl;
      SYN_ITEMS(curbuf)[idx].sp_flags = flags;
      SYN_ITEMS(curbuf)[idx].sp_sync_idx = sync_idx;
      SYN_ITEMS(curbuf)[idx].sp_cont_list = cont_list;
      --- 3434,3440 ----
      SYN_ITEMS(curbuf)[idx].sp_syncing = syncing;
      SYN_ITEMS(curbuf)[idx].sp_type = SPTYPE_MATCH;
      SYN_ITEMS(curbuf)[idx].sp_syn_id = syn_id;
      ! SYN_ITEMS(curbuf)[idx].sp_syn_inc_tag = current_syn_inc_tag;
      SYN_ITEMS(curbuf)[idx].sp_flags = flags;
      SYN_ITEMS(curbuf)[idx].sp_sync_idx = sync_idx;
      SYN_ITEMS(curbuf)[idx].sp_cont_list = cont_list;
      ***************
      *** 3652,3658 ****
      (item == ITEM_SKIP) ? SPTYPE_SKIP : SPTYPE_END;
      SYN_ITEMS(curbuf)[idx].sp_flags |= flags;
      SYN_ITEMS(curbuf)[idx].sp_syn_id = syn_id;
      ! SYN_ITEMS(curbuf)[idx].sp_syn_inc_lvl = current_syn_inc_lvl;
      SYN_ITEMS(curbuf)[idx].sp_syn_match_id =
      ppp->pp_matchgroup_id;
      if (item == ITEM_START)
      --- 3657,3663 ----
      (item == ITEM_SKIP) ? SPTYPE_SKIP : SPTYPE_END;
      SYN_ITEMS(curbuf)[idx].sp_flags |= flags;
      SYN_ITEMS(curbuf)[idx].sp_syn_id = syn_id;
      ! SYN_ITEMS(curbuf)[idx].sp_syn_inc_tag = current_syn_inc_tag;
      SYN_ITEMS(curbuf)[idx].sp_syn_match_id =
      ppp->pp_matchgroup_id;
      if (item == ITEM_START)
      ***************
      *** 4358,4364 ****
      vim_free(name);
      break;
      }
      ! id = CONTAINS_ALLBUT + current_syn_inc_lvl;
      }
      else if (name[1] == '@')
      {
      --- 4363,4369 ----
      vim_free(name);
      break;
      }
      ! id = CONTAINS_ALLBUT + current_syn_inc_tag;
      }
      else if (name[1] == '@')
      {
      ***************
      *** 4495,4504 ****
      * Check if "id" is in the "contains" or "nextgroup" list of pattern "idx".
      */
      static int
      ! in_id_list(list, id, inclvl, contained)
      short *list; /* id list */
      int id; /* group id */
      ! int inclvl; /* ":syn include" level of group id */
      int contained; /* group id is contained */
      {
      int retval;
      --- 4500,4509 ----
      * Check if "id" is in the "contains" or "nextgroup" list of pattern "idx".
      */
      static int
      ! in_id_list(list, id, inctag, contained)
      short *list; /* id list */
      int id; /* group id */
      ! int inctag; /* ":syn include" tag of group id */
      int contained; /* group id is contained */
      {
      int retval;
      ***************
      *** 4519,4525 ****
      */
      if (*list >= CONTAINS_ALLBUT && *list < CLUSTER_ID_MIN)
      {
      ! if (*list - CONTAINS_ALLBUT != inclvl)
      return FALSE;
      ++list;
      retval = FALSE;
      --- 4524,4530 ----
      */
      if (*list >= CONTAINS_ALLBUT && *list < CLUSTER_ID_MIN)
      {
      ! if (*list - CONTAINS_ALLBUT != inctag)
      return FALSE;
      ++list;
      retval = FALSE;
      ***************
      *** 4538,4544 ****
      if (scl_id >= 0)
      {
      scl_list = SYN_CLSTR(syn_buf)[scl_id].scl_list;
      ! if (scl_list != NULL && in_id_list(scl_list, id, inclvl, contained))
      return retval;
      }
      }
      --- 4543,4549 ----
      if (scl_id >= 0)
      {
      scl_list = SYN_CLSTR(syn_buf)[scl_id].scl_list;
      ! if (scl_list != NULL && in_id_list(scl_list, id, inctag, contained))
      return retval;
      }
      }
      *** ../vim-5.6.80/src/structs.h Thu Dec 2 17:43:04 1999
      --- src/structs.h Mon May 22 09:42:51 2000
      ***************
      *** 323,329 ****
      struct keyentry
      {
      struct keyentry *next; /* next keyword in the hash list */
      ! int syn_inc_lvl; /* ":syn include" level for this match */
      short syn_id; /* syntax ID for this match (if non-zero) */
      short *next_list; /* ID list for next match (if non-zero) */
      short flags; /* see syntax.c */
      --- 323,329 ----
      struct keyentry
      {
      struct keyentry *next; /* next keyword in the hash list */
      ! int syn_inc_tag; /* ":syn include" tag for this match */
      short syn_id; /* syntax ID for this match (if non-zero) */
      short *next_list; /* ID list for next match (if non-zero) */
      short flags; /* see syntax.c */
      *** ../vim-5.6.80/src/version.c Sun Jun 4 20:25:26 2000
      --- src/version.c Mon Jun 5 11:18:03 2000
      ***************
      *** 420,421 ****
      --- 420,423 ----
      { /* Add new patch number below this line */
      + /**/
      + 81,
      /**/

      --
      Clothes make the man. Naked people have little or no influence on society.

      /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
      \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
    Your message has been successfully submitted and would be delivered to recipients shortly.