Skip to content

Commit

Permalink
feat(lang): add Meson language support
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett committed May 3, 2022
1 parent d2b1add commit 4724024
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
| lua || || |
| make || | | |
| markdown || | | |
| meson || || |
| mint | | | | `mint` |
| nickel || || `nls` |
| nix || || `rnix-lsp` |
Expand Down
13 changes: 13 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1303,3 +1303,16 @@ indent = { tab-width = 2, unit = " " }
[[grammar]]
name = "cpon"
source = { git = "https://github.com/fvacek/tree-sitter-cpon", rev = "11ba46a4de3eb86934003133099c9963a60f9687" }

[[language]]
name = "meson"
scope = "source.meson"
injection-regex = "meson"
file-types = ["meson.build"]
roots = []
comment-token = "#"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "meson"
source = { git = "https://github.com/bearcove/tree-sitter-meson", rev = "feea83be9225842490066522ced2d13eb9cce0bd" }
62 changes: 62 additions & 0 deletions runtime/queries/meson/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
(string_literal) @string

(boolean_literal) @constant.builtin.boolean
(integer_literal) @constant.numeric.integer

(comment) @comment.line
(function_id) @function
(keyword_arg_key) @variable.other.member
(id_expression) @variable

[
"if"
"elif"
"else"
"endif"
] @keyword.control.conditional

[
"foreach"
"endforeach"
] @keyword.control.repeat

[
"break"
"continue"
] @keyword.control

[
"not"
"in"
"and"
"or"
] @keyword.operator

[
"!"
"+"
"-"
"*"
"/"
"%"
"=="
"!="
">"
"<"
">="
"<="
] @operator

[
":"
","
] @punctuation.delimiter

[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
16 changes: 16 additions & 0 deletions runtime/queries/meson/indents.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
(method_expression)
(function_expression)
(array_literal)
(dictionary_literal)
(selection_statement)
(iteration_statement)
] @indent

[
")"
"]"
"}"
"endif"
"endforeach"
] @outdent

0 comments on commit 4724024

Please sign in to comment.