From 5a85f97739a98a512942281355ea85dca5462f68 Mon Sep 17 00:00:00 2001 From: Marco Thomas Date: Mon, 23 Aug 2021 18:37:44 +0200 Subject: [PATCH] Initial commit --- wgsl-highlighter.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 wgsl-highlighter.el diff --git a/wgsl-highlighter.el b/wgsl-highlighter.el new file mode 100644 index 0000000..5d7eae9 --- /dev/null +++ b/wgsl-highlighter.el @@ -0,0 +1,19 @@ +(setq wgsl-font-lock-keywords + '( + ;; functions names + ;;("fn[[:space:]]\\([[:alpha:]]+\\)" . font-lock-function-name-face) + ("fn\\|return" . font-lock-keyword-face) + ;; function parameters and types + ;("\\([[:alpha:]]+\\)\:" . font-lock-variable-name-face) + ;;("\:[[:space:]]\\([[:alpha:]]+\\)" . font-lock-type-face) + ;; structs + ("struct" . font-lock-keyword-face) + ;; types + ("f32\\|vec[[:digit:]]" . font-lock-type-face) + ;; built-ins + ("location\\|builtin" . font-lock-builtin-face) + )) + +(define-derived-mode wgsl-mode c-mode "wgsl" + "major mode for editing wgsl shader files." + (setq font-lock-defaults '(wgsl-font-lock-keywords)))