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 / old / 5.5.032 < prev    next >
Encoding:
Internet Message Format  |  1999-10-23  |  16.5 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 5.5.032
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.5.032 (depends on patch 5.5.025)
  8. Problem:    Patch 5.5.025 wasn't right.  And C highlighting was still not
  9.             working correctly for a #define.
  10. Solution:   Added "excludenl" argument to ":syntax", to be able not to extend
  11.             a containing item when there is a match with the end-of-line.
  12. Files:      src/syntax.c, runtime/doc/syntax.txt, runtime/syntax/c.vim
  13.  
  14.  
  15. *** ../vim-5.5.31/src/syntax.c    Sun Oct 17 15:45:09 1999
  16. --- src/syntax.c    Tue Oct 19 10:42:33 1999
  17. ***************
  18. *** 162,167 ****
  19. --- 162,168 ----
  20.   #define HL_SKIPWHITE    0x100    /* nextgroup can skip white space */
  21.   #define HL_SKIPEMPTY    0x200    /* nextgroup can skip empty lines */
  22.   #define HL_KEEPEND    0x400    /* end match always kept */
  23. + #define HL_EXCLUDENL    0x800    /* exclude NL from match */
  24.   
  25.   #define SYN_ITEMS(buf)    ((struct syn_pattern *)((buf)->b_syn_patterns.ga_data))
  26.   
  27. ***************
  28. *** 1701,1714 ****
  29.            * Only for a region the search for the end continues after
  30.            * the end of the contained item.  If the contained match
  31.            * included the end-of-line, break here, the region continues.
  32. !          * Don't do this when "keepend" is used.
  33.            */
  34.           if (SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_type == SPTYPE_START
  35. !                  && !(cur_si->si_flags & (HL_MATCH | HL_KEEPEND))
  36. !                  && keepend_level < 0)
  37.           {
  38.               update_si_end(cur_si, line, (int)current_col);
  39. !             if (current_next_flags & HL_HAS_EOL)
  40.               break;
  41.           }
  42.           }
  43. --- 1702,1719 ----
  44.            * Only for a region the search for the end continues after
  45.            * the end of the contained item.  If the contained match
  46.            * included the end-of-line, break here, the region continues.
  47. !          * Don't do this when:
  48. !          * - "keepend" is used for the contained item
  49. !          * - not at the end of the line (could be end="x$"me=e-1).
  50. !          * - "excludenl" is used (HL_HAS_EOL won't be set)
  51.            */
  52.           if (SYN_ITEMS(syn_buf)[cur_si->si_idx].sp_type == SPTYPE_START
  53. !                  && !(cur_si->si_flags & (HL_MATCH | HL_KEEPEND)))
  54.           {
  55.               update_si_end(cur_si, line, (int)current_col);
  56. !             if ((current_next_flags & HL_HAS_EOL)
  57. !                 && keepend_level < 0
  58. !                 && line[current_col] == NUL)
  59.               break;
  60.           }
  61.           }
  62. ***************
  63. *** 2639,2644 ****
  64. --- 2644,2654 ----
  65.           msg_puts_attr((char_u *)"keepend", attr);
  66.           msg_putchar(' ');
  67.       }
  68. +     if (spp->sp_flags & HL_EXCLUDENL)
  69. +     {
  70. +         msg_puts_attr((char_u *)"excludenl", attr);
  71. +         msg_putchar(' ');
  72. +     }
  73.       if (spp->sp_flags & HL_TRANSP)
  74.       {
  75.           msg_puts_attr((char_u *)"transparent", attr);
  76. ***************
  77. *** 3084,3089 ****
  78. --- 3094,3100 ----
  79.       } flagtab[] = { {"contained",   9,    HL_CONTAINED},
  80.               {"oneline",        7,    HL_ONELINE},
  81.               {"keepend",        7,    HL_KEEPEND},
  82. +             {"excludenl",   9,    HL_EXCLUDENL},
  83.               {"transparent", 11, HL_TRANSP},
  84.               {"skipnl",        6,    HL_SKIPNL},
  85.               {"skipwhite",   9,    HL_SKIPWHITE},
  86. ***************
  87. *** 3385,3391 ****
  88.       init_syn_patterns();
  89.       vim_memset(&item, 0, sizeof(item));
  90.       rest = get_syn_pattern(rest, &item);
  91. !     if (vim_regcomp_had_eol())
  92.       flags |= HL_HAS_EOL;
  93.   
  94.       /* Get options after the pattern */
  95. --- 3396,3402 ----
  96.       init_syn_patterns();
  97.       vim_memset(&item, 0, sizeof(item));
  98.       rest = get_syn_pattern(rest, &item);
  99. !     if (vim_regcomp_had_eol() && !(flags & HL_EXCLUDENL))
  100.       flags |= HL_HAS_EOL;
  101.   
  102.       /* Get options after the pattern */
  103. ***************
  104. *** 3586,3592 ****
  105.            * Get the syntax pattern and the following offset(s).
  106.            */
  107.           rest = get_syn_pattern(rest, ppp->pp_synp);
  108. !         if (item == ITEM_END && vim_regcomp_had_eol())
  109.           ppp->pp_synp->sp_flags |= HL_HAS_EOL;
  110.           ppp->pp_matchgroup_id = matchgroup_id;
  111.           ++pat_count;
  112. --- 3597,3604 ----
  113.            * Get the syntax pattern and the following offset(s).
  114.            */
  115.           rest = get_syn_pattern(rest, ppp->pp_synp);
  116. !         if (item == ITEM_END && vim_regcomp_had_eol()
  117. !                            && !(flags & HL_EXCLUDENL))
  118.           ppp->pp_synp->sp_flags |= HL_HAS_EOL;
  119.           ppp->pp_matchgroup_id = matchgroup_id;
  120.           ++pat_count;
  121. *** ../vim-5.5.31/runtime/doc/syntax.txt    Wed Sep 22 10:06:42 1999
  122. --- runtime/doc/syntax.txt    Wed Oct 20 10:10:32 1999
  123. ***************
  124. *** 1,4 ****
  125. ! *syntax.txt*    For Vim version 5.5.  Last change: 1999 Sep 19
  126.   
  127.   
  128.             VIM REFERENCE MANUAL    by Bram Moolenaar
  129. --- 1,4 ----
  130. ! *syntax.txt*    For Vim version 5.5.  Last change: 1999 Oct 20
  131.   
  132.   
  133.             VIM REFERENCE MANUAL    by Bram Moolenaar
  134. ***************
  135. *** 1046,1051 ****
  136. --- 1046,1055 ----
  137.       variations at once:
  138.   >  :syntax keyword   VimCommand   ab[breviate] n[ext]
  139.   
  140. +     Don't forget that a keyword can only be recognized if all the
  141. +     characters are included in the 'iskeyword' option.  If one character
  142. +     isn't, the keyword will never be recognized.
  143.       A keyword always has higher priority than a match or region, the
  144.       keyword is used if more than one item matches.  Keywords do not nest
  145.       and a keyword can't contain anything else.
  146. ***************
  147. *** 1069,1080 ****
  148.   
  149.   DEFINING MATCHES                    *:syn-match*
  150.   
  151. ! :sy[ntax] match {group-name} [{options}] {pattern} [{options}]
  152.   
  153.       This defines one match.
  154.   
  155.       {group-name}        A syntax group name such as "Comment".
  156.       [{options}]        See |:syn-arguments| below.
  157.       {pattern}        The search pattern that defines the match.
  158.                   See |:syn-pattern| below.
  159.   
  160. --- 1073,1087 ----
  161.   
  162.   DEFINING MATCHES                    *:syn-match*
  163.   
  164. ! :sy[ntax] match {group-name} [{options}] [excludenl] {pattern} [{options}]
  165.   
  166.       This defines one match.
  167.   
  168.       {group-name}        A syntax group name such as "Comment".
  169.       [{options}]        See |:syn-arguments| below.
  170. +     [excludenl]        Don't make a pattern with the end-of-line "$"
  171. +                 extend a containing match or region.  Must be
  172. +                 given before the pattern. |:syn-excludenl|
  173.       {pattern}        The search pattern that defines the match.
  174.                   See |:syn-pattern| below.
  175.   
  176. ***************
  177. *** 1087,1092 ****
  178. --- 1094,1100 ----
  179.   :sy[ntax] region {group-name} [{options}]
  180.           [matchgroup={group_name}]
  181.           [keepend]
  182. +         [excludenl]
  183.           start={start_pattern} ..
  184.           [skip={skip_pattern}]
  185.           end={end_pattern} ..
  186. ***************
  187. *** 1105,1110 ****
  188. --- 1113,1122 ----
  189.       keepend            Don't allow contained matches to go past a
  190.                   match with the end pattern.  See
  191.                   |:syn-keepend|.
  192. +     excludenl        Don't make a pattern with the end-of-line "$"
  193. +                 extend a containing match or item.  Only
  194. +                 useful for end patterns.  Must be given before
  195. +                 the patterns it applies to. |:syn-excludenl|
  196.       start={start_pattern}    The search pattern that defines the start of
  197.                   the region.  See |:syn-pattern| below.
  198.       skip={skip_pattern}    The search pattern that defines text inside
  199. ***************
  200. *** 1125,1131 ****
  201.   
  202.       When more than one start pattern is given, a match with one of these
  203.       is sufficient.  This means there is an OR relation between the start
  204. !     patterns.  The first one that matches is used.  The same is true for
  205.       the end patterns.
  206.   
  207.       The search for the end pattern starts at the start of the region.
  208. --- 1137,1143 ----
  209.   
  210.       When more than one start pattern is given, a match with one of these
  211.       is sufficient.  This means there is an OR relation between the start
  212. !     patterns.  The last one that matches is used.  The same is true for
  213.       the end patterns.
  214.   
  215.       The search for the end pattern starts at the start of the region.
  216. ***************
  217. *** 1163,1168 ****
  218. --- 1175,1195 ----
  219.       after each contained match.  When "keepend" is included, the first
  220.       encountered match with an end pattern is used, truncating any
  221.       contained matches.
  222. +                             *:syn-excludenl*
  223. +     When a pattern for a match or end pattern of a region includes a '$'
  224. +     to match the end-of-line, it will make an item that it is contained in
  225. +     continue on the next line.  For example, a match with "\\$" (backslash
  226. +     at the end of the line) can make a match continue that would normally
  227. +     stop at the end of the line.  This is the default behaviour.  If this
  228. +     is not wanted, there are two ways to avoid it:
  229. +     1. Use "keepend" for the the containing item.  This will keep all
  230. +        contained matches from extending the match or region.  It can be
  231. +        used when all contained items must not extend the containing item.
  232. +     2. Use "excludenl" in the contained item.  This will keep that match
  233. +        from extending the containing match or region.  It can be used if
  234. +        only some contained items must not extend the containing item.
  235. +        "excludenl" must be given before the pattern it applies to.
  236.   
  237.                               *:syn-matchgroup*
  238.       "matchgroup" can be used to highlight the start and/or end pattern
  239. *** ../vim-5.5.31/runtime/syntax/c.vim    Wed Sep 22 10:06:30 1999
  240. --- runtime/syntax/c.vim    Tue Oct 19 10:49:47 1999
  241. ***************
  242. *** 1,7 ****
  243.   " Vim syntax file
  244.   " Language:    C
  245.   " Maintainer:    Bram Moolenaar <Bram@vim.org>
  246. ! " Last change:    1999 Sep 18
  247.   
  248.   " Remove any old syntax stuff hanging around
  249.   syn clear
  250. --- 1,7 ----
  251.   " Vim syntax file
  252.   " Language:    C
  253.   " Maintainer:    Bram Moolenaar <Bram@vim.org>
  254. ! " Last change:    1999 Oct 19
  255.   
  256.   " Remove any old syntax stuff hanging around
  257.   syn clear
  258. ***************
  259. *** 25,36 ****
  260. --- 25,42 ----
  261.   endif
  262.   if exists("c_no_cformat")
  263.     syn region    cString        start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial
  264. +   " cCppString: same as cString, but ends at end of line
  265. +   syn region    cCppString    start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial
  266.   else
  267.     syn match    cFormat        "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
  268.     syn match    cFormat        "%%" contained
  269.     syn region    cString        start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat
  270. +   " cCppString: same as cString, but ends at end of line
  271. +   syn region    cCppString    start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat
  272.     hi link cFormat cSpecial
  273.   endif
  274. + hi link cCppString cString
  275.   syn match    cCharacter    "L\='[^\\]'"
  276.   syn match    cCharacter    "L'[^']*'" contains=cSpecial
  277.   syn match    cSpecialError    "L\='\\[^'\"?\\abfnrtv]'"
  278. ***************
  279. *** 42,48 ****
  280.   "when wanted, highlight trailing white space
  281.   if exists("c_space_errors")
  282.     if !exists("c_no_trail_space_error")
  283. !     syn match    cSpaceError    "\s\+$"
  284.     endif
  285.     if !exists("c_no_tab_space_error")
  286.       syn match    cSpaceError    " \+\t"me=e-1
  287. --- 48,54 ----
  288.   "when wanted, highlight trailing white space
  289.   if exists("c_space_errors")
  290.     if !exists("c_no_trail_space_error")
  291. !     syn match    cSpaceError    excludenl "\s\+$"
  292.     endif
  293.     if !exists("c_no_tab_space_error")
  294.       syn match    cSpaceError    " \+\t"me=e-1
  295. ***************
  296. *** 50,65 ****
  297.   endif
  298.   
  299.   "catch errors caused by wrong parenthesis and brackets
  300. ! syn cluster    cParenGroup    contains=cParenError,cIncluded,cSpecial,@cCommentGroup,cUserCont,cUserLabel,cBitField,cCommentSkip,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
  301.   if exists("c_no_bracket_error")
  302. !   syn region    cParen        transparent start='(' end=')' contains=ALLBUT,@cParenGroup
  303.     syn match    cParenError    ")"
  304.     syn match    cErrInParen    contained "[{}]"
  305.   else
  306. !   syn region    cParen        transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cErrInBracket
  307.     syn match    cParenError    "[\])]"
  308.     syn match    cErrInParen    contained "[\]{}]"
  309. !   syn region    cBracket    transparent start='\[' end=']' contains=ALLBUT,@cParenGroup,cErrInParen
  310.     syn match    cErrInBracket    contained "[);{}]"
  311.   endif
  312.   
  313. --- 56,77 ----
  314.   endif
  315.   
  316.   "catch errors caused by wrong parenthesis and brackets
  317. ! syn cluster    cParenGroup    contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cUserCont,cUserLabel,cBitField,cCommentSkip,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
  318.   if exists("c_no_bracket_error")
  319. !   syn region    cParen        transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString
  320. !   " cCppParen: same as cParen but ends at end-of-line; used in cDefine
  321. !   syn region    cCppParen    transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString
  322.     syn match    cParenError    ")"
  323.     syn match    cErrInParen    contained "[{}]"
  324.   else
  325. !   syn region    cParen        transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString
  326. !   " cCppParen: same as cParen but ends at end-of-line; used in cDefine
  327. !   syn region    cCppParen    transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString
  328.     syn match    cParenError    "[\])]"
  329.     syn match    cErrInParen    contained "[\]{}]"
  330. !   syn region    cBracket    transparent start='\[' end=']' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString
  331. !   " cCppBracket: same as cParen but ends at end-of-line; used in cDefine
  332. !   syn region    cCppBracket    transparent start='\[' skip='\\$' excludenl end=']' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString
  333.     syn match    cErrInBracket    contained "[);{}]"
  334.   endif
  335.   
  336. ***************
  337. *** 145,151 ****
  338.     syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX
  339.   endif
  340.   
  341. ! syn region    cPreCondit    start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\|else\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cString,cCharacter,cNumbers,cCommentError,cSpaceError
  342.   syn match    cPreCondit    "^\s*#\s*\(else\|endif\)\>"
  343.   if !exists("c_no_if0")
  344.     syn region    cCppOut        start="^\s*#\s*if\s\+0\>" end=".\|$" contains=cCppOut2
  345. --- 157,163 ----
  346.     syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX
  347.   endif
  348.   
  349. ! syn region    cPreCondit    start="^\s*#\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=cComment,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
  350.   syn match    cPreCondit    "^\s*#\s*\(else\|endif\)\>"
  351.   if !exists("c_no_if0")
  352.     syn region    cCppOut        start="^\s*#\s*if\s\+0\>" end=".\|$" contains=cCppOut2
  353. ***************
  354. *** 156,167 ****
  355.   syn match    cIncluded    contained "<[^>]*>"
  356.   syn match    cInclude    "^\s*#\s*include\>\s*["<]" contains=cIncluded
  357.   "syn match cLineSkip    "\\$"
  358. ! syn cluster    cPreProcGroup    contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
  359.   syn region    cDefine        start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" contains=ALLBUT,@cPreProcGroup
  360. ! syn region    cPreProc    start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,@cPreProcGroup
  361.   
  362.   " Highlight User Labels
  363. ! syn cluster    cMultiGroup    contains=cIncluded,cSpecial,@cCommentGroup,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
  364.   syn region    cMulti        transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup
  365.   " Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
  366.   syn cluster    cLabelGroup    contains=cUserLabel
  367. --- 168,179 ----
  368.   syn match    cIncluded    contained "<[^>]*>"
  369.   syn match    cInclude    "^\s*#\s*include\>\s*["<]" contains=cIncluded
  370.   "syn match cLineSkip    "\\$"
  371. ! syn cluster    cPreProcGroup    contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cParen,cBracket
  372.   syn region    cDefine        start="^\s*#\s*\(define\|undef\)\>" skip="\\$" end="$" contains=ALLBUT,@cPreProcGroup
  373. ! syn region    cPreProc    start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup
  374.   
  375.   " Highlight User Labels
  376. ! syn cluster    cMultiGroup    contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOut,cCppOut2,cCppSkip,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
  377.   syn region    cMulti        transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup
  378.   " Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
  379.   syn cluster    cLabelGroup    contains=cUserLabel
  380. *** ../vim-5.5.31/src/version.c    Sun Oct 24 19:27:14 1999
  381. --- src/version.c    Sun Oct 24 19:28:17 1999
  382. ***************
  383. *** 420,420 ****
  384. --- 420,421 ----
  385.   {   /* Add new patch number below this line */
  386. +     32,
  387.  
  388. --
  389. OLD WOMAN: King of the WHO?
  390. ARTHUR:    The Britons.
  391. OLD WOMAN: Who are the Britons?
  392.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  393.  
  394. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  395.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  396.