• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1" Copyright 2014 The Chromium Authors. All rights reserved.
2" Use of this source code is governed by a BSD-style license that can be
3" found in the LICENSE file.
4"
5" gn.vim: Vim syntax file for GN.
6"
7" Quit when a (custom) syntax file was already loaded
8"if exists("b:current_syntax")
9  "finish
10"endif
11
12syn case match
13
14" Keywords within functions
15syn keyword     gnConditional       if else
16hi def link     gnConditional       Conditional
17
18" Predefined variables
19syn keyword     gnPredefVar current_cpu current_os current_toolchain
20syn keyword     gnPredefVar default_toolchain host_cpu host_os
21syn keyword     gnPredefVar root_build_dir root_gen_dir root_out_dir
22syn keyword     gnPredefVar target_cpu target_gen_dir target_out_dir
23syn keyword     gnPredefVar target_os
24syn keyword     gnPredefVar true false
25hi def link     gnPredefVar         Constant
26
27" Target declarations
28syn keyword     gnTarget action action_foreach copy executable group
29syn keyword     gnTarget shared_library source_set static_library
30syn keyword     gnTarget loadable_module generated_file
31syn keyword     gnTarget rust_library rust_proc_macro
32hi def link     gnTarget            Type
33
34" Buildfile functions
35syn keyword     gnFunctions assert config declare_args defined exec_script
36syn keyword     gnFunctions foreach get_label_info get_path_info
37syn keyword     gnFunctions get_target_outputs getenv import print
38syn keyword     gnFunctions process_file_template propagates_configs read_file
39syn keyword     gnFunctions rebase_path set_default_toolchain set_defaults
40syn keyword     gnFunctions split_list string_join string_split template tool
41syn keyword     gnFunctions toolchain toolchain_args write_file
42hi def link     gnFunctions         Macro
43
44" Variables
45syn keyword     gnVariable all_dependent_configs allow_circular_includes_from
46syn keyword     gnVariable args arflags asmflags assert_no_deps
47syn keyword     gnVariable cflags cflags_c cflags_cc cflags_objc cflags_objcc
48syn keyword     gnVariable check_includes complete_static_lib configs
49syn keyword     gnVariable data data_deps data_keys defines depfile deps
50syn keyword     gnVariable framework_dirs frameworks include_dirs inputs ldflags
51syn keyword     gnVariable lib_dirs libs output_extension output_name outputs
52syn keyword     gnVariable public public_configs public_deps scripte sources
53syn keyword     gnVariable testonly visibility contents output_conversion rebase
54syn keyword     gnVariable walk_keys gen_deps
55hi def link     gnVariable          Keyword
56
57" Strings
58syn region      gnString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell,gnTargetName
59syn match       gnTargetName '\v:[^"]+' contained
60hi def link     gnString            String
61hi def link     gnTargetName        Special
62
63" Comments
64syn keyword     gnTodo              contained TODO FIXME XXX BUG NOTE
65syn cluster     gnCommentGroup      contains=gnTodo
66syn region      gnComment           start="#" end="$" contains=@gnCommentGroup,@Spell
67
68hi def link     gnComment           Comment
69hi def link     gnTodo              Todo
70
71" Operators; I think this is a bit too colourful.
72"syn match gnOperator /=/
73"syn match gnOperator /!=/
74"syn match gnOperator />=/
75"syn match gnOperator /<=/
76"syn match gnOperator /==/
77"syn match gnOperator /+=/
78"syn match gnOperator /-=/
79"syn match gnOperator /\s>\s/
80"syn match gnOperator /\s<\s/
81"syn match gnOperator /\s+\s/
82"syn match gnOperator /\s-\s/
83"hi def link     gnOperator          Operator
84
85syn sync minlines=500
86
87let b:current_syntax = "gn"
88