7
|
1 " pf syntax file
|
|
2 " Language: OpenBSD packet filter configuration (pf.conf)
|
|
3 " Maintainer: Camiel Dobbelaar <cd@sentia.nl>
|
|
4 " Last Change: 2003 May 27
|
|
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 syntax clear
|
|
10 elseif exists("b:current_syntax")
|
|
11 finish
|
|
12 endif
|
|
13
|
|
14 setlocal foldmethod=syntax
|
|
15 syn sync fromstart
|
|
16
|
|
17 syn cluster pfNotLS contains=pfComment,pfTodo,pfVarAssign
|
|
18 syn keyword pfCmd altq anchor antispoof binat nat pass
|
|
19 syn keyword pfCmd queue rdr scrub table set
|
|
20 syn keyword pfService auth bgp domain finger ftp http https ident
|
|
21 syn keyword pfService imap irc isakmp kerberos mail nameserver nfs
|
|
22 syn keyword pfService nntp ntp pop3 portmap pptp rpcbind rsync smtp
|
|
23 syn keyword pfService snmp snmptrap socks ssh sunrpc syslog telnet
|
|
24 syn keyword pfService tftp www
|
|
25 syn keyword pfTodo TODO XXX contained
|
|
26 syn keyword pfWildAddr all any
|
|
27 syn match pfCmd /block\s/
|
|
28 syn match pfComment /#.*$/ contains=pfTodo
|
|
29 syn match pfCont /\\$/
|
|
30 syn match pfErrClose /}/
|
|
31 syn match pfIPv4 /\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/
|
|
32 syn match pfIPv6 /[a-fA-F0-9:]*::[a-fA-F0-9:.]*/
|
|
33 syn match pfIPv6 /[a-fA-F0-9:]\+:[a-fA-F0-9:]\+:[a-fA-F0-9:.]\+/
|
|
34 syn match pfNetmask /\/\d\+/
|
|
35 syn match pfNum /[a-zA-Z0-9_:.]\@<!\d\+[a-zA-Z0-9_:.]\@!/
|
|
36 syn match pfTable /<\s*[a-zA-Z][a-zA-Z0-9_]*\s*>/
|
|
37 syn match pfVar /$[a-zA-Z][a-zA-Z0-9_]*/
|
|
38 syn match pfVarAssign /^\s*[a-zA-Z][a-zA-Z0-9_]*\s*=/me=e-1
|
|
39 syn region pfFold1 start=/^#\{1}>/ end=/^#\{1,3}>/me=s-1 transparent fold
|
|
40 syn region pfFold2 start=/^#\{2}>/ end=/^#\{2,3}>/me=s-1 transparent fold
|
|
41 syn region pfFold3 start=/^#\{3}>/ end=/^#\{3}>/me=s-1 transparent fold
|
|
42 syn region pfList start=/{/ end=/}/ transparent contains=ALLBUT,pfErrClose,@pfNotLS
|
|
43 syn region pfString start=/"/ end=/"/ transparent contains=ALLBUT,pfString,@pfNotLS
|
|
44 syn region pfString start=/'/ end=/'/ transparent contains=ALLBUT,pfString,@pfNotLS
|
|
45
|
|
46 " Define the default highlighting.
|
|
47 " For version 5.7 and earlier: only when not done already
|
|
48 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
49 if version >= 508 || !exists("did_c_syn_inits")
|
|
50 if version < 508
|
|
51 let did_c_syn_inits = 1
|
|
52 command -nargs=+ HiLink hi link <args>
|
|
53 else
|
|
54 command -nargs=+ HiLink hi def link <args>
|
|
55 endif
|
|
56
|
|
57 HiLink pfCmd Statement
|
|
58 HiLink pfComment Comment
|
|
59 HiLink pfCont Statement
|
|
60 HiLink pfErrClose Error
|
|
61 HiLink pfIPv4 Type
|
|
62 HiLink pfIPv6 Type
|
|
63 HiLink pfNetmask Constant
|
|
64 HiLink pfNum Constant
|
|
65 HiLink pfService Constant
|
|
66 HiLink pfTable Identifier
|
|
67 HiLink pfTodo Todo
|
|
68 HiLink pfVar Identifier
|
|
69 HiLink pfVarAssign Identifier
|
|
70 HiLink pfWildAddr Type
|
|
71
|
|
72 delcommand HiLink
|
|
73 endif
|
|
74
|
|
75 let b:current_syntax = "pf"
|