xref: /vim-8.2.3635/runtime/syntax/dot.vim (revision 125ed274)
1" Language:     Dot
2" Filenames:    *.dot
3" Maintainer:   Markus Mottl  <[email protected]>
4" URL:          http://www.ocaml.info/vim/syntax/dot.vim
5" Last Change:  2021 Mar 24 - better attr + escape string matching, new keywords (Farbod Salamat-Zadeh)
6"               2011 May 17 - improved identifier matching + two new keywords
7"               2001 May 04 - initial version
8
9" For version 5.x: Clear all syntax items
10" For version 6.x: Quit when a syntax file was already loaded
11if version < 600
12  syntax clear
13elseif exists("b:current_syntax")
14  finish
15endif
16
17let s:keepcpo = &cpo
18set cpo&vim
19
20" Errors
21syn match    dotParErr     ")"
22syn match    dotBrackErr   "]"
23syn match    dotBraceErr   "}"
24
25" Enclosing delimiters
26syn region   dotEncl transparent matchgroup=dotParEncl start="(" matchgroup=dotParEncl end=")" contains=ALLBUT,dotParErr
27syn region   dotEncl transparent matchgroup=dotBrackEncl start="\[" matchgroup=dotBrackEncl end="\]" contains=ALLBUT,dotBrackErr
28syn region   dotEncl transparent matchgroup=dotBraceEncl start="{" matchgroup=dotBraceEncl end="}" contains=ALLBUT,dotBraceErr
29
30" Comments
31syn region   dotComment start="//" end="$" contains=dotComment,dotTodo
32syn region   dotComment start="/\*" end="\*/" contains=dotComment,dotTodo
33syn keyword  dotTodo contained TODO FIXME XXX
34
35" Strings
36syn region   dotString    start=+"+ skip=+\\\\\|\\"+ end=+"+
37
38" Escape strings
39syn match    dotEscString /\v\\(N|G|E|T|H|L)/ containedin=dotString
40syn match    dotEscString /\v\\(n|l|r)/       containedin=dotString
41
42" General keywords
43syn keyword  dotKeyword graph digraph subgraph node edge strict
44
45" Node, edge and graph attributes
46syn keyword  dotType _background area arrowhead arrowsize arrowtail bb bgcolor
47      \ center charset class clusterrank color colorscheme comment compound
48      \ concentrate constraint Damping decorate defaultdist dim dimen dir
49      \ diredgeconstraints distortion dpi edgehref edgetarget edgetooltip
50      \ edgeURL epsilon esep fillcolor fixedsize fontcolor fontname fontnames
51      \ fontpath fontsize forcelabels gradientangle group head_lp headclip
52      \ headhref headlabel headport headtarget headtooltip headURL height href
53      \ id image imagepath imagepos imagescale inputscale K label label_scheme
54      \ labelangle labeldistance labelfloat labelfontcolor labelfontname
55      \ labelfontsize labelhref labeljust labelloc labeltarget labeltooltip
56      \ labelURL landscape layer layerlistsep layers layerselect layersep
57      \ layout len levels levelsgap lhead lheight lp ltail lwidth margin
58      \ maxiter mclimit mindist minlen mode model mosek newrank nodesep
59      \ nojustify normalize notranslate nslimit nslimit1 ordering orientation
60      \ outputorder overlap overlap_scaling overlap_shrink pack packmode pad
61      \ page pagedir pencolor penwidth peripheries pin pos quadtree quantum
62      \ rank rankdir ranksep ratio rects regular remincross repulsiveforce
63      \ resolution root rotate rotation samehead sametail samplepoints scale
64      \ searchsize sep shape shapefile showboxes sides size skew smoothing
65      \ sortv splines start style stylesheet tail_lp tailclip tailhref
66      \ taillabel tailport tailtarget tailtooltip tailURL target tooltip
67      \ truecolor URL vertices viewport voro_margin weight width xdotversion
68      \ xlabel xlp z
69
70" Special chars
71syn match    dotKeyChar  "="
72syn match    dotKeyChar  ";"
73syn match    dotKeyChar  "->"
74syn match    dotKeyChar  "--"
75
76" Identifier
77syn match    dotIdentifier /\<\w\+\(:\w\+\)\?\>/
78
79" Synchronization
80syn sync minlines=50
81syn sync maxlines=500
82
83" Define the default highlighting.
84" For version 5.7 and earlier: only when not done already
85" For version 5.8 and later: only when an item doesn't have highlighting yet
86if version >= 508 || !exists("did_dot_syntax_inits")
87  if version < 508
88    let did_dot_syntax_inits = 1
89    command -nargs=+ HiLink hi link <args>
90  else
91    command -nargs=+ HiLink hi def link <args>
92  endif
93
94  HiLink dotParErr	 Error
95  HiLink dotBraceErr	 Error
96  HiLink dotBrackErr	 Error
97
98  HiLink dotComment	 Comment
99  HiLink dotTodo	 Todo
100
101  HiLink dotParEncl	 Keyword
102  HiLink dotBrackEncl	 Keyword
103  HiLink dotBraceEncl	 Keyword
104
105  HiLink dotKeyword	 Keyword
106  HiLink dotType	 Type
107  HiLink dotKeyChar	 Keyword
108
109  HiLink dotString	 String
110  HiLink dotEscString	 Keyword
111  HiLink dotIdentifier	 Identifier
112
113  delcommand HiLink
114endif
115
116let b:current_syntax = "dot"
117
118let &cpo = s:keepcpo
119unlet s:keepcpo
120
121" vim: ts=8
122