]> sourceware.org Git - systemtap.git/blob - vim/syntax/stap.vim
2006-01-16 Josh Stone <joshua.i.stone@intel.com>
[systemtap.git] / vim / syntax / stap.vim
1 " Vim syntax file
2 " Language: SystemTap
3 " Maintainer: Josh Stone <joshua.i.stone@intel.com>
4 " Last Change: 2005 Dec 20
5
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
8 if version < 600
9 syn clear
10 elseif exists("b:current_syntax")
11 finish
12 endif
13
14 syn keyword stapStatement contained break continue return next delete containedin=stapBlock
15 syn keyword stapRepeat contained while for foreach in containedin=stapBlock
16 syn keyword stapConditional contained if else containedin=stapBlock
17 syn keyword stapDeclaration global probe function
18 syn keyword stapType string long
19
20 syn region stapProbeDec start="\<probe\>"lc=5 end="{"me=s-1 contains=stapString,stapNumber
21 syn match stapProbe contained "\<\w\+\>" containedin=stapProbeDec
22
23 syn region stapFuncDec start="\<function\>"lc=8 end=":\|("me=s-1 contains=stapString,stapNumber
24 syn match stapFuncCall contained "\<\w\+\ze\(\s\|\n\)*(" containedin=stapBlock
25 syn match stapFunc contained "\<\w\+\>" containedin=stapFuncDec,stapFuncCall
26
27 syn match stapStat contained "@\<\w\+\ze\(\s\|\n\)*(" containedin=stapBlock
28
29 " decimal number
30 syn match stapNumber "\<\d\+\>" containedin=stapBlock
31 " octal number
32 syn match stapNumber "\<0\o\+\>" contains=stapOctalZero containedin=stapBlock
33 " Flag the first zero of an octal number as something special
34 syn match stapOctalZero contained "\<0"
35 " flag an octal number with wrong digits
36 syn match stapOctalError "\<0\o*[89]\d*" containedin=stapBlock
37 " hex number
38 syn match stapNumber "0x\x\+\>" containedin=stapBlock
39
40 syn region stapString oneline start=+"+ skip=+\\"+ end=+"+ containedin=stapBlock
41
42 syn region stapPreProc fold start="%(" end="%)" contains=stapNumber,stapString containedin=ALL
43 syn keyword stapPreProcCond contained kernel_v kernel_vr arch containedin=stapPreProc
44
45 syn include @C syntax/c.vim
46 syn keyword stapCMacro contained THIS CONTEXT containedin=@C,stapCBlock
47 syn region stapCBlock fold matchgroup=stapCBlockDelims start="%{"rs=e end="%}"re=s contains=@C
48
49 syn region stapBlock fold matchgroup=stapBlockEnds start="{"rs=e end="}"re=s containedin=stapBlock
50
51 syn keyword stapTodo contained TODO FIXME XXX
52
53 syn match stapComment "#.*" contains=stapTodo containedin=stapBlock
54 syn match stapComment "//.*" contains=stapTodo containedin=stapBlock
55 syn region stapComment matchgroup=stapComment start="/\*" end="\*/" contains=stapTodo,stapCommentBad containedin=stapBlock
56 syn match stapCommentBad contained "/\*"
57
58 " treat ^#! as special
59 syn match stapSharpBang "^#!.*"
60
61
62 " define the default highlighting
63 " For version 5.7 and earlier: only when not done already
64 " For version 5.8 and later: only when an item doesn't have highlightling yet
65 if version >= 508 || !exists("did_stap_syn_inits")
66 if version < 508
67 let did_stap_syn_inits = 1
68 command -nargs=+ HiLink hi link <args>
69 else
70 command -nargs=+ HiLink hi def link <args>
71 endif
72
73 HiLink stapNumber Number
74 HiLink stapOctalZero PreProc " c.vim does it this way...
75 HiLink stapOctalError Error
76 HiLink stapString String
77 HiLink stapTodo Todo
78 HiLink stapComment Comment
79 HiLink stapCommentBad Error
80 HiLink stapSharpBang PreProc
81 HiLink stapCBlockDelims Special
82 HiLink stapCMacro Macro
83 HiLink stapStatement Statement
84 HiLink stapConditional Conditional
85 HiLink stapRepeat Repeat
86 HiLink stapType Type
87 HiLink stapProbe Function
88 HiLink stapFunc Function
89 HiLink stapStat Function
90 HiLink stapPreProc PreProc
91 HiLink stapPreProcCond Special
92 HiLink stapDeclaration Typedef
93
94 delcommand HiLink
95 endif
96
97 let b:current_syntax = "stap"
This page took 0.039301 seconds and 5 git commands to generate.