Add dee-mode.el for emacs
This commit is contained in:
parent
2e04bcdfc1
commit
35e7c66f68
59
dee-mode.el
Normal file
59
dee-mode.el
Normal file
@ -0,0 +1,59 @@
|
||||
;; A major mode for editing scripts written in Deelang
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.dee\\'" . dee-mode))
|
||||
|
||||
(defface dee-function-param-face
|
||||
'((t . (:slant italic
|
||||
:weight bold
|
||||
:foreground "orange")))
|
||||
"A face to help identify function parameter in Deelang.")
|
||||
|
||||
(defcustom dee-indent-offset 4
|
||||
"Default indentation offset for Deelang."
|
||||
:group 'dee
|
||||
:type 'integer
|
||||
:safe 'integerp)
|
||||
|
||||
(defvar dee-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
map)
|
||||
"Keymap for Deelang files")
|
||||
|
||||
(defvar dee-mode-syntax-table
|
||||
(let ((table (make-syntax-table)))
|
||||
(modify-syntax-entry ?# "<" table)
|
||||
(modify-syntax-entry ?\n ">" table)
|
||||
(modify-syntax-entry ?- "w" table)
|
||||
(modify-syntax-entry ?? "w" table)
|
||||
table)
|
||||
"Syntax table for Deelang files")
|
||||
|
||||
(defvar dee-font-lock-id-re
|
||||
(rx (seq alpha (* (any alnum ?- ??)))))
|
||||
|
||||
(defvar dee-font-lock-keywords
|
||||
`(,(rx symbol-start
|
||||
(or
|
||||
"if" "elif" "else" "")
|
||||
symbol-end)
|
||||
(,(rx (group (regexp dee-font-lock-id-re)) (* space) "<-")
|
||||
(1 font-lock-variable-name-face))
|
||||
(,(rx (group (regexp dee-font-lock-id-re)) (* space) "->")
|
||||
(1 'dee-function-param-face))
|
||||
(,(rx (group (regexp dee-font-lock-id-re)) (* space) "(")
|
||||
(1 font-lock-function-name-face))))
|
||||
|
||||
(defun dee-indent-line-function ()
|
||||
'noindent) ;TODO
|
||||
|
||||
(define-derived-mode dee-mode prog-mode "Dee"
|
||||
"Major mode for editing scripts written in Deelang.
|
||||
|
||||
\\{dee-mode-map}"
|
||||
(set (make-local-variable 'indent-line-function)
|
||||
#'dee-indent-line-function)
|
||||
(set (make-local-variable 'font-lock-defaults)
|
||||
`(,dee-font-lock-keywords
|
||||
nil nil nil nil)))
|
||||
|
||||
(provide 'dee)
|
Loading…
Reference in New Issue
Block a user