Created
October 30, 2024 14:35
-
-
Save chrisdone-artificial/6a8228f44e3800394a3b4b8b9923efe5 to your computer and use it in GitHub Desktop.
TLA+ emacs 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
;; Initial version copied from Pawel Szulc | |
(define-derived-mode tla-mode fundamental-mode "tla" | |
"Major Mode For Editing TLA language code." | |
(setq font-lock-defaults '(tla-highlights)) | |
(font-lock-add-keywords nil '(("\\\\\\*.+" . font-lock-comment-face))) | |
(font-lock-add-keywords nil '(("====.+" . font-lock-doc-face))) | |
(font-lock-add-keywords nil '(("----.+" . font-lock-doc-face))) | |
(font-lock-add-keywords nil '(("(\\*.+" . font-lock-doc-face))) | |
(setq-local comment-start "\\* ") | |
(setq-local comment-end "")) | |
(defconst tla-highlights | |
`((,(concat | |
"\\<" | |
(regexp-opt | |
(list "ASSUME" "UNCHANGED" "EXCEPT" "EXTENDS" "RECURSIVE" "CONSTANT" "VARIABLES" "VARIABLE" "SUBSET")) | |
"\\>") | |
. font-lock-keyword-face) | |
(".+ ==" . font-lock-function-name-face) | |
(,(regexp-opt | |
(list "\\in" "\\cup" "\\A" "\\E" "/\\" "\\/" "->" ".." "=")) | |
. font-lock-keyword-face) | |
(,(concat | |
"\\<" | |
(regexp-opt | |
(list "TRUE" "FALSE" "Nat" "IF" "ELSE" "THEN")) | |
"\\>") | |
. font-lock-constant-face))) | |
(provide 'tla-mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment