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