annotate runtime/syntax/meson.vim @ 32669:448aef880252

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