Created
June 18, 2016 21:05
-
-
Save svanellewee/6750f9efcf47d6966228762f438f3b77 to your computer and use it in GitHub Desktop.
WPDL mode, does syntax highlight, comments no indents.
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
;; No indentation code: | |
;; from here : https://www.emacswiki.org/emacs/ModeTutorial | |
(defvar wpdl-mode-hook nil | |
"define list of hooks to run") | |
(defvar wpdl-mode-map | |
(let ((map (make-keymap))) | |
(define-key map "\C-j" 'newline-and-indent) | |
map) | |
"Keymap for WPDL major mode") | |
(add-to-list 'auto-mode-alist '("\\.wpd\\'" . wpdl-mode)) | |
(defconst wpdl-font-lock-keywords-1 | |
(list | |
'("\\<\\(A\\(CTIVITY\\|PPLICATION\\)\\|DATA\\|END_\\(A\\(CTIVITY\\|PPLICATION\\)\\|DATA\\|MODEL\\|PARTICIPANT\\|T\\(OOL_LIST\\|RANSITION\\)\\|WORKFLOW\\)\\|MODEL\\|PARTICIPANT\\|T\\(OOL_LIST\\|RANSITION\\)\\|WORKFLOW\\)\\>" . font-lock-builtin-face) | |
'("\\('\\w*'\\)" . font-lock-variable-name-face)) | |
"Minimal highlighting expressions for WPDL mode") | |
(defconst wpdl-font-lock-keywords-2 | |
(append wpdl-font-lock-keywords-1 | |
(list | |
'("\\<\\(AUTHOR\\|C\\(ONDITION\\|REATED\\)\\|DE\\(FAULT_VALUE\\|SCRIPTION\\)\\|EXTENDED_ATTRIBUTE\\|FROM\\|I\\(MPLEMENTATION\\|N_PARAMETERS\\)\\|JOIN\\|NAME\\|O\\(THERWISE\\|UT_PARAMETERS\\)\\|PERFORMER\\|ROUTE\\|S\\(PLIT\\|TATUS\\)\\|T\\(O\\(OLNAME\\)?\\|YPE\\)\\|VENDOR\\|WPDL_VERSION\\)\\>" . font-lock-keyword-face) | |
'("\\<\\(TRUE\\|FALSE\\)\\>" . font-lock-constant-face))) | |
"Additional Keywords to highlight in WPDL mode") | |
(defconst wpdl-font-lock-keywords-3 | |
(append wpdl-font-lock-keywords-2 | |
(list | |
'("\\<\\(A\\(ND\\|PPLICATIONS\\)\\|BOOLEAN\\|HUMAN\\|INTEGER\\|NO\\|OR\\(GANISATIONAL_UNIT\\)?\\|R\\(EFERENCE\\|OLE\\)\\|S\\(TRING\\|YNCHR\\)\\|UNDER_REVISION\\|WORKFLOW\\|XOR\\)\\>" . font-lock-constant-face))) | |
"Balls-out highlighting in WPDL mode") | |
(defvar wpdl-font-lock-keywords wpdl-font-lock-keywords-3 | |
"Default highlighting expressions for WPDL mode") | |
(defvar wpdl-mode-syntax-table | |
(let ((st (make-syntax-table))) | |
(modify-syntax-entry ?_ "w" st) | |
(modify-syntax-entry ?/ ". 124b" st) | |
;;(modify-syntax-entry ?* ". 23" st) | |
(modify-syntax-entry ?\n "> b" st) | |
st) | |
"Syntax table for wpdl-mode") | |
(defun wpdl-mode () | |
"Major mode for editing Workflow Process Description Language files" | |
(interactive) | |
(kill-all-local-variables) | |
(set-syntax-table wpdl-mode-syntax-table) | |
(use-local-map wpdl-mode-map) | |
(set (make-local-variable 'font-lock-defaults) '(wpdl-font-lock-keywords)) | |
(setq major-mode 'wpdl-mode) | |
(setq mode-name "WPDL!") | |
(run-hooks 'wpdl-mode-hook)) | |
(provide 'wpdl-mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment