annotate runtime/syntax/meson.vim @ 20614:78caf677340d

Added tag v8.2.0860 for changeset 9edb439adbea579b02eafdb1b5bb8d2b011093e2
author Bram Moolenaar <Bram@vim.org>
date Sun, 31 May 2020 15:15:04 +0200
parents 6d11fc4aa683
children 840665e74421
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim syntax file
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: Meson
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " License: VIM License
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Maintainer: Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Last Change: 2019 Oct 18
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " Credits: Zvezdan Petkovic <zpetkovic@acm.org>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " Neil Schemenauer <nas@meson.ca>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 " Dmitry Vasiliev
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 "
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 " This version is copied and edited from python.vim
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 " It's very basic, and doesn't do many things I'd like it to
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 " For instance, it should show errors for syntax that is valid in
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 " Python but not in Meson.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 "
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 " Optional highlighting can be controlled using these variables.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 "
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 " let meson_space_error_highlight = 1
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 "
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 " For version 5.x: Clear all syntax items.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 " For version 6.x: Quit when a syntax file was already loaded.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 if version < 600
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 syntax clear
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 elseif exists("b:current_syntax")
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 finish
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 endif
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 " We need nocompatible mode in order to continue lines with backslashes.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 " Original setting will be restored.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 let s:cpo_save = &cpo
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 set cpo&vim
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 " http://mesonbuild.com/Syntax.html
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 syn keyword mesonConditional elif else if endif
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 syn keyword mesonRepeat foreach endforeach
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 syn keyword mesonOperator and not or
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 syn match mesonComment "#.*$" contains=mesonTodo,@Spell
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 syn keyword mesonTodo FIXME NOTE NOTES TODO XXX contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 " Strings can either be single quoted or triple counted across multiple lines,
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 " but always with a '
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 syn region mesonString
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 \ start="\z('\)" end="\z1" skip="\\\\\|\\\z1"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 \ contains=mesonEscape,@Spell
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 syn region mesonString
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 \ start="\z('''\)" end="\z1" keepend
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 \ contains=mesonEscape,mesonSpaceError,@Spell
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 syn match mesonEscape "\\[abfnrtv'\\]" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 syn match mesonEscape "\\\o\{1,3}" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 syn match mesonEscape "\\x\x\{2}" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 syn match mesonEscape "\%(\\u\x\{4}\|\\U\x\{8}\)" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 " Meson allows case-insensitive Unicode IDs: http://www.unicode.org/charts/
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 syn match mesonEscape "\\N{\a\+\%(\s\a\+\)*}" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 syn match mesonEscape "\\$"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 " Meson only supports integer numbers
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 " http://mesonbuild.com/Syntax.html#numbers
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 syn match mesonNumber "\<\d\+\>"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 " booleans
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 syn keyword mesonConstant false true
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 " Built-in functions
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 syn keyword mesonBuiltin
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 \ add_global_arguments
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 \ add_global_link_arguments
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 \ add_languages
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 \ add_project_arguments
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 \ add_project_link_arguments
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 \ add_test_setup
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 \ alias_target
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 \ assert
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 \ benchmark
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 \ both_libraries
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 \ build_machine
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 \ build_target
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 \ configuration_data
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 \ configure_file
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 \ custom_target
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 \ declare_dependency
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 \ dependency
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 \ disabler
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 \ environment
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 \ error
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 \ executable
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 \ files
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 \ find_library
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 \ find_program
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 \ generator
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 \ get_option
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 \ get_variable
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 \ gettext
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 \ host_machine
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 \ import
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 \ include_directories
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 \ install_data
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 \ install_headers
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 \ install_man
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 \ install_subdir
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 \ is_disabler
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 \ is_variable
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 \ jar
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 \ join_paths
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 \ library
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 \ meson
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 \ message
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 \ option
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 \ project
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 \ run_command
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 \ run_target
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 \ set_variable
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 \ shared_library
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 \ shared_module
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 \ static_library
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 \ subdir
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 \ subdir_done
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 \ subproject
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 \ target_machine
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 \ test
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 \ vcs_tag
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 \ warning
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 if exists("meson_space_error_highlight")
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 " trailing whitespace
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 syn match mesonSpaceError display excludenl "\s\+$"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 " mixed tabs and spaces
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 syn match mesonSpaceError display " \+\t"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 syn match mesonSpaceError display "\t\+ "
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 endif
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 if version >= 508 || !exists("did_meson_syn_inits")
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 if version <= 508
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 let did_meson_syn_inits = 1
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 command -nargs=+ HiLink hi link <args>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 else
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 command -nargs=+ HiLink hi def link <args>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 endif
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 " The default highlight links. Can be overridden later.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 HiLink mesonStatement Statement
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 HiLink mesonConditional Conditional
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 HiLink mesonRepeat Repeat
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 HiLink mesonOperator Operator
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 HiLink mesonComment Comment
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 HiLink mesonTodo Todo
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 HiLink mesonString String
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 HiLink mesonEscape Special
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 HiLink mesonNumber Number
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 HiLink mesonBuiltin Function
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 HiLink mesonConstant Number
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 if exists("meson_space_error_highlight")
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 HiLink mesonSpaceError Error
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 endif
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 delcommand HiLink
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 endif
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 let b:current_syntax = "meson"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 let &cpo = s:cpo_save
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 unlet s:cpo_save
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 " vim:set sw=2 sts=2 ts=8 noet: