Add ST3 syntax definition for EfficiOS AsciiDoc
[lttng-docs.git] / eos-adoc.sublime-syntax
1 %YAML 1.2
2 ---
3 # Copyright (c) 2018 Philippe Proulx <pproulx@efficios.com>
4 #
5 # This is a Sublime Text 3 syntax definition for the specific subset of
6 # AsciiDoc markup used for EfficiOS projects, namely:
7 #
8 # * The LTTng Documentation
9 # * The LTTng man pages
10 # * The Babeltrace man pages
11 #
12 # Permission is hereby granted, free of charge, to any person obtaining a copy
13 # of this software and associated documentation files (the "Software"), to deal
14 # in the Software without restriction, including without limitation the rights
15 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 # copies of the Software, and to permit persons to whom the Software is
17 # furnished to do so, subject to the following conditions:
18 #
19 # The above copyright notice and this permission notice shall be included in
20 # all copies or substantial portions of the Software.
21 #
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 # THE SOFTWARE.
29
30 name: EfficiOS AsciiDoc
31 file_extensions:
32 - asciidoc
33 - adoc
34 scope: source.eos-adoc
35 contexts:
36 main:
37 - include: comment-start
38 - include: include
39 - include: image
40 - include: set-adoc-attr
41 - include: man-heading
42 - include: section-id
43 - include: term-sig
44 - include: source-sig
45 - include: gen-role
46 - include: verse-sig
47 - include: gen-pre-sig
48 - include: admonition-sig
49 - include: internal-link-start
50 - include: external-link-start
51 - include: list-bullets
52 - include: block-sep
53 - include: dl
54 - include: inline
55 comment-start:
56 - match: '^/////*$'
57 push: comment
58 comment:
59 - meta_scope: comment.block.eos-adoc
60 - match: '^/////*$'
61 pop: true
62 include:
63 - match: '^include::.*$'
64 scope: constant.numeric.include.eos-adoc
65 image:
66 - match: '^image::.*$'
67 scope: constant.numeric.image.eos-adoc
68 man-heading:
69 - match: '^[A-Z][A-Z -]*$'
70 scope: keyword.control.conditional.heading.eos-adoc
71 push: man-heading-underline
72 man-heading-underline:
73 - match: '^-+$'
74 scope: keyword.control.conditional.heading.eos-adoc
75 pop: true
76 - match: '^~+$'
77 scope: keyword.control.conditional.heading.eos-adoc
78 pop: true
79 - match: '^$'
80 pop: true
81 section-id:
82 - match: '^\[\[[a-zA-Z0-9_-]+]]$'
83 scope: string.quoted.double.anchor.eos-adoc
84 push: heading-start
85 heading-start:
86 - match: '=+'
87 set: heading
88 - match: '^[^\[].*$'
89 scope: keyword.control.conditional.heading.eos-adoc
90 set: man-heading-underline
91 heading:
92 - meta_scope: keyword.control.conditional.heading.eos-adoc
93 - match: '$'
94 pop: true
95 term-sig:
96 - match: '^\[role="term"]$'
97 scope: constant.character.eos-adoc
98 push: term-start
99 term-start:
100 - match: '^-----*$'
101 set: term
102 term:
103 - meta_scope: comment.block.term.eos-adoc
104 - match: '^-----*$'
105 pop: true
106 source-sig:
107 - match: '^\[source,\s*\w+]$'
108 scope: constant.character.source.eos-adoc
109 push: source-title
110 source-title:
111 - match: '^\..+$'
112 set: source-start
113 - include: source-start
114 source-start:
115 - match: '^-----*$'
116 set: source
117 source:
118 - meta_scope: comment.block.eos-adoc
119 - match: '^-----*$'
120 pop: true
121 list-bullets:
122 - match: '^(\*|\.)+ '
123 scope: constant.character.escape.list-bullet.eos-adoc
124 dl:
125 - match: '::$'
126 scope: constant.character.escape.dl.eos-adoc
127 verse-sig:
128 - match: '^\[verse]$'
129 scope: constant.character.verse.eos-adoc
130 gen-role:
131 - match: '^\[role="[^"]+"]$'
132 scope: constant.character.gen-role.eos-adoc
133 gen-pre-sig:
134 - match: '^-----*$'
135 push: gen-pre
136 gen-pre:
137 - meta_scope: comment.block.gen-pre.eos-adoc
138 - match: '^-----*$'
139 pop: true
140 admonition-sig:
141 - match: '^\[(WARNING|IMPORTANT|NOTE)]$'
142 scope: constant.character.admonition.eos-adoc
143 block-sep:
144 - match: '^\+$'
145 scope: constant.character.escape.block-sep.eos-adoc
146 inline:
147 - include: external-link-start
148 - include: external-link-expl-start
149 - include: internal-link-start
150 - include: nbsp
151 - include: em-dash
152 - include: word-macro
153 - include: lttng-docs-opt
154 - include: lttng-docs-path
155 - include: lttng-docs-dir
156 - include: lttng-docs-env
157 - include: lttng-docs-cmd
158 - include: man
159 - include: man-opt
160 - include: man-nlopt
161 - include: man-genopt
162 - include: man-bt-compcls
163 - include: man-bt-manparam
164 - include: man-bt-manopt
165 - include: adoc-attr
166 - include: code-backtick-start
167 - include: code-plus-start
168 - include: double-emphasis-start
169 - include: emphasis-start
170 - include: emphasis-quote
171 - include: strong-start
172 - include: escape-adoc-start
173 - include: anchor
174 nbsp:
175 - match: '\{nbsp}'
176 scope: comment.block.nbsp.eos-adoc
177 em-dash:
178 - match: '(?<!^)--(?!$)'
179 scope: comment.block.em-dash.eos-adoc
180 word-macro:
181 - match: ':(not|escwc|esccomma|escstar|escdot|bs):'
182 scope: entity.name.tag.not.eos-adoc
183 internal-link-start:
184 - match: '(<<)([a-zA-Z0-9_-]+),'
185 captures:
186 1: entity.name.function.link.eos-adoc
187 2: storage.modifier.c
188 push: internal-link
189 internal-link:
190 - meta_scope: int-link.eos-adoc
191 - match: '"'
192 set: internal-link-text
193 - match: '>>'
194 scope: entity.name.function.link.eos-adoc
195 pop: true
196 - include: inline
197 internal-link-text:
198 - meta_scope: string.quoted.double.int-link-text.eos-adoc
199 - match: '"'
200 pop: true
201 external-link-start:
202 - match: '(https?://.*?)\['
203 captures:
204 1: storage.modifier.c
205 push: external-link
206 external-link:
207 - meta_scope: ext-link.eos-adoc
208 - match: ']'
209 pop: true
210 - include: inline
211 external-link-expl-start:
212 - match: 'link:([^]]+)\['
213 captures:
214 1: storage.modifier.c
215 push: external-link-expl
216 external-link-expl:
217 - meta_scope: ext-link.eos-adoc
218 - match: ']'
219 pop: true
220 - include: inline
221 lttng-docs-opt:
222 - match: 'opt:(lttng[a-zA-Z-]*\([a-zA-Z0-9]+\)):(--?[a-zA-Z0-9_-]+)'
223 scope: entity.name.function.opt.eos-adoc
224 captures:
225 1: storage.modifier.c
226 2: storage.modifier.c
227 lttng-docs-path:
228 - match: 'path:\{(.+)}'
229 scope: entity.name.function.path.eos-adoc
230 captures:
231 1: storage.modifier.c
232 lttng-docs-dir:
233 - match: 'dir:\{(.+)}'
234 scope: entity.name.function.dir.eos-adoc
235 captures:
236 1: storage.modifier.c
237 lttng-docs-env:
238 - match: 'env:([a-zA-Z0-9_]+)'
239 scope: entity.name.function.env.eos-adoc
240 captures:
241 1: storage.modifier.c
242 lttng-docs-cmd:
243 - match: 'cmd:([a-zA-Z0-9_-]+)'
244 scope: entity.name.function.cmd.eos-adoc
245 captures:
246 1: storage.modifier.c
247 man:
248 - match: 'man:([a-zA-Z0-9_.-]+\([a-zA-Z0-9]+\))'
249 scope: entity.name.function.man.eos-adoc
250 captures:
251 1: storage.modifier.c
252 man-opt:
253 - match: 'opt(?:ion)?:(--?[a-zA-Z0-9_-]+)'
254 scope: entity.name.function.opt.eos-adoc
255 captures:
256 1: storage.modifier.c
257 man-nlopt:
258 - match: 'nlopt(?:ion)?:(--?[a-zA-Z0-9_-]+)'
259 scope: entity.name.function.nlopt.eos-adoc
260 captures:
261 1: storage.modifier.c
262 man-genopt:
263 - match: 'genopt(?:ion)?:(--?[a-zA-Z0-9_-]+)'
264 scope: entity.name.function.genopt.eos-adoc
265 captures:
266 1: storage.modifier.c
267 man-bt-compcls:
268 - match: 'compcls:(src|source|flt|filter|sink)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)'
269 scope: entity.name.function.opt.eos-adoc
270 captures:
271 1: storage.modifier.c
272 2: storage.modifier.c
273 3: storage.modifier.c
274 man-bt-manparam:
275 - match: 'manparam:(src|source|flt|filter|sink)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)'
276 scope: entity.name.function.opt.eos-adoc
277 captures:
278 1: storage.modifier.c
279 2: storage.modifier.c
280 3: storage.modifier.c
281 4: storage.modifier.c
282 man-bt-manopt:
283 - match: 'manopt:([a-zA-Z0-9_.-]+\([a-zA-Z0-9]+\)):(--?[a-zA-Z0-9_-]+)'
284 scope: entity.name.function.opt.eos-adoc
285 captures:
286 1: storage.modifier.c
287 2: storage.modifier.c
288 code-backtick-start:
289 - match: '`(?!\s)'
290 push: code-backtick
291 code-backtick:
292 - meta_scope: entity.name.function.code.eos-adoc
293 - match: '(?<!\s)`'
294 pop: true
295 code-plus-start:
296 - match: '\+(?!\{)'
297 push: code-plus
298 code-plus:
299 - meta_scope: entity.name.function.code.eos-adoc
300 - match: '(?<!\s)\+'
301 pop: true
302 - match: '$'
303 pop: true
304 - match: '__.+?__'
305 scope: storage.modifier.c
306 double-emphasis-start:
307 - match: '__(?!\s)'
308 push: double-emphasis
309 double-emphasis:
310 - meta_scope: entity.name.function.double-em.eos-adoc
311 - match: '(?<!\s)__'
312 pop: true
313 - include: inline
314 emphasis-start:
315 - match: '(?<![A-Za-z0-9_])_(?!\s)'
316 push: emphasis
317 emphasis:
318 - meta_scope: entity.name.function.em.eos-adoc
319 - match: '(?<!\s)_'
320 pop: true
321 - include: inline
322 emphasis-quote:
323 - match: "'[^']+'"
324 scope: entity.name.function.em-quote.eos-adoc
325 strong-start:
326 - match: '\*\*(?!\s)'
327 push: strong
328 strong:
329 - meta_scope: entity.name.function.strong.eos-adoc
330 - match: '(?<!\s)\*\*'
331 pop: true
332 - include: inline
333 escape-adoc-start:
334 - match: '\$\$(?!\s)'
335 push: escape-adoc
336 escape-adoc:
337 - meta_scope: entity.name.function.escape-adoc.eos-adoc
338 - match: '(?<!\s)\$\$'
339 pop: true
340 anchor:
341 - match: \[\[[a-zA-Z0-9_-]+]]
342 scope: string.quoted.double.anchor.eos-adoc
343 adoc-attr:
344 - match: '\{[a-zA-Z0-9_-]+\}'
345 scope: entity.name.tag.eos-adoc
346 set-adoc-attr:
347 - match: '^:([a-zA-Z0-9_-]+):\s+'
348 captures:
349 1: constant.numeric.set-adoc-attr.eos-adoc
This page took 0.038998 seconds and 5 git commands to generate.