Bram Moolenaar | 543b7ef | 2013-06-01 14:50:56 +0200 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Syntax for Gprof Output |
| 3 | " Maintainer: Dominique Pelle <dominique.pelle@gmail.com> |
Bram Moolenaar | ec7944a | 2013-06-12 21:29:15 +0200 | [diff] [blame] | 4 | " Last Change: 2013 Jun 09 |
Bram Moolenaar | 543b7ef | 2013-06-01 14:50:56 +0200 | [diff] [blame] | 5 | |
| 6 | " Quit when a syntax file was already loaded |
| 7 | if exists("b:current_syntax") |
| 8 | finish |
| 9 | endif |
| 10 | let s:keepcpo= &cpo |
| 11 | set cpo&vim |
| 12 | |
| 13 | syn case match |
| 14 | syn sync minlines=100 |
| 15 | |
| 16 | " Flat profile |
| 17 | syn match gprofFlatProfileTitle |
| 18 | \ "^Flat profile:$" |
| 19 | syn region gprofFlatProfileHeader |
| 20 | \ start="^Each sample counts as.*" |
| 21 | \ end="^ time.*name\s*$" |
| 22 | syn region gprofFlatProfileTrailer |
| 23 | \ start="^\s*%\s\+the percentage of the total running time.*" |
| 24 | \ end="^\s*the gprof listing if it were to be printed\." |
| 25 | |
| 26 | " Call graph |
| 27 | syn match gprofCallGraphTitle "Call graph (explanation follows)" |
| 28 | syn region gprofCallGraphHeader |
| 29 | \ start="^granularity: each sample hit covers.*" |
| 30 | \ end="^\s*index % time\s\+self\s\+children\s\+called\s\+name$" |
| 31 | syn match gprofCallGraphFunction "\s\+\(\d\+\.\d\+\s\+\)\{3}\([0-9+]\+\)\?\s\+[a-zA-Z_<].*\ze\[" |
| 32 | syn match gprofCallGraphSeparator "^-\+$" |
| 33 | syn region gprofCallGraphTrailer |
| 34 | \ start="This table describes the call tree of the program" |
Bram Moolenaar | ec7944a | 2013-06-12 21:29:15 +0200 | [diff] [blame] | 35 | \ end="^\s*the cycle\.$" |
Bram Moolenaar | 543b7ef | 2013-06-01 14:50:56 +0200 | [diff] [blame] | 36 | |
| 37 | " Index |
| 38 | syn region gprofIndex |
| 39 | \ start="^Index by function name$" |
| 40 | \ end="\%$" |
| 41 | |
| 42 | syn match gprofIndexFunctionTitle "^Index by function name$" |
| 43 | |
| 44 | syn match gprofNumbers "^\s\+[0-9 ./+]\+" |
| 45 | syn match gprofFunctionIndex "\[\d\+\]" |
| 46 | syn match gprofSpecial "<\(spontaneous\|cycle \d\+\)>" |
| 47 | |
| 48 | hi def link gprofFlatProfileTitle Title |
| 49 | hi def link gprofFlatProfileHeader Comment |
| 50 | hi def link gprofFlatProfileFunction Number |
| 51 | hi def link gprofFlatProfileTrailer Comment |
| 52 | |
| 53 | hi def link gprofCallGraphTitle Title |
| 54 | hi def link gprofCallGraphHeader Comment |
| 55 | hi def link gprofFlatProfileFunction Number |
| 56 | hi def link gprofCallGraphFunction Special |
| 57 | hi def link gprofCallGraphTrailer Comment |
| 58 | hi def link gprofCallGraphSeparator Label |
| 59 | |
| 60 | hi def link gprofFunctionIndex Label |
| 61 | hi def link gprofSpecial SpecialKey |
| 62 | hi def link gprofNumbers Number |
| 63 | |
| 64 | hi def link gprofIndexFunctionTitle Title |
| 65 | |
| 66 | let b:current_syntax = "gprof" |
| 67 | |
| 68 | let &cpo = s:keepcpo |
| 69 | unlet s:keepcpo |