[PATCH] Contrib: vim syntax, listen options.

Maxim Dounin mdounin at mdounin.ru
Mon Dec 25 17:39:55 UTC 2017


Hello!

On Mon, Dec 25, 2017 at 06:35:37PM +0200, Gena Makhomed wrote:

> # HG changeset patch
> # User Gena Makhomed <gmm at csdoc.com>
> # Date 1514219401 -7200
> #      Mon Dec 25 18:30:01 2017 +0200
> # Node ID c0ce67821e8d151fa98dc6934a80fb962bbdbc4a
> # Parent  5b9ed8c6f2dcadcdeb0fe9d64e18ac194b881e14
> Contrib: vim syntax, listen options.
> 
> diff -r 5b9ed8c6f2dc -r c0ce67821e8d contrib/vim/syntax/nginx.vim
> --- a/contrib/vim/syntax/nginx.vim      Mon Dec 25 17:57:01 2017 +0200
> +++ b/contrib/vim/syntax/nginx.vim      Mon Dec 25 18:30:01 2017 +0200
> @@ -62,13 +62,14 @@
>       \ contained
>       \ nextgroup=@ngxListenParams skipwhite skipempty
>   syn keyword ngxListenOptions contained
> -    \ default_server ssl http2 spdy proxy_protocol
> +    \ default_server ssl http2 proxy_protocol
>       \ setfib fastopen backlog rcvbuf sndbuf accept_filter deferred bind
> -    \ ipv6only reuseport so_keepalive keepidle
> +    \ ipv6only reuseport so_keepalive
>       \ nextgroup=@ngxListenParams skipwhite skipempty
> +syn keyword ngxListenOptionsDeprecated contained spdy
>   syn cluster ngxListenParams
>       \ contains=ngxListenParam,ngxListenString,ngxListenComment
> -    \ add=ngxListenOptions
> +    \ add=ngxListenOptions,ngxListenOptionsDeprecated
> 
>   syn keyword ngxDirectiveBlock contained http
>   syn keyword ngxDirectiveBlock contained stream
> @@ -2177,5 +2178,6 @@
>   hi link ngxDirectiveThirdParty Special
> 
>   hi link ngxListenOptions Keyword
> +hi link ngxListenOptionsDeprecated Error
> 
>   let b:current_syntax = "nginx"

This will break parsing of parameters following "spdy", for 
example:

    listen 443 spdy ssl;

The "ssl;" part will be incorrectly interpreted as a directive, as 
there is no nextgroup specified for ngxListenOptionsDeprecated.  A 
fix would be:

diff --git a/contrib/vim/syntax/nginx.vim b/contrib/vim/syntax/nginx.vim
--- a/contrib/vim/syntax/nginx.vim
+++ b/contrib/vim/syntax/nginx.vim
@@ -66,7 +66,9 @@ syn keyword ngxListenOptions contained
     \ setfib fastopen backlog rcvbuf sndbuf accept_filter deferred bind
     \ ipv6only reuseport so_keepalive
     \ nextgroup=@ngxListenParams skipwhite skipempty
-syn keyword ngxListenOptionsDeprecated contained spdy
+syn keyword ngxListenOptionsDeprecated contained
+    \ spdy
+    \ nextgroup=@ngxListenParams skipwhite skipempty
 syn cluster ngxListenParams
     \ contains=ngxListenParam,ngxListenString,ngxListenComment
     \ add=ngxListenOptions,ngxListenOptionsDeprecated

Committed with the fix, thanks.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list