First version of GIDL mode
Getty Ritter
9 years ago
1 | ;; gidl-mode.el --- a simple major mode for editing GIDL files. | |
2 | ||
3 | ;; Version: 20150507.0000 | |
4 | ;; Author: Getty Ritter | |
5 | ;; Url: https://github.com/aisamanra/gidl-mode | |
6 | ||
7 | (setq gidl-font-lock | |
8 | '(( "def-\\(enum\\|struct\\|newtype\\|interface\\)" | |
9 | . font-lock-keyword-face ) | |
10 | ( "def-\\(enum\\|struct\\|newtype\\|interface\\) (?\\([A-Za-z0-9_-]*\\)" | |
11 | 2 font-lock-function-name-face ) | |
12 | ( "[us]int\\(8\\|16\\|32\\|64\\)_t\\|bool_t\\|float_t\\|double_t" | |
13 | . font-lock-builtin-face))) | |
14 | ||
15 | (defvar gidl-syntax-table nil "Syntax table for `gidl-mode'.") | |
16 | (setq gidl-syntax-table | |
17 | (let ((table (make-syntax-table))) | |
18 | (modify-syntax-entry ?- ". 12b" table) | |
19 | (modify-syntax-entry ?\n "> b" table) | |
20 | (modify-syntax-entry ?( "($") | |
21 | (modify-syntax-entry ?) ")^") | |
22 | ||
23 | table)) | |
24 | ||
25 | (define-derived-mode gidl-mode prog-mode | |
26 | "GIDL mode is a major mode for editing GIDL files" | |
27 | :syntax-table gidl-syntax-table | |
28 | ||
29 | (setq font-lock-defaults '(gidl-font-lock)) | |
30 | (setq mode-name "GIDL mode") | |
31 | (setq comment-start "--") | |
32 | (setq comment-end "")) | |
33 | ||
34 | (provide 'gidl-mode) | |
35 | ||
36 | ;;; gidl-mode.el ends here |