codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: Meson3" License: VIM License4" Maintainer: Nirbheek Chauhan <nirbheek.chauhan@gmail.com>5" Liam Beguin <liambeguin@gmail.com>6" Last Change: 2023 May 277" Credits: Zvezdan Petkovic <zpetkovic@acm.org>8" Neil Schemenauer <nas@meson.ca>9" Dmitry Vasiliev10"11" This version is copied and edited from python.vim12" It's very basic, and doesn't do many things I'd like it to13" For instance, it should show errors for syntax that is valid in14" Python but not in Meson.15"16" Optional highlighting can be controlled using these variables.17"18" let meson_space_error_highlight = 119"20 21if exists("b:current_syntax")22 finish23endif24 25" We need nocompatible mode in order to continue lines with backslashes.26" Original setting will be restored.27let s:cpo_save = &cpo28set cpo&vim29 30" http://mesonbuild.com/Syntax.html31syn keyword mesonConditional elif else if endif32syn keyword mesonRepeat foreach endforeach33syn keyword mesonOperator and not or in34syn keyword mesonStatement continue break35 36syn match mesonComment "#.*$" contains=mesonTodo,@Spell37syn keyword mesonTodo FIXME NOTE NOTES TODO XXX contained38 39" Strings can either be single quoted or triple counted across multiple lines,40" but always with a '41syn region mesonString42 \ start="\z('\)" end="\z1" skip="\\\\\|\\\z1"43 \ contains=mesonEscape,@Spell44syn region mesonString45 \ start="\z('''\)" end="\z1" keepend46 \ contains=mesonEscape,mesonSpaceError,@Spell47 48syn match mesonEscape "\\[abfnrtv'\\]" contained49syn match mesonEscape "\\\o\{1,3}" contained50syn match mesonEscape "\\x\x\{2}" contained51syn match mesonEscape "\%(\\u\x\{4}\|\\U\x\{8}\)" contained52" Meson allows case-insensitive Unicode IDs: http://www.unicode.org/charts/53syn match mesonEscape "\\N{\a\+\%(\s\a\+\)*}" contained54syn match mesonEscape "\\$"55 56" Meson only supports integer numbers57" http://mesonbuild.com/Syntax.html#numbers58syn match mesonNumber "\<\d\+\>"59syn match mesonNumber "\<0x\x\+\>"60syn match mesonNumber "\<0o\o\+\>"61 62" booleans63syn keyword mesonBoolean false true64 65" Built-in functions66syn keyword mesonBuiltin67 \ add_global_arguments68 \ add_global_link_arguments69 \ add_languages70 \ add_project_arguments71 \ add_project_dependencies72 \ add_project_link_arguments73 \ add_test_setup74 \ alias_target75 \ assert76 \ benchmark77 \ both_libraries78 \ build_machine79 \ build_target80 \ configuration_data81 \ configure_file82 \ custom_target83 \ declare_dependency84 \ dependency85 \ disabler86 \ environment87 \ error88 \ executable89 \ files90 \ find_library91 \ find_program92 \ generator93 \ get_option94 \ get_variable95 \ gettext96 \ host_machine97 \ import98 \ include_directories99 \ install_data100 \ install_headers101 \ install_man102 \ install_subdir103 \ install_symlink104 \ install_emptydir105 \ is_disabler106 \ is_variable107 \ jar108 \ join_paths109 \ library110 \ meson111 \ message112 \ option113 \ project114 \ run_command115 \ run_target116 \ set_variable117 \ shared_library118 \ shared_module119 \ static_library120 \ structured_sources121 \ subdir122 \ subdir_done123 \ subproject124 \ summary125 \ target_machine126 \ test127 \ unset_variable128 \ vcs_tag129 \ warning130 \ range131 \ debug132 133if exists("meson_space_error_highlight")134 " trailing whitespace135 syn match mesonSpaceError display excludenl "\s\+$"136 " mixed tabs and spaces137 syn match mesonSpaceError display " \+\t"138 syn match mesonSpaceError display "\t\+ "139endif140 141" The default highlight links. Can be overridden later.142hi def link mesonStatement Statement143hi def link mesonConditional Conditional144hi def link mesonRepeat Repeat145hi def link mesonOperator Operator146hi def link mesonComment Comment147hi def link mesonTodo Todo148hi def link mesonString String149hi def link mesonEscape Special150hi def link mesonNumber Number151hi def link mesonBuiltin Function152hi def link mesonBoolean Boolean153if exists("meson_space_error_highlight")154 hi def link mesonSpaceError Error155endif156 157let b:current_syntax = "meson"158 159let &cpo = s:cpo_save160unlet s:cpo_save161 162" vim:set sw=2 sts=2 ts=8 noet:163 