diff options
author | Bram Moolenaar <Bram@vim.org> | 2012-01-10 14:55:01 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2012-01-10 14:55:01 +0100 |
commit | 6ee8d89cf9c283992323ab6d9ff3b59390639ee9 (patch) | |
tree | 2ba1ccf8a2cf2060a1dbf92cec962cc445cec05a /runtime/syntax/ninja.vim | |
parent | 64a72303f8048a1288a03b65350c5d6727a78932 (diff) | |
download | vim-6ee8d89cf9c283992323ab6d9ff3b59390639ee9.zip |
Updated runtime files.
Diffstat (limited to 'runtime/syntax/ninja.vim')
-rw-r--r-- | runtime/syntax/ninja.vim | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/runtime/syntax/ninja.vim b/runtime/syntax/ninja.vim new file mode 100644 index 000000000..22ef4a02e --- /dev/null +++ b/runtime/syntax/ninja.vim @@ -0,0 +1,63 @@ +" ninja build file syntax. +" Language: ninja build file as described at +" http://martine.github.com/ninja/manual.html +" Version: 1.0 +" Last Change: 2012 Jan 04 +" Maintainer: Nicolas Weber <nicolasweber@gmx.de> + +" ninja lexer and parser are at +" https://github.com/martine/ninja/blob/master/src/lexer.in.cc +" https://github.com/martine/ninja/blob/master/src/parsers.cc + +if exists("b:current_syntax") + finish +endif + +syn case match + +" Toplevel statements are the ones listed here and +" toplevel variable assignments (ident '=' value). +" lexer.in.cc, ReadToken() and parsers.cc, Parse() +syn match ninjaKeyword "^build\>" +syn match ninjaKeyword "^rule\>" +syn match ninjaKeyword "^default\>" +syn match ninjaKeyword "^include\>" +syn match ninjaKeyword "^subninja\>" + +" Both 'build' and 'rule' begin a variable scope that ends +" on the first line without indent. 'rule' allows only a +" limited set of magic variables, 'build' allows general +" let assignments. +" parsers.cc, ParseRule() +syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent +syn keyword ninjaRuleCommand contained command depfile description generator restat + +" Strings are parsed as follows: +" lexer.in.cc, ReadEvalString() +" simple_varname = [a-zA-Z0-9_-]+; +" varname = [a-zA-Z0-9_.-]+; +" $$ -> $ +" $\n -> line continuation +" '$ ' -> escaped space +" $simple_varname -> variable +" ${varname} -> variable + +syn match ninjaWrapLineOperator "\$$" +syn match ninjaSimpleVar "\$[a-zA-Z0-9_-]\+" +syn match ninjaVar "\${[a-zA-Z0-9_.-]\+}" + +" operators are: +" variable assignment = +" rule definition : +" implicit dependency | +" order-only dependency || +syn match ninjaOperator "\(=\|:\||\|||\)\ze\s" + +hi def link ninjaKeyword Keyword +hi def link ninjaRuleCommand Statement +hi def link ninjaWrapLineOperator ninjaOperator +hi def link ninjaOperator Operator +hi def link ninjaSimpleVar ninjaVar +hi def link ninjaVar Identifier + +let b:current_syntax = "ninja" |