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.
5 " gn.vim: Vim syntax file for GN.
7 " Quit when a (custom) syntax file was already loaded
8 "if exists("b:current_syntax")
14 " Keywords within functions
15 syn keyword gnConditional if else
16 hi def link gnConditional Conditional
18 " Predefined variables
19 syn keyword gnPredefVar current_cpu current_os current_toolchain
20 syn keyword gnPredefVar default_toolchain host_cpu host_os
21 syn keyword gnPredefVar root_build_dir root_gen_dir root_out_dir
22 syn keyword gnPredefVar target_cpu target_gen_dir target_out_dir
23 syn keyword gnPredefVar target_os
24 syn keyword gnPredefVar true false
25 hi def link gnPredefVar Constant
28 syn keyword gnTarget action action_foreach copy executable group
29 syn keyword gnTarget shared_library source_set static_library
30 hi def link gnTarget Type
33 syn keyword gnFunctions assert config declare_args defined exec_script
34 syn keyword gnFunctions foreach get_label_info get_path_info
35 syn keyword gnFunctions get_target_outputs getenv import print
36 syn keyword gnFunctions process_file_template read_file rebase_path
37 syn keyword gnFunctions set_default_toolchain set_defaults
38 syn keyword gnFunctions set_sources_assignment_filter template tool
39 syn keyword gnFunctions toolchain toolchain_args write_file
40 hi def link gnFunctions Macro
43 syn keyword gnVariable all_dependent_configs allow_circular_includes_from
44 syn keyword gnVariable args cflags cflags_c cflags_cc cflags_objc
45 syn keyword gnVariable cflags_objcc check_includes complete_static_lib
46 syn keyword gnVariable configs data data_deps defines depfile deps
47 syn keyword gnVariable forward_dependent_configs_from include_dirs inputs
48 syn keyword gnVariable ldflags lib_dirs libs output_extension output_name
49 syn keyword gnVariable outputs public public_configs public_deps script
50 syn keyword gnVariable sources testonly visibility
51 hi def link gnVariable Keyword
54 syn region gnString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
55 hi def link gnString String
58 syn keyword gnTodo contained TODO FIXME XXX BUG NOTE
59 syn cluster gnCommentGroup contains=gnTodo
60 syn region gnComment start="#" end="$" contains=@gnCommentGroup,@Spell
62 hi def link gnComment Comment
63 hi def link gnTodo Todo
65 " Operators; I think this is a bit too colourful.
66 "syn match gnOperator /=/
67 "syn match gnOperator /!=/
68 "syn match gnOperator />=/
69 "syn match gnOperator /<=/
70 "syn match gnOperator /==/
71 "syn match gnOperator /+=/
72 "syn match gnOperator /-=/
73 "syn match gnOperator /\s>\s/
74 "syn match gnOperator /\s<\s/
75 "syn match gnOperator /\s+\s/
76 "syn match gnOperator /\s-\s/
77 "hi def link gnOperator Operator
81 let b:current_syntax = "gn"