]> Git — Sourcephile - doclang.git/blob - vim/syntax/tct.vim
Add Xmlify.
[doclang.git] / vim / syntax / tct.vim
1 " Language: Texte Convivial Technique (TCT)
2 " License: GNU General Public License, version 3 or later (at your option)
3 " Maintainer: Julien Moutinho <julm+tct@autogeree.net>
4 " URL: http://autogeree.net/pad/edition/tct/
5 " Version: v2017-08-24
6 " Installation:
7 " Copy this file to ~/.vim/syntax/tct.vim
8 " then add this line to ~/.vimrc :
9 " autocmd BufNewFile,BufRead *.tct set filetype=tct
10
11 if exists("b:current_syntax")
12 "finish
13 endif
14
15 syn clear
16 syn sync fromstart
17 syn sync linebreaks=1
18
19 " Default
20 syn match tctPlain /.\+/ contains=@tctInline
21 hi def link tctPlain Normal
22
23 " Block
24 syn match tctPath /^\( *\([^<>:=| *`«»/"_,.;@^!?~%(){}[\]\\#&+-]* *[:>]\|\[[^]]*\]\|- \|\( *\d\+\.\)\+\)\)* *\ze\([^<>:=| *`«»/"_,.;@^!?~%(){}[\]\\#&+-]* *\([>=|@]\|: \|:$\)\|\[[^]]*\]\|-- \|- \|\( *\d\+\.\)\+\|#\+ \)/
25 \ contains=tctNodeBird,tctNodeColon,tctNodeComment,tctNodeUL,tctNodeOL,tctNodeBracket
26 \ nextgroup=@tctKeyPath
27 syn cluster tctKeyPath
28 \ contains=tctKeyAt,tctKeyBird,tctKeyColon,tctKeyEqual,tctKeyBar,tctKeyComment,tctKeyUL,tctKeyOL,tctKeyBracket,tctKeySection
29 syn match tctKeyAt /[^<>:=| ]* *@/ contained contains=tctNodeAt nextgroup=tctValueAt
30 syn match tctKeyBar /[^<>:=| ]* *|/ contained contains=tctNodeBar nextgroup=tctValueBar
31 syn match tctKeyBird /[^<>:=| ]* *>/ contained contains=tctNodeBird nextgroup=tctValueBird
32 syn match tctKeyColon /[^<>:=| ]* *:\ze\( \|$\)/ contained contains=tctNodeColon nextgroup=tctValueColon
33 syn match tctKeyEqual /[^<>:=| ]* *=/ contained contains=tctNodeEqual nextgroup=tctValueEqual
34 syn match tctKeyBracket /\[[^]]*\]/ contained contains=tctNodeBracket nextgroup=tctValueBracket
35 syn match tctKeyComment /-- / contained contains=tctNodeComment nextgroup=tctValueComment
36 syn match tctKeyUL /-\ze / contained contains=tctNodeUL nextgroup=tctValueUL
37 syn match tctKeyOL /\( *\d\+\.\)\+\ze\( \|$\)/ contained contains=tctNodeOL nextgroup=tctValueOL
38 syn match tctKeySection /#\+\ze / contained contains=tctNodeSection nextgroup=tctValueSection
39
40 syn match tctNodeAt /[^<>:=| ]* *@/ contained contains=tctSymAt,tctSymDot
41 syn match tctNodeBar /[^<>:=| ]* *|/ contained contains=tctSymBar,tctSymDot
42 syn match tctNodeBird /[^<>:=| ]* *>/ contained contains=tctSymBird,tctSymDot
43 syn match tctNodeColon /[^<>:=| ]* *:\ze\( \|$\)/ contained contains=tctSymColon,@tctColons,tctSymDot
44 syn match tctNodeEqual /[^<>:=| ]* *=/ contained contains=tctSymEqual,tctSymDot
45 syn match tctNodeBracket /\[[^]]*\]/ contained contains=tctSymBracket,@tctInline
46 syn match tctNodeComment /--/ contained
47 syn match tctNodeUL /-/ contained
48 syn match tctNodeOL /\( *\d\+\.\)\+/ contained contains=tctSymDot
49 syn match tctNodeSection /#\+/ contained
50
51 syn match tctSymAt /@/ contained
52 syn match tctSymBar /|/ contained
53 syn match tctSymBird />/ contained
54 syn match tctSymColon /:/ contained
55 syn match tctSymDot /[.]/ contained
56 syn match tctSymEqual /=/ contained
57 syn match tctSymBracket /\(\[\|\]\)/ contained
58
59 syn match tctValueAt /.*/ contained contains=@tctURL
60 syn match tctValueBar /.*/ contained
61 syn match tctValueBird /.*/ contained contains=@tctInline
62 syn match tctValueColon /.*/ contained contains=@tctInline
63 syn match tctValueEqual /.*/ contained contains=@tctInline
64 syn match tctValueBracket /.*/ contained contains=@tctInline
65 syn match tctValueComment /.*/ contained
66 syn match tctValueUL /.*/ contained contains=@tctInline
67 syn match tctValueOL /.*/ contained contains=@tctInline
68 syn match tctValueSection /.*/ contained contains=@tctInline
69
70 "syn match tctSection /^ *#\+ .*/ contains=@tctInline
71
72
73 hi tctNodeAt cterm=NONE ctermfg=yellow guifg=yellow
74 hi tctNodeBar cterm=NONE ctermfg=DarkYellow guifg=yellow
75 hi tctNodeBird cterm=NONE ctermfg=DarkYellow guifg=yellow
76 hi tctNodeColon cterm=bold ctermfg=yellow guifg=yellow
77 hi tctNodeEqual cterm=bold ctermfg=DarkGrey guifg=yellow
78 hi tctNodeBracket cterm=NONE ctermfg=NONE guifg=NONE
79 hi tctNodeComment cterm=bold ctermfg=DarkGrey guifg=grey
80 hi tctNodeUL cterm=bold ctermfg=yellow guifg=yellow
81 hi tctNodeOL cterm=bold ctermfg=yellow guifg=yellow
82 hi tctNodeSection cterm=bold ctermfg=magenta guifg=magenta gui=bold
83
84 hi tctSymAt cterm=bold ctermfg=cyan guifg=cyan
85 hi tctSymBar cterm=bold ctermfg=cyan guifg=cyan
86 hi tctSymBird cterm=bold ctermfg=cyan guifg=cyan
87 hi tctSymColon cterm=bold ctermfg=cyan guifg=cyan
88 hi tctSymDot cterm=bold ctermfg=DarkGrey guifg=grey
89 hi tctSymEqual cterm=bold ctermfg=cyan guifg=cyan
90 hi tctSymBracket cterm=bold ctermfg=cyan guifg=cyan
91
92 hi tctValueAt cterm=bold gui=bold
93 hi def link tctValueBar Normal
94 hi tctValueColon cterm=bold gui=bold
95 hi tctValueBird cterm=NONE gui=NONE
96 hi tctValueEqual cterm=NONE gui=NONE
97 hi tctValueComment ctermfg=DarkGrey cterm=bold gui=NONE guifg=grey
98 hi tctValueUL cterm=NONE gui=NONE
99 hi tctValueOL cterm=NONE gui=NONE
100
101 hi tctComment cterm=bold ctermfg=DarkGrey guifg=grey
102 hi tctKeySection cterm=bold ctermfg=magenta guifg=magenta gui=bold
103 hi tctValueSection cterm=bold ctermfg=magenta guifg=magenta gui=bold
104
105
106 " Semantic node names, these are not necessary but improves the view.
107 syn cluster tctColons contains=tctColonDONE,tctColonSOLVED,tctColonTODO
108 syn match tctColonDONE /\<DONE\ze *:/ contained
109 syn match tctColonSOLVED /\<SOLVED\ze *:/ contained
110 syn match tctColonTODO /\<TODO\ze *:/ contained
111 hi tctColonDONE ctermfg=green
112 hi tctColonSOLVED ctermfg=green
113 hi tctColonTODO ctermfg=red
114
115 syn cluster tctBlock contains=tctPath,tctSection
116
117 " Inline
118 syn match tctBold
119 \ /\(^\|[  `’«»/"|_,.:;@^!?=~%(){}[\]\\&+-]\)\zs\*[^ *]\([^*]*[^ *]\)\?\*\ze\([  `’«»/"|_,.:;@^!?=~%(){}[\]\\&+-]\|$\)/
120 \ contained contains=@tctInline
121 syn match tctCode
122 \ /\(^\|[  *’«»/"|_,.:;@^!?=~%(){}[\]\\&+-]\)\zs`[^ `]\([^`]*[^ `]\)\?`\ze\([  *’«»/"|_,.:;@^!?=~%(){}[\]\\&+-]\|$\)/
123 \ contained contains=@tctInline
124 syn match tctE
125 \ /<\/\?[^ >]\+\/\?>/
126 \ contained contains=tctESym,tctEAttr
127 syn match tctESym
128 \ /[</>]/
129 \ contained
130 syn match tctEAttr
131 \ / [^=]\+="[^"]*"/
132 \ contained
133 syn match tctQuoteFrench
134 \ /«.\{-}»/
135 \ contained contains=@tctInline
136 syn match tctItalic
137 \ /\(^\|[  *`’«»"'’|_,.:;@^!?=~<>%(){}[\]\\#&+-]\)\zs\/[^ /]\([^/]*[^ /]\)\?\/\ze\([  *`’«»"'’|_,.:;@^!?=~<>%(){}[\]\\#&+-]\|$\)/
138 \ contained contains=@tctInline
139 syn match tctQuote
140 \ /\(^\|[  *`’«»/'’|_,.:;@^!?=~<>%(){}[\]\\#&+-]\)\zs"[^ "]\([^"]*[^ "]\)\?"\ze\([  *`’«»/'’|_,.:;@^!?=~<>%(){}[\]\\#&+-]\|$\)/
141 \ contained contains=@tctInline
142 syn match tctTag
143 \ /\(^\|[  *`’«»/"'’|_,.:;@^!?=~<>%(){}[\]\&+-]\)\zs#\([^ #]\([^#]*[^ #]\)\?#\|[^ #]*[^# *`’«»/"'’|_,.:;@^!?=~<>%(){}[\]\&+-]\)\ze\([  *`’«»/"'’|_,.:;@^!?=~<>%(){}[\]\&+-]\|$\)/
144 \ contained contains=@tctInline
145 syn match tctUnderline
146 \ /\(^\|[  *`’«»/"'’|,.:;@!?=~<>%(){}[\]\\#&+-]\)\zs_.*_\ze\([  *`’«»/"'’|,.:;@!?=~<>%(){}[\]\\#&+-]\|$\)/
147 \ contained contains=@tctInline
148 syn match tctURL
149 \ /[a-z+-]\+:\/\/[^| \t[\]]*\(\[[^\]]*\]\)\?/
150 \ contained contains=tctURLText
151 syn match tctURLText
152 \ /\(\[\zs[^\]]*\ze\]\)\?/
153 \ contained contains=@tctInline
154 syn match tctEntity "&[^; \t]*;" contained contains=tctEntityPunct
155 syn match tctEntityPunct contained "[&.;]"
156 syn region tctElem
157 \ matchgroup=tctElem start=/<\ze[^ /!?<>"']/
158 \ matchgroup=tctElem end=/>/
159 \ contained contains=tctElemName,tctAttr,tctSymEqual,tctAttrValue
160 syn region tctElemEnd
161 \ matchgroup=tctElem start=/<\/\ze[^ /!?<>"']/
162 \ matchgroup=tctElem end=/>/
163 \ contained contains=tctElemName,tctAttrPunct
164 syn match tctNamespace
165 \ +\(<\|</\)\@2<=[^ /!?<>"':]\+\ze[:]+
166 \ contained
167 syn match tctElemName
168 \ /\(<\|<\/\)\@2<=[^ /!?<>"']\+/
169 \ contained contains=tctNamespace,tctAttrPunct
170 syn match tctAttr
171 \ +[-'"<]\@1<!\<[a-zA-Z:_][-.0-9a-zA-Z:_]*\>\%(['">]\@!\|$\)+
172 \ contained contains=tctAttrPunct
173 syn match tctAttrPunct +[:.]+ contained
174 syn region tctAttrValue contained start=+"+ end=+"+ contains=tctEntity
175 syn region tctAttrValue contained start=+'+ end=+'+ contains=tctEntity
176
177
178 syn cluster tctInline contains=tctBold,tctCode,tctElem,tctElemEnd,tctEntity,tctQuoteFrench,tctItalic,tctQuote,tctTag,tctUnderline,tctURL
179
180
181 hi def link tctAttr Type
182 hi def link tctAttrPunct Comment
183 hi tctBold cterm=bold gui=bold
184 hi tctCode cterm=reverse ctermfg=white gui=reverse
185 hi tctESym cterm=bold ctermfg=cyan guifg=cyan
186 hi def link tctEntity Statement
187 hi def link tctEntityPunct Type
188 hi tctItalic cterm=italic gui=italic
189 hi def link tctNamespace Tag
190 hi tctQuote cterm=bold ctermfg=cyan guifg=cyan
191 hi tctQuoteFrench cterm=bold ctermfg=green guifg=green
192 hi tctTag cterm=bold ctermfg=cyan guifg=cyan
193 hi def link tctElem Function
194 hi def link tctElemEnd Identifier
195 hi tctElemName cterm=bold ctermfg=yellow guifg=yellow
196 hi def link tctAttrValue String
197 hi def link tctTodo Todo
198 hi def link tctURL Macro
199 hi def link tctURLText tctNormal
200 hi tctUnderline cterm=underline gui=underline
201
202 let b:current_syntax = "tct"