Created
May 6, 2015 21:37
-
-
Save machinekoder/54896caf0477d8976ca2 to your computer and use it in GitHub Desktop.
Emacs HAL mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'generic-x) | |
(define-generic-mode hal-generic-mode | |
'("#") | |
(apply 'append | |
(mapcar #'(lambda (s) (list (upcase s) (downcase s) (capitalize s))) | |
'("loadrt" "loadusr" "addf" "setp" "sets" "start" | |
"newpin" "newcomp" "sete" | |
"newg" "newsig" "ready" "net" "log"))) | |
'(;;("\\(#<_?[A-Za-z0-9_]+>\\)" (1 font-lock-type-face)) | |
("[[:space:]=]+?\\([0-9]+\\(?:\\.?[0-9]+\\)?\\)" (1 font-lock-constant-face)) | |
("[[:space:]]+?\\(FALSE\\|TRUE\\)" (1 font-lock-constant-face)) | |
("\\(\\[[0-9a-zA-Z_]*\\][0-9a-zA-Z_]+\\)" (1 font-lock-variable-name-face)) | |
("[[:space:]]+?\\(u32\\|s32\\|int\\|bit\\|float\\)" (1 font-lock-type-face))) | |
;; ("\\([NnGgMmFfSsTtOo]\\)" (1 font-lock-function-name-face)) | |
;; ("\\([XxYyZzAaBbCcUuVvWwIiJjKkPpQqRr]\\)" (1 font-lock-string-face)) | |
;; | |
;; ("\\(#[0-9]+\\)" (1 font-lock-type-face)) | |
;; ("\\([0-9]+\\)" (1 font-lock-constant-face))) | |
'("\\.hal\\'") | |
nil | |
"Generic mode for HAL files.") | |
;; disable electric indent | |
(add-hook 'hal-generic-mode-hook (lambda () (electric-indent-local-mode -1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment