Bram Moolenaar | 2346a63 | 2021-06-13 19:02:49 +0200 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Graphviz program |
| 3 | " Maintainer: Matthew Fernandez <matthew.fernandez@gmail.com> |
| 4 | " Last Change: Tue, 28 Jul 2020 17:20:44 -0700 |
| 5 | |
| 6 | if exists("b:current_syntax") |
| 7 | finish |
| 8 | endif |
| 9 | |
| 10 | let s:cpo_save = &cpo |
| 11 | set cpo&vim |
| 12 | |
| 13 | syn keyword gvArg ARGC ARGV |
| 14 | syn keyword gvBeg BEGIN BEG_G N E END END_G |
| 15 | syn keyword gvFunc |
| 16 | \ graph fstsubg isDirect isStrict isSubg nEdges nNodes nxtsubg subg |
| 17 | \ degreeOf fstnode indegreeOf isNode isSubnode node nxtnode nxtnode_sg |
| 18 | \ outDegreeOf subnode |
| 19 | \ edge edge_sg fstedge fstedge_sg fstin fstin_sg fstout fstout_sg isEdge |
| 20 | \ isEdge_sg isSubedge nxtedge nxtedge_sg nxtin nxtin_sg nxtout nxtout_sg opp |
| 21 | \ subedge |
| 22 | \ freadG fwriteG readG write[] writeG |
| 23 | \ aget aset clone cloneG compOf copy[] copyA delete[] fstAttr getDflt hasAttr |
| 24 | \ induce isAttr isIn kindOf lock[] nxtAttr setDflt |
| 25 | \ canon gsub html index ishtml length llOf match[] rindex split[] sprintf |
| 26 | \ sscanf strcmp sub substr tokens tolower toupper urOf xOf yOf |
| 27 | \ closeF openF print[] printf scanf readL |
| 28 | \ atan2 cos exp log MAX MIN pow sin[] sqrt |
| 29 | \ in[] unset |
| 30 | \ colorx exit[] rand srand system |
| 31 | syn keyword gvCons |
| 32 | \ NULL TV_bfs TV_dfs TV_en TV_flat TV_fwd TV_ne TV_prepostdfs TV_prepostfwd |
| 33 | \ TV_prepostrev TV_postdfs TV_postfwd tv_postrev TV_rev |
| 34 | syn keyword gvType char double float int long unsigned void |
| 35 | \ string |
| 36 | \ edge_t graph_t node_t obj_t |
| 37 | syn match gvVar |
| 38 | \ "\$\(\(F\|G\|NG\|O\|T\|tgtname\|tvedge\|tvnext\|tvroot\|tvtype\)\>\)\?\(\<\)\@!" |
| 39 | syn keyword gvWord break continue else for forr if return switch while |
| 40 | |
| 41 | " numbers adapted from c.vim's cNumbers and friends |
| 42 | syn match gvNums transparent "\<\d\|\.\d" contains=gvNumber,gvFloat,gvOctal |
| 43 | syn match gvNumber contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>" |
| 44 | syn match gvNumber contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>" |
| 45 | syn match gvOctal contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=gvOctalZero |
| 46 | syn match gvOctalZero contained "\<0" |
| 47 | syn match gvFloat contained "\d\+f" |
| 48 | syn match gvFloat contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=" |
| 49 | syn match gvFloat contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" |
| 50 | syn match gvFloat contained "\d\+e[-+]\=\d\+[fl]\=\>" |
| 51 | |
| 52 | syn region gvString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=gvFormat,gvSpecial extend |
| 53 | syn region gvString start="'" skip="\\\\\|\\'" end="'" contains=gvFormat,gvSpecial extend |
| 54 | |
| 55 | " adapted from c.vim's cFormat for c_no_c99 |
| 56 | syn match gvFormat "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained |
| 57 | |
| 58 | syn match gvSpecial "\\." contained |
| 59 | |
| 60 | syn region gvCComment start="//" skip="\\$" end="$" keepend |
| 61 | syn region gvCPPComment start="#" skip="\\$" end="$" keepend |
| 62 | syn region gvCXXComment start="/\*" end="\*/" fold |
| 63 | |
| 64 | hi def link gvArg Identifier |
| 65 | hi def link gvBeg Keyword |
| 66 | hi def link gvFloat Number |
| 67 | hi def link gvFunc Identifier |
| 68 | hi def link gvCons Number |
| 69 | hi def link gvNumber Number |
| 70 | hi def link gvType Type |
| 71 | hi def link gvVar Statement |
| 72 | hi def link gvWord Keyword |
| 73 | |
| 74 | hi def link gvString String |
| 75 | hi def link gvFormat Special |
| 76 | hi def link gvSpecial Special |
| 77 | |
| 78 | hi def link gvCComment Comment |
| 79 | hi def link gvCPPComment Comment |
| 80 | hi def link gvCXXComment Comment |
| 81 | |
| 82 | let b:current_syntax = "gvpr" |
| 83 | |
| 84 | let &cpo = s:cpo_save |
| 85 | unlet s:cpo_save |