|
| 1 | +filetype: meson |
| 2 | + |
| 3 | +detect: |
| 4 | + filename: "(meson\\.build|meson_options\\.txt|meson\\.options)" |
| 5 | + |
| 6 | +rules: |
| 7 | + |
| 8 | + # refer to https://mesonbuild.com/Syntax.html |
| 9 | + |
| 10 | + - statement: "\\b(elif|else|if|endif)\\b" |
| 11 | + - statement: "\\b(foreach|endforeach)\\b" |
| 12 | + - statement: "\\b(continue|break)\\b" |
| 13 | + - statement: "\\b(and|not|or|in)\\b" |
| 14 | + |
| 15 | + - symbol.operator: "[<>?:+*/-]|[+!<>=]?=" |
| 16 | + - symbol.brackets: "[(){}\\[\\]]" |
| 17 | + |
| 18 | + - constant.number: "\\b(0|[1-9][0-9]*)\\b" # decimal |
| 19 | + - constant.number: "\\b(0b[01]+)\\b" # bin |
| 20 | + - constant.number: "\\b(0o[0-7]+)\\b" # oct |
| 21 | + - constant.number: "\\b(0x[0-9a-fA-F]+)\\b" # hex |
| 22 | + |
| 23 | + # meson builtins |
| 24 | + - identifier: "\\b(add_global_arguments|add_global_link_arguments|add_languages|add_project_arguments|add_project_dependencies)\\b" |
| 25 | + - identifier: "\\b(add_project_link_arguments|add_test_setup|alias_target|assert|benchmark|both_libraries|build_machine|build_target|configuration_data)\\b" |
| 26 | + - identifier: "\\b(configure_file|custom_target|debug|declare_dependency|dependency|disabler|environment|error|executable|files)\\b" |
| 27 | + - identifier: "\\b(find_program|generator|get_option|get_variable|host_machine|import|include_directories|install_data|install_emptydir)\\b" |
| 28 | + - identifier: "\\b(install_headers|install_man|install_subdir|install_symlink|is_disabler|is_variable|jar|join_paths|library|meson)\\b" |
| 29 | + - identifier: "\\b(message|option|project|range|run_command|run_target|set_variable|shared_library|shared_module|static_library)\\b" |
| 30 | + - identifier: "\\b(structured_sources|subdir|subdir_done|subproject|summary|target_machine|test|unset_variable|vcs_tag|warning)\\b" |
| 31 | + |
| 32 | + - constant.bool: "\\b(true|false)\\b" |
| 33 | + |
| 34 | + - comment: |
| 35 | + start: "#" |
| 36 | + end: "$" |
| 37 | + |
| 38 | + # multiline strings do not support escape sequences |
| 39 | + - constant.string: |
| 40 | + start: "'''" |
| 41 | + end: "'''" |
| 42 | + |
| 43 | + - constant.string: |
| 44 | + start: "'" |
| 45 | + end: "'" |
| 46 | + skip: "\\\\." |
| 47 | + rules: |
| 48 | + - constant.specialChar: "\\\\[abfnrtv\\\\']" |
| 49 | + - constant.specialChar: "\\\\([0-7]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|N\\{[^\\}]+\\})" |
0 commit comments