blob: 68a0f57a98b59d5dcd6934eb5fde5137955460f9 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Language: Dot
2" Filenames: *.dot
Bram Moolenaar8b6144b2006-02-08 09:20:24 +00003" Maintainer: Markus Mottl <markus.mottl@gmail.com>
4" URL: http://www.ocaml.info/vim/syntax/dot.vim
Bram Moolenaardad44732021-03-31 20:07:33 +02005" 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
Bram Moolenaar5eb86f92004-07-26 12:53:41 +00007" 2001 May 04 - initial version
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
Bram Moolenaardad44732021-03-31 20:07:33 +02009" 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")
Bram Moolenaar071d4272004-06-13 20:20:40 +000014 finish
15endif
16
Bram Moolenaardad44732021-03-31 20:07:33 +020017let s:keepcpo = &cpo
18set cpo&vim
19
Bram Moolenaar071d4272004-06-13 20:20:40 +000020" 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
Bram Moolenaardad44732021-03-31 20:07:33 +020038" Escape strings
39syn match dotEscString /\v\\(N|G|E|T|H|L)/ containedin=dotString
40syn match dotEscString /\v\\(n|l|r)/ containedin=dotString
41
Bram Moolenaar071d4272004-06-13 20:20:40 +000042" General keywords
Bram Moolenaardad44732021-03-31 20:07:33 +020043syn keyword dotKeyword graph digraph subgraph node edge strict
Bram Moolenaar071d4272004-06-13 20:20:40 +000044
Bram Moolenaardad44732021-03-31 20:07:33 +020045" 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000069
70" Special chars
71syn match dotKeyChar "="
72syn match dotKeyChar ";"
73syn match dotKeyChar "->"
Bram Moolenaardad44732021-03-31 20:07:33 +020074syn match dotKeyChar "--"
Bram Moolenaar071d4272004-06-13 20:20:40 +000075
76" Identifier
Bram Moolenaar20f90cf2011-05-19 12:22:51 +020077syn match dotIdentifier /\<\w\+\(:\w\+\)\?\>/
Bram Moolenaar071d4272004-06-13 20:20:40 +000078
79" Synchronization
80syn sync minlines=50
81syn sync maxlines=500
82
83" Define the default highlighting.
Bram Moolenaardad44732021-03-31 20:07:33 +020084" 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000093
Bram Moolenaardad44732021-03-31 20:07:33 +020094 HiLink dotParErr Error
95 HiLink dotBraceErr Error
96 HiLink dotBrackErr Error
Bram Moolenaar071d4272004-06-13 20:20:40 +000097
Bram Moolenaardad44732021-03-31 20:07:33 +020098 HiLink dotComment Comment
99 HiLink dotTodo Todo
Bram Moolenaar071d4272004-06-13 20:20:40 +0000100
Bram Moolenaardad44732021-03-31 20:07:33 +0200101 HiLink dotParEncl Keyword
102 HiLink dotBrackEncl Keyword
103 HiLink dotBraceEncl Keyword
Bram Moolenaar071d4272004-06-13 20:20:40 +0000104
Bram Moolenaardad44732021-03-31 20:07:33 +0200105 HiLink dotKeyword Keyword
106 HiLink dotType Type
107 HiLink dotKeyChar Keyword
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108
Bram Moolenaardad44732021-03-31 20:07:33 +0200109 HiLink dotString String
110 HiLink dotEscString Keyword
111 HiLink dotIdentifier Identifier
Bram Moolenaar071d4272004-06-13 20:20:40 +0000112
Bram Moolenaardad44732021-03-31 20:07:33 +0200113 delcommand HiLink
114endif
Bram Moolenaar071d4272004-06-13 20:20:40 +0000115
116let b:current_syntax = "dot"
117
Bram Moolenaardad44732021-03-31 20:07:33 +0200118let &cpo = s:keepcpo
119unlet s:keepcpo
120
Bram Moolenaar071d4272004-06-13 20:20:40 +0000121" vim: ts=8