3256
|
1 " ninja build file syntax.
|
|
2 " Language: ninja build file as described at
|
|
3 " http://martine.github.com/ninja/manual.html
|
4278
|
4 " Version: 1.3
|
|
5 " Last Change: 2013 Apr 12
|
3256
|
6 " Maintainer: Nicolas Weber <nicolasweber@gmx.de>
|
|
7
|
|
8 " ninja lexer and parser are at
|
|
9 " https://github.com/martine/ninja/blob/master/src/lexer.in.cc
|
4278
|
10 " https://github.com/martine/ninja/blob/master/src/manifest_parser.cc
|
3256
|
11
|
|
12 if exists("b:current_syntax")
|
|
13 finish
|
|
14 endif
|
|
15
|
|
16 syn case match
|
|
17
|
3682
|
18 syn match ninjaComment /#.*/ contains=@Spell
|
3513
|
19
|
3256
|
20 " Toplevel statements are the ones listed here and
|
|
21 " toplevel variable assignments (ident '=' value).
|
4278
|
22 " lexer.in.cc, ReadToken() and manifest_parser.cc, Parse()
|
3256
|
23 syn match ninjaKeyword "^build\>"
|
|
24 syn match ninjaKeyword "^rule\>"
|
4278
|
25 syn match ninjaKeyword "^pool\>"
|
3256
|
26 syn match ninjaKeyword "^default\>"
|
|
27 syn match ninjaKeyword "^include\>"
|
|
28 syn match ninjaKeyword "^subninja\>"
|
|
29
|
|
30 " Both 'build' and 'rule' begin a variable scope that ends
|
|
31 " on the first line without indent. 'rule' allows only a
|
|
32 " limited set of magic variables, 'build' allows general
|
|
33 " let assignments.
|
4278
|
34 " manifest_parser.cc, ParseRule()
|
3256
|
35 syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent
|
4278
|
36 syn keyword ninjaRuleCommand contained command deps depfile description generator pool restat rspfile rspfile_content
|
|
37
|
|
38 syn region ninjaPool start="^pool" end="^\ze\S" contains=ALL transparent
|
|
39 syn keyword ninjaPoolCommand contained depth
|
3256
|
40
|
|
41 " Strings are parsed as follows:
|
|
42 " lexer.in.cc, ReadEvalString()
|
|
43 " simple_varname = [a-zA-Z0-9_-]+;
|
|
44 " varname = [a-zA-Z0-9_.-]+;
|
|
45 " $$ -> $
|
|
46 " $\n -> line continuation
|
|
47 " '$ ' -> escaped space
|
|
48 " $simple_varname -> variable
|
|
49 " ${varname} -> variable
|
|
50
|
|
51 syn match ninjaWrapLineOperator "\$$"
|
|
52 syn match ninjaSimpleVar "\$[a-zA-Z0-9_-]\+"
|
|
53 syn match ninjaVar "\${[a-zA-Z0-9_.-]\+}"
|
|
54
|
|
55 " operators are:
|
|
56 " variable assignment =
|
|
57 " rule definition :
|
|
58 " implicit dependency |
|
|
59 " order-only dependency ||
|
|
60 syn match ninjaOperator "\(=\|:\||\|||\)\ze\s"
|
|
61
|
3513
|
62 hi def link ninjaComment Comment
|
3256
|
63 hi def link ninjaKeyword Keyword
|
|
64 hi def link ninjaRuleCommand Statement
|
4278
|
65 hi def link ninjaPoolCommand Statement
|
3256
|
66 hi def link ninjaWrapLineOperator ninjaOperator
|
|
67 hi def link ninjaOperator Operator
|
|
68 hi def link ninjaSimpleVar ninjaVar
|
|
69 hi def link ninjaVar Identifier
|
|
70
|
|
71 let b:current_syntax = "ninja"
|