vim: update release.sh to vim 7.3
[msysgit/mtrensch.git] / share / vim / vim72 / syntax / context.vim
blob225cc6efc2bffc1679ea9b5371671b25c76b5763
1 " Vim syntax file
2 " Language:         ConTeXt typesetting engine
3 " Maintainer:       Nikolai Weibull <now@bitwi.se>
4 " Latest Revision:  2006-08-10
6 if exists("b:current_syntax")
7   finish
8 endif
10 runtime! syntax/plaintex.vim
11 unlet b:current_syntax
13 let s:cpo_save = &cpo
14 set cpo&vim
16 if !exists('g:context_include')
17   let g:context_include = ['mp', 'javascript', 'xml']
18 endif
20 syn spell   toplevel
22 syn match   contextBlockDelim display '\\\%(start\|stop\)\a\+'
23                               \ contains=@NoSpell
25 syn region  contextEscaped    display matchgroup=contextPreProc
26                               \ start='\\type\z(\A\)' end='\z1'
27 syn region  contextEscaped    display matchgroup=contextPreProc
28                               \ start='\\type\={' end='}'
29 syn region  contextEscaped    display matchgroup=contextPreProc
30                               \ start='\\type\=<<' end='>>'
31 syn region  contextEscaped    matchgroup=contextPreProc
32                               \ start='\\start\z(\a*\%(typing\|typen\)\)'
33                               \ end='\\stop\z1' contains=plaintexComment keepend
34 syn region  contextEscaped    display matchgroup=contextPreProc
35                               \ start='\\\h\+Type{' end='}'
36 syn region  contextEscaped    display matchgroup=contextPreProc
37                               \ start='\\Typed\h\+{' end='}'
39 syn match   contextBuiltin    display contains=@NoSpell
40       \ '\\\%(unprotect\|protect\|unexpanded\)' 
42 syn match   contextPreProc    '^\s*\\\%(start\|stop\)\=\%(component\|environment\|project\|product\).*$'
43                               \ contains=@NoSpell
45 if index(g:context_include, 'mp') != -1
46   syn include @mpTop          syntax/mp.vim
47   unlet b:current_syntax
49   syn region  contextMPGraphic  transparent matchgroup=contextBlockDelim
50                                 \ start='\\start\z(\a*MPgraphic\|MP\%(page\|inclusions\|run\)\).*'
51                                 \ end='\\stop\z1'
52                                 \ contains=@mpTop
53 endif
55 " TODO: also need to implement this for \\typeC or something along those
56 " lines.
57 function! s:include_syntax(name, group)
58   if index(g:context_include, a:name) != -1
59     execute 'syn include @' . a:name . 'Top' 'syntax/' . a:name . '.vim'
60     unlet b:current_syntax
61     execute 'syn region context' . a:group . 'Code'
62           \ 'transparent matchgroup=contextBlockDelim'
63           \ 'start=+\\start' . a:group . '+ end=+\\stop' . a:group . '+'
64           \ 'contains=@' . a:name . 'Top'
65   endif
66 endfunction
68 call s:include_syntax('c', 'C')
69 call s:include_syntax('ruby', 'Ruby')
70 call s:include_syntax('javascript', 'JS')
71 call s:include_syntax('xml', 'XML')
73 syn match   contextSectioning '\\chapter\>' contains=@NoSpell
74 syn match   contextSectioning '\\\%(sub\)*section\>' contains=@NoSpell
76 syn match   contextSpecial    '\\crlf\>\|\\par\>\|-\{2,3}\||[<>/]\=|'
77                               \ contains=@NoSpell
78 syn match   contextSpecial    /\\[`'"]/
79 syn match   contextSpecial    +\\char\%(\d\{1,3}\|'\o\{1,3}\|"\x\{1,2}\)\>+
80                               \ contains=@NoSpell
81 syn match   contextSpecial    '\^\^.'
82 syn match   contextSpecial    '`\%(\\.\|\^\^.\|.\)'
84 syn match   contextStyle      '\\\%(em\|ss\|hw\|cg\|mf\)\>'
85                               \ contains=@NoSpell
86 syn match   contextFont       '\\\%(CAP\|Cap\|cap\|Caps\|kap\|nocap\)\>'
87                               \ contains=@NoSpell
88 syn match   contextFont       '\\\%(Word\|WORD\|Words\|WORDS\)\>'
89                               \ contains=@NoSpell
90 syn match   contextFont       '\\\%(vi\{1,3}\|ix\|xi\{0,2}\)\>'
91                               \ contains=@NoSpell
92 syn match   contextFont       '\\\%(tf\|b[si]\|s[cl]\|os\)\%(xx\|[xabcd]\)\=\>'
93                               \ contains=@NoSpell
95 hi def link contextBlockDelim Keyword
96 hi def link contextBuiltin    Keyword
97 hi def link contextDelimiter  Delimiter
98 hi def link contextPreProc    PreProc
99 hi def link contextSectioning PreProc
100 hi def link contextSpecial    Special
101 hi def link contextType       Type
102 hi def link contextStyle      contextType
103 hi def link contextFont       contextType
105 let b:current_syntax = "context"
107 let &cpo = s:cpo_save
108 unlet s:cpo_save