2012-01-04 21:52:11 +00:00
|
|
|
" ninja build file syntax.
|
|
|
|
" Language: ninja build file as described at
|
2015-11-11 21:27:16 +00:00
|
|
|
" http://ninja-build.org/manual.html
|
2014-05-13 21:51:51 +00:00
|
|
|
" Version: 1.4
|
|
|
|
" Last Change: 2014/05/13
|
2012-01-04 21:52:11 +00:00
|
|
|
" Maintainer: Nicolas Weber <nicolasweber@gmx.de>
|
2014-06-12 20:22:35 +00:00
|
|
|
" Version 1.4 of this script is in the upstream vim repository and will be
|
2012-01-04 21:52:11 +00:00
|
|
|
" included in the next vim release. If you change this, please send your change
|
|
|
|
" upstream.
|
|
|
|
|
|
|
|
" ninja lexer and parser are at
|
2015-11-11 19:53:15 +00:00
|
|
|
" https://github.com/ninja-build/ninja/blob/master/src/lexer.in.cc
|
|
|
|
" https://github.com/ninja-build/ninja/blob/master/src/manifest_parser.cc
|
2012-01-04 21:52:11 +00:00
|
|
|
|
|
|
|
if exists("b:current_syntax")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2013-04-16 19:18:39 +00:00
|
|
|
let s:cpo_save = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2012-01-04 21:52:11 +00:00
|
|
|
syn case match
|
|
|
|
|
2012-06-01 17:56:41 +00:00
|
|
|
syn match ninjaComment /#.*/ contains=@Spell
|
2012-05-14 04:34:58 +00:00
|
|
|
|
2012-01-04 21:52:11 +00:00
|
|
|
" Toplevel statements are the ones listed here and
|
|
|
|
" toplevel variable assignments (ident '=' value).
|
2012-07-09 19:09:31 +00:00
|
|
|
" lexer.in.cc, ReadToken() and manifest_parser.cc, Parse()
|
2012-01-04 21:52:11 +00:00
|
|
|
syn match ninjaKeyword "^build\>"
|
|
|
|
syn match ninjaKeyword "^rule\>"
|
2012-12-14 07:10:52 +00:00
|
|
|
syn match ninjaKeyword "^pool\>"
|
2012-01-04 21:52:11 +00:00
|
|
|
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.
|
2012-07-09 19:09:31 +00:00
|
|
|
" manifest_parser.cc, ParseRule()
|
2012-01-04 21:52:11 +00:00
|
|
|
syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent
|
2013-04-09 18:13:48 +00:00
|
|
|
syn keyword ninjaRuleCommand contained command deps depfile description generator
|
2012-12-14 07:11:12 +00:00
|
|
|
\ pool restat rspfile rspfile_content
|
2012-12-14 07:10:52 +00:00
|
|
|
|
|
|
|
syn region ninjaPool start="^pool" end="^\ze\S" contains=ALL transparent
|
|
|
|
syn keyword ninjaPoolCommand contained depth
|
2012-01-04 21:52:11 +00:00
|
|
|
|
|
|
|
" 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
|
|
|
|
|
2014-05-13 21:51:51 +00:00
|
|
|
syn match ninjaDollar "\$\$"
|
2012-01-04 21:52:11 +00:00
|
|
|
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"
|
|
|
|
|
2012-05-14 04:34:58 +00:00
|
|
|
hi def link ninjaComment Comment
|
2012-01-04 21:52:11 +00:00
|
|
|
hi def link ninjaKeyword Keyword
|
|
|
|
hi def link ninjaRuleCommand Statement
|
2012-12-14 07:10:52 +00:00
|
|
|
hi def link ninjaPoolCommand Statement
|
2014-05-13 21:51:51 +00:00
|
|
|
hi def link ninjaDollar ninjaOperator
|
2012-01-04 21:52:11 +00:00
|
|
|
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"
|
2013-04-16 19:18:39 +00:00
|
|
|
|
|
|
|
let &cpo = s:cpo_save
|
|
|
|
unlet s:cpo_save
|