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 Apr 28, 2022
1 parent 477b88e commit edf11d6
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 @@ -48,6 +48,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 @@ -1263,3 +1263,16 @@ indent = { tab-width = 4, unit = "\t" }
[[grammar]]
name = "hare"
source = { git = "https://git.sr.ht/~ecmma/tree-sitter-hare", rev = "bc26a6a949f2e0d98b7bfc437d459b250900a165" }

[[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.builtin.numeric.integer

(comment) @comment.line
(function_id) @function
(keyword_arg_key) @property
(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 edf11d6

Please sign in to comment.