File: bip.vim

package info (click to toggle)
bip 0.9.3-1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,456 kB
  • sloc: ansic: 9,941; sh: 1,902; perl: 1,434; yacc: 212; lex: 137; makefile: 64
file content (169 lines) | stat: -rw-r--r-- 5,874 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
" Vim syntax file
" Language: Bip configuration file
" Copyright: Copyright (C) 2004 Arnaud Cornet and Loïc Gomez
" License: This file is part of the bip project. See the file 'COPYING' for
"          the exact licensing terms.
"
"
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

syn case ignore

" Global elements
syn match	bipComment	contained %\s*#.*$%
syn match	bipEndError	contained /\(#.*\)\@<![^;{]$/

" Possible values types.
syn region	bipString	contained start=+"+ end=+"+
syn keyword	bipBool		contained true false
syn match	bipNumeric	contained /\d\d*/
syn region	bipIP		contained start=+"+ end=+"+
		\ contains=bipAddrTk,bipDot
syn region	bipNetmask	contained start=+"+ end=+"+
		\ contains=bipAddrTk,bipDot,bipSlash,bipMask
syn match	bipAddrTk	contained #\d\{1,3}#
syn match	bipDot		contained #\.#
syn match	bipSlash	contained #/#
syn match	bipMask		contained #\d\{1,2}#
syn match	bipWhite	contained +#\@!\s*+
" wrong
" syn match	bipWhite	contained +^\s*\ze[^#]*+

" Values syntax
syn region	bipStringV	contained matchgroup=Delimiter start=/\s*=\s*/
	\ end=/\s*;\s*/ contains=bipString
syn region	bipBoolV	contained matchgroup=Delimiter start=/\s*=\s*/
	\ end=/\s*;\s*/ contains=bipBool
syn region	bipNumericV	contained matchgroup=Delimiter start=/\s*=\s*/
	\ end=/\s*;\s*/ contains=bipNumeric
syn region	bipIPV		contained matchgroup=Delimiter start=/\s*=\s*/
	\ end=/\s*;\s*/ contains=bipIP
syn region	bipNetmaskV	contained matchgroup=Delimiter start=/\s*=\s*/
	\ end=/\s*;\s*/ contains=bipNetmask


syn region	bipMain		start=/\%^/ end=/\%$/
	\ contains=bipKeyword,bipNetwork,bipUser,bipComment,bipEndError

" Top level elements
syn keyword	bipKeyword	contained nextgroup=bipBoolV client_side_ssl 
	\ log log_system write_oidentd
syn keyword	bipKeyword	contained nextgroup=bipStringV log_root
	\ log_format oidentd_file pid_file client_side_ssl_pem client_side_ciphers
	\ client_side_dh_param ssl_default_ciphers
syn keyword	bipKeyword	contained nextgroup=bipNumericV port log_level
	\ log_sync_interval reconn_timer
syn keyword	bipKeyword	contained nextgroup=bipIPV ip

" Network block (level 1)
syn region	bipNetwork	contained matchgroup=Macro 
	\ start=/network\s*{\s*/ end=/};/
	\ contains=bipNKeyword,bipServer,bipComment,bipEndError,bipWhite
syn keyword	bipNKeyword	contained nextgroup=bipStringV name ciphers
syn keyword	bipNKeyword	contained nextgroup=bipBoolV ssl

" User block (level 1)
syn region	bipUser		contained matchgroup=Macro start=/user\s*{\s*/
	\ end=/};/
	\ contains=bipUKeyword,bipConnection,bipComment,bipEndError,bipWhite
syn keyword	bipUKeyword	contained nextgroup=bipStringV password name
	\ default_nick default_user default_realname ssl_check_store
	\ ssl_check_mode ssl_client_certfile backlog_timestamp
syn keyword	bipUKeyword	contained nextgroup=bipNumericV backlog_lines 
syn keyword	bipUKeyword	contained nextgroup=bipBoolV admin
	\ backlog backlog_reset_on_talk
	\ backlog_msg_only backlog_always bip_use_notice
	\ backlog_reset_connection
" DEPRECATED	\ always_backlog bl_msg_only blreset_on_talk
" DEPRECATED	\ backlog_no_timestamp

" Connection block (level 2)
syn region	bipConnection	contained matchgroup=Macro
	\ start=/connection\s*{\s*/ end=/};/
	\ contains=bipCoKeyword,bipChannel,bipComment,bipEndError,bipWhite
syn keyword	bipCoKeyword	contained nextgroup=bipBoolV autojoin_on_kick
	\ follow_nick ignore_first_nick log ignore_server_capab
syn keyword	bipCoKeyword	contained nextgroup=bipStringV name user nick
	\ network password vhost away_nick on_connect_send realname
	\ no_client_away_msg ssl_check_mode sasl_username sasl_password
	\ sasl_mechanism
syn keyword	bipCoKeyword	contained nextgroup=bipNumericV source_port

" Channel elements (lvl 2)
syn region	bipChannel	contained matchgroup=Macro
	\ start=/channel\s*{\s*/ end=/};/
	\ contains=bipCKeyword,bipComment,bipEndError,bipWhite
syn keyword	bipCKeyword	contained nextgroup=bipStringV name key
syn keyword	bipCKeyword	contained nextgroup=bipBoolV backlog

" Server elements (lvl 2)
syn region	bipServer	contained matchgroup=Macro
	\ start=/server\s*{\s*/ end=/};/
	\ contains=bipSKeyword,bipComment,bipEndError,bipWhite
syn keyword	bipSKeyword	contained nextgroup=bipStringV host
syn keyword	bipSKeyword	contained nextgroup=bipNumericV port 

" Client elements (lvl 2)
"syn region	bipClient	contained matchgroup=Macro
"	\ start=/client\s*{\s*/ end=/};/
"	\ contains=bipCLKeyword,bipComment,bipEndError,bipWhite
"syn keyword	bipCLKeyword	contained nextgroup=bipStringV user password

" Synchronization
syn sync match bipSyncNet grouphere bipNetwork /\_.\s*\(network\s*{\)\@=+/
syn sync match bipSyncUser grouphere bipUser /\_.\s*\(user\s*{\)\@=+/

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version < 508
	command -nargs=+ HiLink hi link <args>
else
	command -nargs=+ HiLink hi def link <args>
endif

HiLink	bipMain	Error
HiLink	bipNetwork	Error
HiLink	bipChannel	Error
HiLink	bipServer	Error
HiLink	bipUser		Error
HiLink	bipConnection	Error

" We do not HiLink bipWhite, siec we only want to ignore it.
HiLink	bipKeyword	Keyword
HiLink	bipNKeyword	Keyword
HiLink	bipUKeyword	Keyword
HiLink	bipCKeyword	Keyword
HiLink	bipSKeyword	Keyword
HiLink	bipCoKeyword	Keyword

HiLink	bipComment	Comment

HiLink	bipMatch	Include

HiLink	bipStringV	Error
HiLink	bipBoolV	Error
HiLink	bipNumericV	Error
HiLink	bipIPV	Error

HiLink	bipEndError	Error

HiLink	bipString	String
HiLink	bipBool	Boolean
HiLink	bipNumeric	Number
HiLink	bipIP	String
HiLink	bipAddrTk	String
HiLink	bipDot	Delimiter
HiLink	bipSlash	Delimiter
HiLink	bipMask	Number

delcommand HiLink

let b:current_syntax = "bip"
" vim: ts=8