summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/mermaid.vim
blob: afdbcc3d62089800dd24fbe9660a69aa95c6f35e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
" Vim syntax file
" Language:     Mermaid
" Maintainer:   Craig MacEahern <https://github.com/craigmac/vim-mermaid>
" Filenames:    *.mmd
" Last Change:  2022 Nov 22

if exists("b:current_syntax")
  finish
endif

let s:cpo_save = &cpo
set cpo&vim

syntax iskeyword @,48-57,192-255,$,_,-,:
syntax keyword mermaidKeyword
	\ _blank
	\ _self
	\ _parent
	\ _top
	\ ::icon
	\ accDescr
	\ accTitle
	\ actor
	\ activate
	\ alt
	\ and
	\ as
	\ autonumber
	\ branch
	\ break
	\ callback
	\ checkout
	\ class
	\ classDef
	\ classDiagram
	\ click
	\ commit
	\ commitgitGraph
	\ critical
	\ dataFormat
	\ dateFormat
	\ deactivate
	\ direction
	\ element
	\ else
	\ end
	\ erDiagram
	\ flowchart
	\ gantt
	\ gitGraph
	\ graph
	\ journey
	\ link
	\ LR
	\ TD
	\ TB
	\ RL
	\ loop
	\ merge
	\ mindmap root
	\ Note
	\ Note right of
	\ Note left of
	\ Note over
	\ note
	\ note right of
	\ note left of
	\ note over
	\ opt
	\ option
	\ par
	\ participant
	\ pie
	\ rect
	\ requirement
	\ rgb
	\ section
	\ sequenceDiagram
	\ state
	\ stateDiagram
	\ stateDiagram-v2
	\ style
	\ subgraph
	\ title
highlight link mermaidKeyword Keyword

syntax match mermaidStatement "|"
syntax match mermaidStatement "--\?[>x)]>\?+\?-\?"
syntax match mermaidStatement "\~\~\~"
syntax match mermaidStatement "--"
syntax match mermaidStatement "---"
syntax match mermaidStatement "-->"
syntax match mermaidStatement "-\."
syntax match mermaidStatement "\.->"
syntax match mermaidStatement "-\.-"
syntax match mermaidStatement "-\.\.-"
syntax match mermaidStatement "-\.\.\.-"
syntax match mermaidStatement "=="
syntax match mermaidStatement "==>"
syntax match mermaidStatement "===>"
syntax match mermaidStatement "====>"
syntax match mermaidStatement "&"
syntax match mermaidStatement "--o"
syntax match mermaidStatement "--x"
syntax match mermaidStatement "x--x"
syntax match mermaidStatement "-----"
syntax match mermaidStatement "---->"
syntax match mermaidStatement "==="
syntax match mermaidStatement "===="
syntax match mermaidStatement "====="
syntax match mermaidStatement ":::"
syntax match mermaidStatement "<|--"
syntax match mermaidStatement "\*--"
syntax match mermaidStatement "o--"
syntax match mermaidStatement "o--o"
syntax match mermaidStatement "<--"
syntax match mermaidStatement "<-->"
syntax match mermaidStatement "\.\."
syntax match mermaidStatement "<\.\."
syntax match mermaidStatement "<|\.\."
syntax match mermaidStatement "--|>"
syntax match mermaidStatement "--\*"
syntax match mermaidStatement "--o"
syntax match mermaidStatement "\.\.>"
syntax match mermaidStatement "\.\.|>"
syntax match mermaidStatement "<|--|>"
syntax match mermaidStatement "||--o{"
highlight link mermaidStatement Statement

syntax match mermaidIdentifier "[\+-]\?\w\+(.*)[\$\*]\?"
highlight link mermaidIdentifier Identifier

syntax match mermaidType "[\+-\#\~]\?\cint\>"
syntax match mermaidType "[\+-\#\~]\?\cString\>"
syntax match mermaidType "[\+-\#\~]\?\cbool\>"
syntax match mermaidType "[\+-\#\~]\?\cBigDecimal\>"
syntax match mermaidType "[\+-\#\~]\?\cList\~.\+\~"
syntax match mermaidType "<<\w\+>>"
highlight link mermaidType Type

syntax match mermaidComment "%%.*$"
highlight link mermaidComment Comment

syntax region mermaidDirective start="%%{" end="\}%%"
highlight link mermaidDirective PreProc

syntax region mermaidString start=/"/ skip=/\\"/ end=/"/
highlight link mermaidString String

let b:current_syntax = "mermaid"

let &cpo = s:cpo_save
unlet s:cpo_save

" vim:set sw=2: