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