Add simple mode for highlighting QL dbschemes

This commit is contained in:
Robin Neatherway 2019-02-18 17:05:37 +00:00
Родитель 1b25573cc0
Коммит 88bc1be98f
3 изменённых файлов: 39 добавлений и 1 удалений

Просмотреть файл

@ -11,6 +11,7 @@ Example:
(add-to-list 'load-path "~/ql/misc/emacs")
(require 'ql-mode-base)
(require 'dbscheme-mode)
; ...
```

Просмотреть файл

@ -0,0 +1,37 @@
;;; dbscheme-mode.el --- A major mode for editing Semmle database schema files
;;; Commentary:
;;
;; A basic major mode for editing Semmle database schema files.
;;
;; Provides syntax highlightning and comment support.
;;; Code:
(define-generic-mode
'dbscheme-mode ; mode name
;; comments
'(("//" . nil)
("/*" . "*/"))
;; keywords
'("case" "ref" "unique" "of")
;; other things to highlight
`((,ql--primitive-type-regex . 'font-lock-type-face)
("\\<varchar([0-9]+)" . 'font-lock-type-face)
(,ql--at-type-regex 0 'font-lock-type-face)
(,ql--predicate-regex 1 'font-lock-variable-name-face))
;; auto mode alist
'("\\.dbscheme$")
;; other function to run
'((lambda ()
(modify-syntax-entry ?_ "w" (syntax-table))
(modify-syntax-entry ?@ "_" (syntax-table))))
"A mode for database schema files")
(provide 'dbscheme-mode)
;;; dbscheme-mode.el ends here

Просмотреть файл

@ -5,7 +5,7 @@
;; A basic major mode for editing QL files, a more advanced major
;; mode is available for internal use at Semmle.
;;
;; Provides syntax highlightning, comment support, and a mode-specific
;; Provides syntax highlighting, comment support, and a mode-specific
;; keymap.
;;; Code: