annotate runtime/syntax/ninja.vim @ 25255:8f392278ef69

Added tag v8.2.3163 for changeset 5127844b909b04ecd70ff7e19081e34722e081cc
author Bram Moolenaar <Bram@vim.org>
date Thu, 15 Jul 2021 13:15:04 +0200
parents 1073225cb749
children
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
13589
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
3 " http://ninja-build.org/manual.html
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
4 " Version: 1.5
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
5 " Last Change: 2018/04/05
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 " Maintainer: Nicolas Weber <nicolasweber@gmx.de>
13589
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
7 " Version 1.5 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
13589
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
12 " https://github.com/ninja-build/ninja/blob/master/src/lexer.in.cc
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
13 " https://github.com/ninja-build/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
13589
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
24 " Comments are only matched when the # is at the beginning of the line (with
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
25 " optional whitespace), as long as the prior line didn't end with a $
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
26 " continuation.
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
27 syn match ninjaComment /\(\$\n\)\@<!\_^\s*#.*$/ contains=@Spell
3513
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
28
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 " Toplevel statements are the ones listed here and
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 " toplevel variable assignments (ident '=' value).
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
31 " lexer.in.cc, ReadToken() and manifest_parser.cc, Parse()
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 syn match ninjaKeyword "^build\>"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 syn match ninjaKeyword "^rule\>"
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
34 syn match ninjaKeyword "^pool\>"
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 syn match ninjaKeyword "^default\>"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36 syn match ninjaKeyword "^include\>"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 syn match ninjaKeyword "^subninja\>"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
39 " Both 'build' and 'rule' begin a variable scope that ends
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
40 " on the first line without indent. 'rule' allows only a
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
41 " limited set of magic variables, 'build' allows general
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
42 " let assignments.
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
43 " manifest_parser.cc, ParseRule()
13589
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
44 syn region ninjaRule start="^rule" end="^\ze\S" contains=TOP transparent
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
45 syn keyword ninjaRuleCommand contained containedin=ninjaRule command
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
46 \ deps depfile description generator
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
47 \ pool restat rspfile rspfile_content
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
48
13589
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
49 syn region ninjaPool start="^pool" end="^\ze\S" contains=TOP transparent
1073225cb749 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 5968
diff changeset
50 syn keyword ninjaPoolCommand contained containedin=ninjaPool depth
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
51
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
52 " Strings are parsed as follows:
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
53 " lexer.in.cc, ReadEvalString()
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
54 " simple_varname = [a-zA-Z0-9_-]+;
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
55 " varname = [a-zA-Z0-9_.-]+;
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
56 " $$ -> $
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
57 " $\n -> line continuation
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
58 " '$ ' -> escaped space
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
59 " $simple_varname -> variable
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
60 " ${varname} -> variable
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
61
5968
92751673cc37 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
62 syn match ninjaDollar "\$\$"
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
63 syn match ninjaWrapLineOperator "\$$"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
64 syn match ninjaSimpleVar "\$[a-zA-Z0-9_-]\+"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
65 syn match ninjaVar "\${[a-zA-Z0-9_.-]\+}"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
66
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
67 " operators are:
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
68 " variable assignment =
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
69 " rule definition :
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
70 " implicit dependency |
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
71 " order-only dependency ||
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
72 syn match ninjaOperator "\(=\|:\||\|||\)\ze\s"
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
73
3513
1b584a6f446c Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3256
diff changeset
74 hi def link ninjaComment Comment
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
75 hi def link ninjaKeyword Keyword
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
76 hi def link ninjaRuleCommand Statement
4278
9b772e48f79e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3682
diff changeset
77 hi def link ninjaPoolCommand Statement
5968
92751673cc37 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
78 hi def link ninjaDollar ninjaOperator
3256
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
79 hi def link ninjaWrapLineOperator ninjaOperator
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
80 hi def link ninjaOperator Operator
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
81 hi def link ninjaSimpleVar ninjaVar
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
82 hi def link ninjaVar Identifier
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
83
ba708ee8d69d Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
84 let b:current_syntax = "ninja"
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
85
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
86 let &cpo = s:cpo_save
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4278
diff changeset
87 unlet s:cpo_save