[PATCH] Contrib: vim syntax, listen option and SSL/Mail protocol keywords

Maxim Dounin mdounin at mdounin.ru
Tue Feb 21 14:04:35 UTC 2017


Hello!

On Tue, Feb 21, 2017 at 11:11:20AM +0800, othree wrote:

> # HG changeset patch
> # User othree <othree at gmail.com>
> # Date 1487646550 -28800
> #      Tue Feb 21 11:09:10 2017 +0800
> # Node ID 41224bb087061a246fe67aa4c0e123a1107ae4cf
> # Parent  87cf6ddb41c216876d13cffa5e637a61b159362c
> Contrib: vim syntax, listen option and SSL/Mail protocol keywords.
> 
> 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
> @@ -32,25 +32,44 @@ syn keyword ngxDirectiveBlock if        
>  syn keyword ngxDirectiveBlock geo          contained
>  syn keyword ngxDirectiveBlock map          contained
>  syn keyword ngxDirectiveBlock split_clients contained
>  
>  syn keyword ngxDirectiveImportant include
>  syn keyword ngxDirectiveImportant root
>  syn keyword ngxDirectiveImportant server
>  syn keyword ngxDirectiveImportant server_name
> -syn keyword ngxDirectiveImportant listen
> +syn keyword ngxDirectiveImportant listen contained
> +syn region  ngxDirectiveImportantListen matchgroup=ngxDirectiveImportant start=/listen/ skip=/\\\;/ end=/;\zs/ contains=ngxListenOptions,ngxString

Note that this incorrectly parses constructs with escaped 
backslash, e.g.:

    listen unix:/tmp/foo\\;
    index http2;

As well as quote characters in the middle of a parameter:

    listen unix:/tmp/foo"bar http2;
    listen unix:/tmp/foo'bar http2;

It's probably minor enough to don't care, and existing string 
matching can't handle this as well, but if you know a simple way 
to fix it - it might worth fixing.

-- 
Maxim Dounin
http://nginx.org/


More information about the nginx-devel mailing list