Mercurial > vim
annotate runtime/syntax/mason.vim @ 25786:ec62e0764ffa v8.2.3428
patch 8.2.3428: using freed memory when replacing
Commit: https://github.com/vim/vim/commit/35a9a00afcb20897d462a766793ff45534810dc3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 11 21:14:20 2021 +0200
patch 8.2.3428: using freed memory when replacing
Problem: Using freed memory when replacing. (Dhiraj Mishra)
Solution: Get the line pointer after calling ins_copychar().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 11 Sep 2021 21:15:03 +0200 |
parents | d91cf2e26ef0 |
children | d1fe80fb35e6 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
12499 | 2 " Language: Mason (Perl embedded in HTML) |
3 " Maintainer: vim-perl <vim-perl@googlegroups.com> | |
4 " Homepage: http://github.com/vim-perl/vim-perl/tree/master | |
5 " Bugs/requests: http://github.com/vim-perl/vim-perl/issues | |
6 " Last Change: 2017-09-12 | |
7 " Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> | |
8 " Andrew Smith <andrewdsmith@yahoo.com> | |
7 | 9 " |
12499 | 10 " TODO: |
7 | 11 " - Fix <%text> blocks to show HTML tags but ignore Mason tags. |
12 " | |
13 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
14 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
15 if exists("b:current_syntax") |
7 | 16 finish |
17 endif | |
18 | |
19 " The HTML syntax file included below uses this variable. | |
20 " | |
21 if !exists("main_syntax") | |
22 let main_syntax = 'mason' | |
23 endif | |
24 | |
25 " First pull in the HTML syntax. | |
26 " | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
27 runtime! syntax/html.vim |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
28 unlet b:current_syntax |
7 | 29 |
30 syn cluster htmlPreproc add=@masonTop | |
31 | |
32 " Now pull in the Perl syntax. | |
33 " | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
34 syn include @perlTop syntax/perl.vim |
12499 | 35 unlet b:current_syntax |
36 syn include @podTop syntax/pod.vim | |
7 | 37 |
38 " It's hard to reduce down to the correct sub-set of Perl to highlight in some | |
39 " of these cases so I've taken the safe option of just using perlTop in all of | |
40 " them. If you have any suggestions, please let me know. | |
41 " | |
12499 | 42 syn region masonPod start="^=[a-z]" end="^=cut" keepend contained contains=@podTop |
43 syn cluster perlTop remove=perlBraces | |
44 syn region masonLine matchgroup=Delimiter start="^%" end="$" keepend contains=@perlTop | |
45 syn region masonPerlComment start="#" end="\%(%>\)\@=\|$" contained contains=perlTodo,@Spell | |
46 syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop,masonPerlComment | |
47 syn region masonPerl matchgroup=Delimiter start="<%perl>" end="</%perl>" contains=masonPod,@perlTop | |
48 syn region masonComp keepend matchgroup=Delimiter start="<&\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop | |
49 syn region masonComp keepend matchgroup=Delimiter skipnl start="<&|\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop nextgroup=masonCompContent | |
50 syn region masonCompContent matchgroup=Delimiter start="" end="</&>" contained contains=@masonTop | |
7 | 51 |
12499 | 52 syn region masonArgs matchgroup=Delimiter start="<%args>" end="</%args>" contains=masonPod,@perlTop |
7 | 53 |
12499 | 54 syn region masonInit matchgroup=Delimiter start="<%init>" end="</%init>" contains=masonPod,@perlTop |
55 syn region masonCleanup matchgroup=Delimiter start="<%cleanup>" end="</%cleanup>" contains=masonPod,@perlTop | |
56 syn region masonOnce matchgroup=Delimiter start="<%once>" end="</%once>" contains=masonPod,@perlTop | |
57 syn region masonClass matchgroup=Delimiter start="<%class>" end="</%class>" contains=masonPod,@perlTop | |
58 syn region masonShared matchgroup=Delimiter start="<%shared>" end="</%shared>" contains=masonPod,@perlTop | |
7 | 59 |
12499 | 60 syn region masonDef matchgroup=Delimiter start="<%def\s*[-._/[:alnum:]]\+\s*>" end="</%def>" contains=@htmlTop |
61 syn region masonMethod matchgroup=Delimiter start="<%method\s*[-._/[:alnum:]]\+\s*>" end="</%method>" contains=@htmlTop | |
7 | 62 |
12499 | 63 syn region masonFlags matchgroup=Delimiter start="<%flags>" end="</%flags>" contains=masonPod,@perlTop |
64 syn region masonAttr matchgroup=Delimiter start="<%attr>" end="</%attr>" contains=masonPod,@perlTop | |
7 | 65 |
12499 | 66 syn region masonFilter matchgroup=Delimiter start="<%filter>" end="</%filter>" contains=masonPod,@perlTop |
7 | 67 |
68 syn region masonDoc matchgroup=Delimiter start="<%doc>" end="</%doc>" | |
69 syn region masonText matchgroup=Delimiter start="<%text>" end="</%text>" | |
70 | |
71 syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs,masonInit,masonCleanup,masonOnce,masonShared,masonDef,masonMethod,masonFlags,masonAttr,masonFilter,masonDoc,masonText | |
72 | |
73 " Set up default highlighting. Almost all of this is done in the included | |
74 " syntax files. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
75 hi def link masonDoc Comment |
12499 | 76 hi def link masonPod Comment |
77 hi def link masonPerlComment perlComment | |
7 | 78 |
79 let b:current_syntax = "mason" | |
80 | |
81 if main_syntax == 'mason' | |
82 unlet main_syntax | |
83 endif |