annotate runtime/syntax/meson.vim @ 29421:61796d98c856 v9.0.0052

patch 9.0.0052: "zG" may throw an error if invalid character follows Commit: https://github.com/vim/vim/commit/2ebcc35826bc2deb04e5fc6d73332f55783e7f52 Author: K.Takata <kentkt@csc.jp> Date: Thu Jul 14 17:25:14 2022 +0100 patch 9.0.0052: "zG" may throw an error if invalid character follows Problem: "zG" may throw an error if invalid character follows. Solution: Pass the word length to valid_spell_word(). (Ken Takata, closes #10737)
author Bram Moolenaar <Bram@vim.org>
date Thu, 14 Jul 2022 18:30:04 +0200
parents babd9f1dbe12
children 635de73eeb4c
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>
24636
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
5 " Liam Beguin <liambeguin@gmail.com>
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
6 " Last Change: 2021 Aug 16
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " Credits: Zvezdan Petkovic <zpetkovic@acm.org>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 " Neil Schemenauer <nas@meson.ca>
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 " Dmitry Vasiliev
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 "
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 " This version is copied and edited from python.vim
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 " 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
13 " For instance, it should show errors for syntax that is valid in
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 " Python but not in Meson.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 "
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 " Optional highlighting can be controlled using these variables.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 "
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 " let meson_space_error_highlight = 1
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
24636
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
21 if exists("b:current_syntax")
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 finish
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 endif
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 " We need nocompatible mode in order to continue lines with backslashes.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 " Original setting will be restored.
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 let s:cpo_save = &cpo
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 set cpo&vim
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 " http://mesonbuild.com/Syntax.html
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 syn keyword mesonConditional elif else if endif
24636
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
32 syn keyword mesonRepeat foreach endforeach
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
33 syn keyword mesonOperator and not or in
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
34 syn keyword mesonStatement continue break
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 syn match mesonComment "#.*$" contains=mesonTodo,@Spell
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 syn keyword mesonTodo FIXME NOTE NOTES TODO XXX contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 " Strings can either be single quoted or triple counted across multiple lines,
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 " but always with a '
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 syn region mesonString
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 \ start="\z('\)" end="\z1" skip="\\\\\|\\\z1"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 \ contains=mesonEscape,@Spell
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 syn region mesonString
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 \ start="\z('''\)" end="\z1" keepend
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 \ contains=mesonEscape,mesonSpaceError,@Spell
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 syn match mesonEscape "\\[abfnrtv'\\]" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 syn match mesonEscape "\\\o\{1,3}" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 syn match mesonEscape "\\x\x\{2}" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 syn match mesonEscape "\%(\\u\x\{4}\|\\U\x\{8}\)" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 " Meson allows case-insensitive Unicode IDs: http://www.unicode.org/charts/
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 syn match mesonEscape "\\N{\a\+\%(\s\a\+\)*}" contained
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 syn match mesonEscape "\\$"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 " Meson only supports integer numbers
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 " http://mesonbuild.com/Syntax.html#numbers
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 syn match mesonNumber "\<\d\+\>"
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
59 syn match mesonNumber "\<0x\x\+\>"
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
60 syn match mesonNumber "\<0o\o\+\>"
18456
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
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
63 syn keyword mesonBoolean false true
18456
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
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
102 \ install_emptydir
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 \ is_disabler
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 \ is_variable
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 \ jar
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 \ join_paths
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 \ library
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 \ meson
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 \ message
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 \ option
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 \ project
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 \ run_command
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 \ run_target
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 \ set_variable
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 \ shared_library
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 \ shared_module
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 \ static_library
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 \ subdir
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 \ subdir_done
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 \ subproject
24636
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
121 \ summary
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 \ target_machine
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 \ test
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
124 \ unset_variable
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 \ vcs_tag
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 \ warning
24636
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
127 \ range
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 if exists("meson_space_error_highlight")
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 " trailing whitespace
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 syn match mesonSpaceError display excludenl "\s\+$"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 " mixed tabs and spaces
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 syn match mesonSpaceError display " \+\t"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 syn match mesonSpaceError display "\t\+ "
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 endif
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136
24636
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
137 " The default highlight links. Can be overridden later.
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
138 hi def link mesonStatement Statement
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
139 hi def link mesonConditional Conditional
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
140 hi def link mesonRepeat Repeat
24636
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
141 hi def link mesonOperator Operator
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
142 hi def link mesonComment Comment
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
143 hi def link mesonTodo Todo
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
144 hi def link mesonString String
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
145 hi def link mesonEscape Special
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
146 hi def link mesonNumber Number
24636
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
147 hi def link mesonBuiltin Function
26100
babd9f1dbe12 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24636
diff changeset
148 hi def link mesonBoolean Boolean
24636
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
149 if exists("meson_space_error_higlight")
840665e74421 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 18456
diff changeset
150 hi def link mesonSpaceError Error
18456
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 endif
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 let b:current_syntax = "meson"
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 let &cpo = s:cpo_save
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 unlet s:cpo_save
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157
6d11fc4aa683 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 " vim:set sw=2 sts=2 ts=8 noet: