forked from helix-editor/helix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds syntax highlighting for GNU Make[^1] makefiles via tree-sitter-make[^2]. [^1]: https://www.gnu.org/software/make/ [^2]: https://github.com/alemuller/tree-sitter-make
- Loading branch information
1 parent
c238f20
commit 1c6bc6d
Showing
5 changed files
with
184 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule tree-sitter-make
added at
a4b918
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
[ | ||
"(" | ||
")" | ||
"{" | ||
"}" | ||
] @punctuation.bracket | ||
|
||
[ | ||
":" | ||
"&:" | ||
"::" | ||
"|" | ||
";" | ||
"\"" | ||
"'" | ||
"," | ||
] @punctuation.delimiter | ||
|
||
[ | ||
"$" | ||
"$$" | ||
] @punctuation.special | ||
|
||
(automatic_variable | ||
[ "@" "%" "<" "?" "^" "+" "/" "*" "D" "F"] @punctuation.special) | ||
|
||
(automatic_variable | ||
"/" @error . ["D" "F"]) | ||
|
||
[ | ||
"=" | ||
":=" | ||
"::=" | ||
"?=" | ||
"+=" | ||
"!=" | ||
"@" | ||
"-" | ||
"+" | ||
] @operator | ||
|
||
[ | ||
(text) | ||
(string) | ||
(raw_text) | ||
] @string | ||
|
||
(variable_assignment (word) @string) | ||
|
||
[ | ||
"ifeq" | ||
"ifneq" | ||
"ifdef" | ||
"ifndef" | ||
"else" | ||
"endif" | ||
"if" | ||
"or" ; boolean functions are conditional in make grammar | ||
"and" | ||
] @keyword.control.conditional | ||
|
||
"foreach" @keyword.control.repeat | ||
|
||
[ | ||
"define" | ||
"endef" | ||
"vpath" | ||
"undefine" | ||
"export" | ||
"unexport" | ||
"override" | ||
"private" | ||
; "load" | ||
] @keyword | ||
|
||
[ | ||
"include" | ||
"sinclude" | ||
"-include" | ||
] @keyword.control.import | ||
|
||
[ | ||
"subst" | ||
"patsubst" | ||
"strip" | ||
"findstring" | ||
"filter" | ||
"filter-out" | ||
"sort" | ||
"word" | ||
"words" | ||
"wordlist" | ||
"firstword" | ||
"lastword" | ||
"dir" | ||
"notdir" | ||
"suffix" | ||
"basename" | ||
"addsuffix" | ||
"addprefix" | ||
"join" | ||
"wildcard" | ||
"realpath" | ||
"abspath" | ||
"call" | ||
"eval" | ||
"file" | ||
"value" | ||
"shell" | ||
] @keyword.function | ||
|
||
[ | ||
"error" | ||
"warning" | ||
"info" | ||
] @keyword.control.exception | ||
|
||
;; Variable | ||
(variable_assignment | ||
name: (word) @variable) | ||
|
||
(variable_reference | ||
(word) @variable) | ||
|
||
(comment) @comment | ||
|
||
((word) @clean @string.regexp | ||
(#match? @clean "[%\*\?]")) | ||
|
||
(function_call | ||
function: "error" | ||
(arguments (text) @error)) | ||
|
||
(function_call | ||
function: "warning" | ||
(arguments (text) @warning)) | ||
|
||
(function_call | ||
function: "info" | ||
(arguments (text) @info)) | ||
|
||
;; Install Command Categories | ||
;; Others special variables | ||
;; Variables Used by Implicit Rules | ||
[ | ||
"VPATH" | ||
".RECIPEPREFIX" | ||
] @constant.builtin | ||
|
||
(variable_assignment | ||
name: (word) @clean @constant.builtin | ||
(#match? @clean "^(AR|AS|CC|CXX|CPP|FC|M2C|PC|CO|GET|LEX|YACC|LINT|MAKEINFO|TEX|TEXI2DVI|WEAVE|CWEAVE|TANGLE|CTANGLE|RM|ARFLAGS|ASFLAGS|CFLAGS|CXXFLAGS|COFLAGS|CPPFLAGS|FFLAGS|GFLAGS|LDFLAGS|LDLIBS|LFLAGS|YFLAGS|PFLAGS|RFLAGS|LINTFLAGS|PRE_INSTALL|POST_INSTALL|NORMAL_INSTALL|PRE_UNINSTALL|POST_UNINSTALL|NORMAL_UNINSTALL|MAKEFILE_LIST|MAKE_RESTARTS|MAKE_TERMOUT|MAKE_TERMERR|\.DEFAULT_GOAL|\.RECIPEPREFIX|\.EXTRA_PREREQS)$")) | ||
|
||
(variable_reference | ||
(word) @clean @constant.builtin | ||
(#match? @clean "^(AR|AS|CC|CXX|CPP|FC|M2C|PC|CO|GET|LEX|YACC|LINT|MAKEINFO|TEX|TEXI2DVI|WEAVE|CWEAVE|TANGLE|CTANGLE|RM|ARFLAGS|ASFLAGS|CFLAGS|CXXFLAGS|COFLAGS|CPPFLAGS|FFLAGS|GFLAGS|LDFLAGS|LDLIBS|LFLAGS|YFLAGS|PFLAGS|RFLAGS|LINTFLAGS|PRE_INSTALL|POST_INSTALL|NORMAL_INSTALL|PRE_UNINSTALL|POST_UNINSTALL|NORMAL_UNINSTALL|MAKEFILE_LIST|MAKE_RESTARTS|MAKE_TERMOUT|MAKE_TERMERR|\.DEFAULT_GOAL|\.RECIPEPREFIX|\.EXTRA_PREREQS\.VARIABLES|\.FEATURES|\.INCLUDE_DIRS|\.LOADED)$")) | ||
|
||
;; Standart targets | ||
(targets | ||
(word) @constant.macro | ||
(#match? @constant.macro "^(all|install|install-html|install-dvi|install-pdf|install-ps|uninstall|install-strip|clean|distclean|mostlyclean|maintainer-clean|TAGS|info|dvi|html|pdf|ps|dist|check|installcheck|installdirs)$")) | ||
|
||
(targets | ||
(word) @constant.macro | ||
(#match? @constant.macro "^(all|install|install-html|install-dvi|install-pdf|install-ps|uninstall|install-strip|clean|distclean|mostlyclean|maintainer-clean|TAGS|info|dvi|html|pdf|ps|dist|check|installcheck|installdirs)$")) | ||
|
||
;; Builtin targets | ||
(targets | ||
(word) @constant.macro | ||
(#match? @constant.macro "^\.(PHONY|SUFFIXES|DEFAULT|PRECIOUS|INTERMEDIATE|SECONDARY|SECONDEXPANSION|DELETE_ON_ERROR|IGNORE|LOW_RESOLUTION_TIME|SILENT|EXPORT_ALL_VARIABLES|NOTPARALLEL|ONESHELL|POSIX)$")) |