annotate runtime/syntax/ninja.vim @ 6849:f4e5704c5c43 v7.4.745

patch 7.4.745 Problem: The entries added by matchaddpos() are returned by getmatches() but can't be set with setmatches(). (Lcd) Solution: Fix setmatches(). (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Fri, 19 Jun 2015 16:32:57 +0200
parents 92751673cc37
children 1073225cb749
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " ninja build file syntax.
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2 " Language: ninja build file as described at
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3 " http://martine.github.com/ninja/manual.html
5968
92751673cc37 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
4 " Version: 1.4
92751673cc37 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
5 " Last Change: 2014/05/13
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 " Maintainer: Nicolas Weber <nicolasweber@gmx.de>
5968
92751673cc37 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7 " Version 1.4 of this script is in the upstream vim repository and will be
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
8 " included in the next vim release. If you change this, please send your change
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
9 " upstream.
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 " ninja lexer and parser are at
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 " https://github.com/martine/ninja/blob/master/src/lexer.in.cc
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
13 " https://github.com/martine/ninja/blob/master/src/manifest_parser.cc
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 if exists("b:current_syntax")
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 finish
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 endif
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
19 let s:cpo_save = &cpo
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
20 set cpo&vim
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
21
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 syn case match
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23
3682
11d40fc82f11 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3513
diff changeset
24 syn match ninjaComment /#.*/ contains=@Spell
3513
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
25
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 " Toplevel statements are the ones listed here and
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27 " toplevel variable assignments (ident '=' value).
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
28 " lexer.in.cc, ReadToken() and manifest_parser.cc, Parse()
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 syn match ninjaKeyword "^build\>"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 syn match ninjaKeyword "^rule\>"
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
31 syn match ninjaKeyword "^pool\>"
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 syn match ninjaKeyword "^default\>"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 syn match ninjaKeyword "^include\>"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 syn match ninjaKeyword "^subninja\>"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 " Both 'build' and 'rule' begin a variable scope that ends
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 " on the first line without indent. 'rule' allows only a
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 " limited set of magic variables, 'build' allows general
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 " let assignments.
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
40 " manifest_parser.cc, ParseRule()
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
42 syn keyword ninjaRuleCommand contained command deps depfile description generator
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
43 \ pool restat rspfile rspfile_content
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
44
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
45 syn region ninjaPool start="^pool" end="^\ze\S" contains=ALL transparent
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
46 syn keyword ninjaPoolCommand contained depth
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
47
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
48 " Strings are parsed as follows:
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
49 " lexer.in.cc, ReadEvalString()
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
50 " simple_varname = [a-zA-Z0-9_-]+;
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51 " varname = [a-zA-Z0-9_.-]+;
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 " $$ -> $
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 " $\n -> line continuation
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54 " '$ ' -> escaped space
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 " $simple_varname -> variable
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56 " ${varname} -> variable
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57
5968
92751673cc37 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
58 syn match ninjaDollar "\$\$"
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 syn match ninjaWrapLineOperator "\$$"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 syn match ninjaSimpleVar "\$[a-zA-Z0-9_-]\+"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61 syn match ninjaVar "\${[a-zA-Z0-9_.-]\+}"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
62
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 " operators are:
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
64 " variable assignment =
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65 " rule definition :
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66 " implicit dependency |
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67 " order-only dependency ||
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
68 syn match ninjaOperator "\(=\|:\||\|||\)\ze\s"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69
3513
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
70 hi def link ninjaComment Comment
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 hi def link ninjaKeyword Keyword
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 hi def link ninjaRuleCommand Statement
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
73 hi def link ninjaPoolCommand Statement
5968
92751673cc37 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
74 hi def link ninjaDollar ninjaOperator
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 hi def link ninjaWrapLineOperator ninjaOperator
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 hi def link ninjaOperator Operator
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
77 hi def link ninjaSimpleVar ninjaVar
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
78 hi def link ninjaVar Identifier
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 let b:current_syntax = "ninja"
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
81
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
82 let &cpo = s:cpo_save
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
83 unlet s:cpo_save