2 " Language: Berkeley Packet Filter
3 " Maintainer: Daniel Borkmann
4 " Latest Revision: 08/16/2011
6 " In order to make syntax highlighting for BPFs work in vim, copy this file
7 " to ~/.vim/syntax/ and activate it in vim by entering:
11 " If you want to automatically load the BPF syntax highlighting for *.bpf
12 " files create the ~/.vim/filetype.vim with the following content:
15 " if exists("did_load_filetypes")
19 " augroup filetypedetect
20 " au! BufRead,BufNewFile *.bpf setfiletype bpf
24 if exists("b:current_syntax")
28 syn keyword bpfTodo contained TODO FIXME XXX NOTE
29 syn keyword bpfKeywords ldb ldh ld ldi ldx ldxi ldxb st stx jmp ja jeq jneq jne skipwhite
30 syn keyword bpfKeywords jlt jle jgt jge jset add sub mul div mod neg and or xor skipwhite
31 syn keyword bpfKeywords lsh rsh ret tax txa skipwhite
33 syn match bpfLabel /[a-zA-Z0-9_]\+/
34 syn match bpfSpChar /[:,#\[\]\(\)+*&]\?/ contains=bpfNumber,bpfLabel
35 syn match bpfNumber /\(0[xX]\x\+\|\d\+\)/
36 syn match bpfComment ";.*$" contains=bpfTodo
38 hi def link bpfTodo Todo
39 hi def link bpfComment Comment
40 hi def link bpfKeywords Keyword
41 hi def link bpfLabel Type
42 hi def link bpfNumber Number
43 hi def link bpfSpChar Special
45 let b:current_syntax = "bpf"