Bram Moolenaar | b59ae59 | 2022-11-23 23:46:31 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Mermaid |
| 3 | " Maintainer: Craig MacEahern <https://github.com/craigmac/vim-mermaid> |
| 4 | " Filenames: *.mmd |
| 5 | " Last Change: 2022 Nov 22 |
| 6 | |
| 7 | if exists("b:current_syntax") |
| 8 | finish |
| 9 | endif |
| 10 | |
| 11 | let s:cpo_save = &cpo |
| 12 | set cpo&vim |
| 13 | |
| 14 | syntax iskeyword @,48-57,192-255,$,_,-,: |
| 15 | syntax keyword mermaidKeyword |
| 16 | \ _blank |
| 17 | \ _self |
| 18 | \ _parent |
| 19 | \ _top |
| 20 | \ ::icon |
| 21 | \ accDescr |
| 22 | \ accTitle |
| 23 | \ actor |
| 24 | \ activate |
| 25 | \ alt |
| 26 | \ and |
| 27 | \ as |
| 28 | \ autonumber |
| 29 | \ branch |
| 30 | \ break |
| 31 | \ callback |
| 32 | \ checkout |
| 33 | \ class |
| 34 | \ classDef |
| 35 | \ classDiagram |
| 36 | \ click |
| 37 | \ commit |
| 38 | \ commitgitGraph |
| 39 | \ critical |
| 40 | \ dataFormat |
| 41 | \ dateFormat |
| 42 | \ deactivate |
| 43 | \ direction |
| 44 | \ element |
| 45 | \ else |
| 46 | \ end |
| 47 | \ erDiagram |
| 48 | \ flowchart |
| 49 | \ gantt |
| 50 | \ gitGraph |
| 51 | \ graph |
| 52 | \ journey |
| 53 | \ link |
| 54 | \ LR |
| 55 | \ TD |
| 56 | \ TB |
| 57 | \ RL |
| 58 | \ loop |
| 59 | \ merge |
| 60 | \ mindmap root |
| 61 | \ Note |
| 62 | \ Note right of |
| 63 | \ Note left of |
| 64 | \ Note over |
| 65 | \ note |
| 66 | \ note right of |
| 67 | \ note left of |
| 68 | \ note over |
| 69 | \ opt |
| 70 | \ option |
| 71 | \ par |
| 72 | \ participant |
| 73 | \ pie |
| 74 | \ rect |
| 75 | \ requirement |
| 76 | \ rgb |
| 77 | \ section |
| 78 | \ sequenceDiagram |
| 79 | \ state |
| 80 | \ stateDiagram |
| 81 | \ stateDiagram-v2 |
| 82 | \ style |
| 83 | \ subgraph |
| 84 | \ title |
| 85 | highlight link mermaidKeyword Keyword |
| 86 | |
| 87 | syntax match mermaidStatement "|" |
| 88 | syntax match mermaidStatement "--\?[>x)]>\?+\?-\?" |
| 89 | syntax match mermaidStatement "\~\~\~" |
| 90 | syntax match mermaidStatement "--" |
| 91 | syntax match mermaidStatement "---" |
| 92 | syntax match mermaidStatement "-->" |
| 93 | syntax match mermaidStatement "-\." |
| 94 | syntax match mermaidStatement "\.->" |
| 95 | syntax match mermaidStatement "-\.-" |
| 96 | syntax match mermaidStatement "-\.\.-" |
| 97 | syntax match mermaidStatement "-\.\.\.-" |
| 98 | syntax match mermaidStatement "==" |
| 99 | syntax match mermaidStatement "==>" |
| 100 | syntax match mermaidStatement "===>" |
| 101 | syntax match mermaidStatement "====>" |
| 102 | syntax match mermaidStatement "&" |
| 103 | syntax match mermaidStatement "--o" |
| 104 | syntax match mermaidStatement "--x" |
| 105 | syntax match mermaidStatement "x--x" |
| 106 | syntax match mermaidStatement "-----" |
| 107 | syntax match mermaidStatement "---->" |
| 108 | syntax match mermaidStatement "===" |
| 109 | syntax match mermaidStatement "====" |
| 110 | syntax match mermaidStatement "=====" |
| 111 | syntax match mermaidStatement ":::" |
| 112 | syntax match mermaidStatement "<|--" |
| 113 | syntax match mermaidStatement "\*--" |
| 114 | syntax match mermaidStatement "o--" |
| 115 | syntax match mermaidStatement "o--o" |
| 116 | syntax match mermaidStatement "<--" |
| 117 | syntax match mermaidStatement "<-->" |
| 118 | syntax match mermaidStatement "\.\." |
| 119 | syntax match mermaidStatement "<\.\." |
| 120 | syntax match mermaidStatement "<|\.\." |
| 121 | syntax match mermaidStatement "--|>" |
| 122 | syntax match mermaidStatement "--\*" |
| 123 | syntax match mermaidStatement "--o" |
| 124 | syntax match mermaidStatement "\.\.>" |
| 125 | syntax match mermaidStatement "\.\.|>" |
| 126 | syntax match mermaidStatement "<|--|>" |
| 127 | syntax match mermaidStatement "||--o{" |
| 128 | highlight link mermaidStatement Statement |
| 129 | |
| 130 | syntax match mermaidIdentifier "[\+-]\?\w\+(.*)[\$\*]\?" |
| 131 | highlight link mermaidIdentifier Identifier |
| 132 | |
| 133 | syntax match mermaidType "[\+-\#\~]\?\cint\>" |
| 134 | syntax match mermaidType "[\+-\#\~]\?\cString\>" |
| 135 | syntax match mermaidType "[\+-\#\~]\?\cbool\>" |
| 136 | syntax match mermaidType "[\+-\#\~]\?\cBigDecimal\>" |
| 137 | syntax match mermaidType "[\+-\#\~]\?\cList\~.\+\~" |
| 138 | syntax match mermaidType "<<\w\+>>" |
| 139 | highlight link mermaidType Type |
| 140 | |
| 141 | syntax match mermaidComment "%%.*$" |
| 142 | highlight link mermaidComment Comment |
| 143 | |
| 144 | syntax region mermaidDirective start="%%{" end="\}%%" |
| 145 | highlight link mermaidDirective PreProc |
| 146 | |
| 147 | syntax region mermaidString start=/"/ skip=/\\"/ end=/"/ |
| 148 | highlight link mermaidString String |
| 149 | |
| 150 | let b:current_syntax = "mermaid" |
| 151 | |
| 152 | let &cpo = s:cpo_save |
| 153 | unlet s:cpo_save |
| 154 | |
| 155 | " vim:set sw=2: |