Skip to content

Commit

Permalink
vim syntax: proper matching for route statements
Browse files Browse the repository at this point in the history
    * conflicts with route() calls are now solved
    * add syslog facility validation
  • Loading branch information
liviuchircu committed May 29, 2015
1 parent 84b4e7e commit 57938c0
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions utils/vim/opensips.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: OpenSIPS 2.x script
" Maintainer: Liviu Chircu <liviu@opensips.org>
" Last Change: 2015 May 16
" Last Change: 2015 May 29

" Quit when a (custom) syntax file was already loaded
"if exists("b:current_syntax")
Expand All @@ -18,9 +18,6 @@ syn keyword osConditional if else switch and or not
syn keyword osRepeat while for in
syn keyword osAction loadmodule modparam async

syn keyword osRoute route onreply_route failure_route branch_route local_route
syn keyword osRoute startup_route timer_route event_route error_route

syn keyword specialOperand myself yes no true false enable disable on off
syn keyword specialOperand af uri status from_uri to_uri NULL null
syn keyword specialOperand src_ip src_port dst_ip dst_port proto method max_len
Expand All @@ -32,7 +29,7 @@ syn keyword osGlobalParam disable_tcp disable_tls check_via dns rev_dns
syn keyword osGlobalParam tcp_send_timeout tcp_connect_timeout tcp_no_new_conn_bflag
syn keyword osGlobalParam disable_dns_failover disable_dns_blacklist dst_blacklist
syn keyword osGlobalParam exec_dns_threshold exec_msg_threshold tcpthreshold
syn keyword osGlobalParam xlog_buf_size xlog_force_color enable_assert
syn keyword osGlobalParam xlog_buf_size xlog_force_color enable_asserts
syn keyword osGlobalParam user_agent_header db_version_table use_children
syn keyword osGlobalParam advertised_address advertised_port disable_core_dump
syn keyword osGlobalParam db_max_async_connections include_file avp_aliases
Expand Down Expand Up @@ -61,10 +58,11 @@ syn match osScriptVarC /\$(\=[a-zA-Z_0-9]*/ contained
syn match osScriptVar /\$(\=[a-zA-Z_0-9]*/
syn region osString start=+"+ skip=+\\\\\|\\"+ end=+"+ extend contains=osSpecial,osScriptVarC

" OpenSIPS-specific constructs
syn match osLogFacility /LOG_\(AUTH\|CRON\|DAEMON\|KERN\|LOCAL[0-7]\|LPR\|MAIL\|NEWS\|USER\|UUCP\|AUTHPRIV\|FTP\|SYSLOG\)/
syn match osRouteStmt /^\s*\(\(onreply\|failure\|branch\|local\|startup\|timer\|event\|error\)_\)\=route\(\s\|\n\)*\(\[\|{\)/he=e-1

" Comments
"psyn region osScriptVar start='\$' end="\s\|(" nokeepend
"syn match osRouteStatement /route/
"syntax region osRouteStatement start=/route\s*\(\[\|{\)/ end=/\[\|{/me=s-1
syn region osCommentL start="#" skip="\\$" end="$" keepend
syn region osComment start="/\*" end="\*/" extend

Expand All @@ -74,15 +72,15 @@ syn match osNumber display "\<\d\+\>"

" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
"hi def link osRouteStmt Statement
hi def link osRouteStmt Type
hi def link osLogFacility specialOperand
"hi def link osIpAddr String
hi def link osCommentL osComment
hi def link osAction osStatement
hi def link osStatement Statement
hi def link osLabel Label
hi def link osConditional Conditional
hi def link osRepeat Repeat
hi def link osRoute Type
hi def link osGlobalParam Statement
hi def link osComment Comment
hi def link osString String
Expand Down

0 comments on commit 57938c0

Please sign in to comment.