-
Notifications
You must be signed in to change notification settings - Fork 17
/
ceptr-mode.el
45 lines (33 loc) · 1.74 KB
/
ceptr-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
;;; ceptr-mode.el --- sample major mode for editing ceptr semantic trees.
;; Copyright © 2016, by Eric Harris-Braun
;; Author: Eric Harris-Braun ( [email protected] )
;; Version: 0.0.1
;; Created: 18 Apr 2016
;; Keywords: languages ceptr
;; Homepage: http://ceptr.org
;; This file is not part of GNU Emacs.
;;; License:
;; You can redistribute this program and/or modify it under the terms of the GNU General Public License version 2.
;;; Commentary:
;; major mode for editing text encoding of ceptr semantic trees
;;; Code:
(defvar ceptr-font-lock-defaults nil "Value for font-lock-defaults.")
(setq ceptr-font-lock-defaults
'(("\(\\([a-z_A-Z0-9_]+\\)" . (1 font-lock-function-name-face))
("\\(:\\)\"\\([^ ]+?\\)\"" (1 font-lock-builtin-face) (2 font-lock-string-face))
("\\(:\\)\\([0-9]+\\(.[0-9]+\\)?\\)" (1 font-lock-builtin-face) (2 font-lock-keyword-face)) ;integer or float surface
("\\(:\\)\\('.'\\)" (1 font-lock-builtin-face) (2 font-lock-string-face)) ;char surface
("\\(:\\)\\([a-z_A-Z0-9_]+\\)" (1 font-lock-builtin-face) (2 font-lock-type-face)) ;symbol surface
("\\(:\\)\\(/[0-9/]+\\)" (1 font-lock-builtin-face) (2 font-lock-string-face)) ;path surface
("\\([a-z_A-Z0-9!@#$%^&*-.]+\\)" . (1 font-lock-warning-face)) ;anything else
) )
(define-derived-mode ceptr-mode fundamental-mode "Ceptr"
"Major mode for editing Ceptr semantic trees"
(setq-local font-lock-defaults '(ceptr-font-lock-defaults))
(set (make-local-variable 'indent-line-function) 'lisp-indent-line)
(set (make-local-variable 'indent-tabs-mode) nil)
)
(progn
(add-to-list 'auto-mode-alist '("\\.cptr\\'" . ceptr-mode))
)
(provide 'ceptr)