Use gdscript-mode-syntax-table instead of gdscript-syntax-table

Highlight '$' operator constant similar to Godot editor
This commit is contained in:
Josef Vlach
2020-06-23 21:14:18 +01:00
parent 86dcaa2430
commit e8f56823eb
2 changed files with 8 additions and 6 deletions

View File

@@ -110,9 +110,9 @@ the last command event was a string delimiter."
(setq-local tab-width gdscript-tab-width)
(setq-local indent-tabs-mode gdscript-use-tab-indents)
(set-syntax-table gdscript-syntax-table)
(modify-syntax-entry ?\# "\<" gdscript-syntax-table)
(modify-syntax-entry ?\n ">" gdscript-syntax-table)
(set-syntax-table gdscript-mode-syntax-table)
(modify-syntax-entry ?\# "\<" gdscript-mode-syntax-table)
(modify-syntax-entry ?\n ">" gdscript-mode-syntax-table)
(setq-local comment-start "# ")
(setq-local comment-start-skip "#+\\s-*")

View File

@@ -56,7 +56,11 @@
(_ form))))
;; Controls font-face mappings or colors to highlight groups of keywords
(defvar gdscript-font-lock `((,(gdscript-syntax-regex-maker gdscript-keywords)
(defvar gdscript-font-lock `((,(rx (and "$" (one-or-more (or "/" (one-or-more word)))))
(0 font-lock-constant-face))
(,(rx (and (group "$") "\"" (zero-or-more nonl) "\""))
(1 font-lock-constant-face))
(,(gdscript-syntax-regex-maker gdscript-keywords)
1
font-lock-keyword-face)
(,(gdscript-syntax-regex-maker (append gdscript-built-in-constants
@@ -82,8 +86,6 @@
"(")
(1 font-lock-function-name-face))))
(defvar gdscript-syntax-table (make-syntax-table))
(defun gdscript-syntax-context (type &optional syntax-ppss)
"Return non-nil if point is on TYPE using SYNTAX-PPSS.
TYPE can be `comment', `string' or `paren'. It returns the start