Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Dot |
| 3 | " Filenames: *.dot |
Bram Moolenaar | 8b6144b | 2006-02-08 09:20:24 +0000 | [diff] [blame] | 4 | " Maintainer: Markus Mottl <markus.mottl@gmail.com> |
| 5 | " URL: http://www.ocaml.info/vim/syntax/dot.vim |
| 6 | " Last Change: 2006 Feb 05 |
Bram Moolenaar | 5eb86f9 | 2004-07-26 12:53:41 +0000 | [diff] [blame] | 7 | " 2001 May 04 - initial version |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | |
| 9 | " For version 5.x: Clear all syntax items |
| 10 | " For version 6.x: Quit when a syntax file was already loaded |
| 11 | if version < 600 |
| 12 | syntax clear |
| 13 | elseif exists("b:current_syntax") |
| 14 | finish |
| 15 | endif |
| 16 | |
| 17 | " Errors |
| 18 | syn match dotParErr ")" |
| 19 | syn match dotBrackErr "]" |
| 20 | syn match dotBraceErr "}" |
| 21 | |
| 22 | " Enclosing delimiters |
| 23 | syn region dotEncl transparent matchgroup=dotParEncl start="(" matchgroup=dotParEncl end=")" contains=ALLBUT,dotParErr |
| 24 | syn region dotEncl transparent matchgroup=dotBrackEncl start="\[" matchgroup=dotBrackEncl end="\]" contains=ALLBUT,dotBrackErr |
| 25 | syn region dotEncl transparent matchgroup=dotBraceEncl start="{" matchgroup=dotBraceEncl end="}" contains=ALLBUT,dotBraceErr |
| 26 | |
| 27 | " Comments |
| 28 | syn region dotComment start="//" end="$" contains=dotComment,dotTodo |
| 29 | syn region dotComment start="/\*" end="\*/" contains=dotComment,dotTodo |
| 30 | syn keyword dotTodo contained TODO FIXME XXX |
| 31 | |
| 32 | " Strings |
| 33 | syn region dotString start=+"+ skip=+\\\\\|\\"+ end=+"+ |
| 34 | |
| 35 | " General keywords |
| 36 | syn keyword dotKeyword digraph node edge subgraph |
| 37 | |
| 38 | " Graph attributes |
| 39 | syn keyword dotType center layers margin mclimit name nodesep nslimit |
| 40 | syn keyword dotType ordering page pagedir rank rankdir ranksep ratio |
| 41 | syn keyword dotType rotate size |
| 42 | |
| 43 | " Node attributes |
| 44 | syn keyword dotType distortion fillcolor fontcolor fontname fontsize |
| 45 | syn keyword dotType height layer orientation peripheries regular |
| 46 | syn keyword dotType shape shapefile sides skew width |
| 47 | |
| 48 | " Edge attributes |
| 49 | syn keyword dotType arrowhead arrowsize arrowtail constraint decorateP |
| 50 | syn keyword dotType dir headclip headlabel labelangle labeldistance |
| 51 | syn keyword dotType labelfontcolor labelfontname labelfontsize |
| 52 | syn keyword dotType minlen port_label_distance samehead sametail |
| 53 | syn keyword dotType tailclip taillabel weight |
| 54 | |
| 55 | " Shared attributes (graphs, nodes, edges) |
| 56 | syn keyword dotType color |
| 57 | |
| 58 | " Shared attributes (graphs and edges) |
| 59 | syn keyword dotType bgcolor label URL |
| 60 | |
| 61 | " Shared attributes (nodes and edges) |
| 62 | syn keyword dotType fontcolor fontname fontsize layer style |
| 63 | |
| 64 | " Special chars |
| 65 | syn match dotKeyChar "=" |
| 66 | syn match dotKeyChar ";" |
| 67 | syn match dotKeyChar "->" |
| 68 | |
| 69 | " Identifier |
| 70 | syn match dotIdentifier /\<\w\+\>/ |
| 71 | |
| 72 | " Synchronization |
| 73 | syn sync minlines=50 |
| 74 | syn sync maxlines=500 |
| 75 | |
| 76 | " Define the default highlighting. |
| 77 | " For version 5.7 and earlier: only when not done already |
| 78 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 79 | if version >= 508 || !exists("did_dot_syntax_inits") |
| 80 | if version < 508 |
| 81 | let did_dot_syntax_inits = 1 |
| 82 | command -nargs=+ HiLink hi link <args> |
| 83 | else |
| 84 | command -nargs=+ HiLink hi def link <args> |
| 85 | endif |
| 86 | |
| 87 | HiLink dotParErr Error |
| 88 | HiLink dotBraceErr Error |
| 89 | HiLink dotBrackErr Error |
| 90 | |
| 91 | HiLink dotComment Comment |
| 92 | HiLink dotTodo Todo |
| 93 | |
| 94 | HiLink dotParEncl Keyword |
| 95 | HiLink dotBrackEncl Keyword |
| 96 | HiLink dotBraceEncl Keyword |
| 97 | |
| 98 | HiLink dotKeyword Keyword |
| 99 | HiLink dotType Type |
| 100 | HiLink dotKeyChar Keyword |
| 101 | |
| 102 | HiLink dotString String |
| 103 | HiLink dotIdentifier Identifier |
| 104 | |
| 105 | delcommand HiLink |
| 106 | endif |
| 107 | |
| 108 | let b:current_syntax = "dot" |
| 109 | |
| 110 | " vim: ts=8 |