aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2021-12-14 10:47:47 +0000
committerStephan Seitz <stephan.seitz@fau.de>2021-12-14 14:59:38 +0100
commit567c644e5372d661ed36937ce7db6dc7155d97d1 (patch)
tree9ed0e4c0e97d03bbc027b24085536dc11bcd1eab
parentinjections(rust): inject regex into `Regex::new` (diff)
downloadnvim-treesitter-567c644e5372d661ed36937ce7db6dc7155d97d1.tar
nvim-treesitter-567c644e5372d661ed36937ce7db6dc7155d97d1.tar.gz
nvim-treesitter-567c644e5372d661ed36937ce7db6dc7155d97d1.tar.bz2
nvim-treesitter-567c644e5372d661ed36937ce7db6dc7155d97d1.tar.lz
nvim-treesitter-567c644e5372d661ed36937ce7db6dc7155d97d1.tar.xz
nvim-treesitter-567c644e5372d661ed36937ce7db6dc7155d97d1.tar.zst
nvim-treesitter-567c644e5372d661ed36937ce7db6dc7155d97d1.zip
feat(lang): add make
-rw-r--r--lua/nvim-treesitter/parsers.lua10
-rw-r--r--queries/make/highlights.scm105
-rw-r--r--queries/make/injections.scm4
3 files changed, 119 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 9bf46ec47..a757fdd14 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -791,6 +791,7 @@ list.http = {
},
maintainers = { "@NTBBloodbath" },
}
+
list.prisma = {
install_info = {
url = "https://github.com/victorhqc/tree-sitter-prisma",
@@ -800,6 +801,15 @@ list.prisma = {
maintainers = { "@elianiva" },
}
+list.make = {
+ install_info = {
+ url = "https://github.com/alemuller/tree-sitter-make",
+ branch = "main",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@lewis6991" },
+}
+
local M = {
list = list,
}
diff --git a/queries/make/highlights.scm b/queries/make/highlights.scm
new file mode 100644
index 000000000..ee4b83a24
--- /dev/null
+++ b/queries/make/highlights.scm
@@ -0,0 +1,105 @@
+(comment) @comment
+
+(conditional
+ (_ [
+ "ifeq"
+ "else"
+ "ifneq"
+ "ifdef"
+ "ifndef"
+ ] @conditional)
+ "endif" @conditional)
+
+(rule (targets
+ (word) @function.builtin
+ (#any-of? @function.builtin
+ ".PHONY"
+ ".SUFFIXES")))
+
+(rule ["&:" ":" "::"] @operator)
+
+(export_directive "export" @keyword)
+(override_directive "override" @keyword)
+(include_directive ["include" "-include"] @include)
+
+(variable_assignment
+ (word) @symbol)
+(variable_assignment [
+ "?="
+ ":="
+ "+="
+ "="
+ ] @operator)
+
+
+(variable_assignment
+ (word) @variable.builtin
+ (#any-of? @variable.builtin
+ ".DEFAULT_GOAL"
+ ".EXTRA_PREREQS"
+ ".FEATURES"
+ ".INCLUDE_DIRS"
+ ".RECIPEPREFIX"
+ ".SHELLFLAGS"
+ ".VARIABLES"
+ "MAKEARGS"
+ "MAKEFILE_LIST"
+ "MAKEFLAGS"
+ "MAKE_RESTARTS"
+ "MAKE_TERMERR"
+ "MAKE_TERMOUT"
+ "SHELL"
+ )
+ )
+
+
+
+; Use string to match bash
+(variable_reference (word) @string ) @operator
+
+
+(shell_function
+ ["$" "(" ")"] @operator
+ "shell" @function.builtin
+ )
+
+(function_call ["$" "(" ")"] @operator)
+
+(function_call [
+ "subst"
+ "patsubst"
+ "strip"
+ "findstring"
+ "filter"
+ "filter-out"
+ "sort"
+ "word"
+ "words"
+ "wordlist"
+ "firstword"
+ "lastword"
+ "dir"
+ "notdir"
+ "suffix"
+ "basename"
+ "addsuffix"
+ "addprefix"
+ "join"
+ "wildcard"
+ "realpath"
+ "abspath"
+ "error"
+ "warning"
+ "info"
+ "origin"
+ "flavor"
+ "foreach"
+ "if"
+ "or"
+ "and"
+ "call"
+ "eval"
+ "file"
+ "value"
+ ] @function.builtin
+)
diff --git a/queries/make/injections.scm b/queries/make/injections.scm
new file mode 100644
index 000000000..3add7f494
--- /dev/null
+++ b/queries/make/injections.scm
@@ -0,0 +1,4 @@
+(comment) @comment
+
+(shell_text) @bash
+(shell_command) @bash