| 1 |
" Vim syntax file |
| 2 |
" Language: SystemTap |
| 3 |
" Maintainer: SystemTap Developers <[email protected]> |
| 4 |
" Last Change: 2015 Dec 4 |
| 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 |
setlocal iskeyword=@,48-57,_,$ |
| 15 |
|
| 16 |
syn keyword stapStatement contained break continue return next delete try catch containedin=stapBlock |
| 17 |
syn keyword stapRepeat contained while for foreach in limit containedin=stapBlock |
| 18 |
syn keyword stapConditional contained if else containedin=stapBlock |
| 19 |
syn keyword stapDeclaration global probe function |
| 20 |
syn keyword stapModifier private |
| 21 |
syn match stapDeclaration "@define\>" |
| 22 |
syn keyword stapType string long |
| 23 |
|
| 24 |
syn region stapProbeDec start="\<probe\>"lc=5 end="{"me=s-1 contains=stapString,stapNumber |
| 25 |
syn match stapProbe contained "\<\w\+\>" containedin=stapProbeDec |
| 26 |
|
| 27 |
syn region stapFuncDec start="\<function\>"lc=8 end=":\|("me=s-1 contains=stapString,stapNumber |
| 28 |
syn match stapFuncCall contained "\<\w\+\ze\(\s\|\n\)*(" containedin=stapBlock |
| 29 |
syn match stapFunc contained "\<\w\+\>" containedin=stapFuncDec,stapFuncCall |
| 30 |
|
| 31 |
syn region stapMacroDec start="@define\>"lc=7 end="%("me=s-2 |
| 32 |
syn match stapMacro contained "\<\w\+\>" containedin=stapMacroDec |
| 33 |
|
| 34 |
syn match stapStat contained "@\<\w\+\ze\(\s\|\n\)*(" containedin=stapBlock |
| 35 |
|
| 36 |
" decimal number |
| 37 |
syn match stapNumber "\<\d\+\>" containedin=stapBlock |
| 38 |
" octal number |
| 39 |
syn match stapNumber "\<0\o\+\>" contains=stapOctalZero containedin=stapBlock |
| 40 |
" Flag the first zero of an octal number as something special |
| 41 |
syn match stapOctalZero contained "\<0" |
| 42 |
" flag an octal number with wrong digits |
| 43 |
syn match stapOctalError "\<0\o*[89]\d*" containedin=stapBlock |
| 44 |
" hex number |
| 45 |
syn match stapNumber "\<0x\x\+\>" containedin=stapBlock |
| 46 |
" numeric arguments |
| 47 |
syn match stapNumber "\<\$\d\+\>" containedin=stapBlock |
| 48 |
syn match stapNumber "\<\$#" containedin=stapBlock |
| 49 |
|
| 50 |
syn region stapString oneline start=+"+ skip=+\\"+ end=+"+ containedin=stapBlock |
| 51 |
" string arguments |
| 52 |
syn match stapString "@\d\+\>" containedin=stapBlock |
| 53 |
syn match stapString "@#" containedin=stapBlock |
| 54 |
|
| 55 |
syn match stapTarget contained "\<\$\+\h\w*\$*\>" containedin=stapBlock |
| 56 |
|
| 57 |
syn region stapPreProc fold start="%(" end="%)" contains=stapNumber,stapString containedin=ALL |
| 58 |
syn keyword stapPreProcCond contained kernel_v kernel_vr arch containedin=stapPreProc |
| 59 |
|
| 60 |
syn include @C syntax/c.vim |
| 61 |
syn keyword stapCMacro contained THIS CONTEXT STAP_RETVALUE STAP_RETURN STAP_PRINTF STAP_NEXT STAP_ERROR containedin=@C,stapCBlock |
| 62 |
syn match stapCMacro contained "\<STAP_ARG_\w*\>" containedin=@C,stapCBlock |
| 63 |
syn region stapCBlock fold matchgroup=stapCBlockDelims start="%{"rs=e end="%}"re=s contains=@C containedin=stapBlock |
| 64 |
|
| 65 |
syn region stapBlock fold matchgroup=stapBlockEnds start="{"rs=e end="}"re=s containedin=stapBlock |
| 66 |
|
| 67 |
" syn keyword stapTodo contained TODO FIXME XXX |
| 68 |
|
| 69 |
syn match stapComment "#.*" containedin=stapBlock |
| 70 |
syn match stapComment "//.*" containedin=stapBlock |
| 71 |
syn region stapComment matchgroup=stapComment start="/\*" end="\*/" contains=stapCommentBad containedin=stapBlock |
| 72 |
syn match stapCommentBad contained "/\*" |
| 73 |
|
| 74 |
" treat ^#! as special |
| 75 |
syn match stapSharpBang "^#!.*" |
| 76 |
|
| 77 |
|
| 78 |
" define the default highlighting |
| 79 |
" For version 5.7 and earlier: only when not done already |
| 80 |
" For version 5.8 and later: only when an item doesn't have highlightling yet |
| 81 |
if version >= 508 || !exists("did_stap_syn_inits") |
| 82 |
if version < 508 |
| 83 |
let did_stap_syn_inits = 1 |
| 84 |
command -nargs=+ HiLink hi link <args> |
| 85 |
else |
| 86 |
command -nargs=+ HiLink hi def link <args> |
| 87 |
endif |
| 88 |
|
| 89 |
HiLink stapNumber Number |
| 90 |
HiLink stapOctalZero PreProc " c.vim does it this way... |
| 91 |
HiLink stapOctalError Error |
| 92 |
HiLink stapString String |
| 93 |
HiLink stapTodo Todo |
| 94 |
HiLink stapComment Comment |
| 95 |
HiLink stapCommentBad Error |
| 96 |
HiLink stapSharpBang PreProc |
| 97 |
HiLink stapCBlockDelims Special |
| 98 |
HiLink stapCMacro Macro |
| 99 |
HiLink stapStatement Statement |
| 100 |
HiLink stapConditional Conditional |
| 101 |
HiLink stapRepeat Repeat |
| 102 |
HiLink stapType Type |
| 103 |
HiLink stapProbe Function |
| 104 |
HiLink stapFunc Function |
| 105 |
HiLink stapMacro Function |
| 106 |
HiLink stapStat Function |
| 107 |
HiLink stapPreProc PreProc |
| 108 |
HiLink stapPreProcCond Special |
| 109 |
HiLink stapDeclaration Typedef |
| 110 |
HiLink stapTarget Special |
| 111 |
HiLink stapModifier Keyword |
| 112 |
|
| 113 |
delcommand HiLink |
| 114 |
endif |
| 115 |
|
| 116 |
let b:current_syntax = "stap" |