casl-mode.el revision c0cf296297fcfc4497b5fb4238ff2e02f2edb9c6
e9458b1a7a19a63aa4c179f9ab20f4d50681c168Jens Elkner(autoload 'turn-on-casl-indent "casl-indent" "Turn on CASL indentation." t)
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder;; Version number
ffd328462d99eb679e14c0d81e8dde21e046c59fJonathan von Schroeder "Version of CASL-Mode")
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder "Major mode for editing (heterogeneous) CASL programs."
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder(defvar casl-mode-map (let ((keymap (make-keymap)))
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder (define-key keymap "\C-c\C-c" 'comment-region)
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder (define-key keymap "\C-c\C-r" 'casl-run-hets-r)
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder (define-key keymap "\C-c\C-g" 'casl-run-hets-g)
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder (define-key keymap "\C-c\C-n" 'casl-compile-goto-next-error)
ffd328462d99eb679e14c0d81e8dde21e046c59fJonathan von Schroeder "Keymap for CASL major mode")
ffd328462d99eb679e14c0d81e8dde21e046c59fJonathan von Schroeder;; Are we running FSF Emacs or XEmacs?
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder (string-match "Lucid\\|XEmacs" emacs-version)
ffd328462d99eb679e14c0d81e8dde21e046c59fJonathan von Schroeder "non-nil if we are running XEmacs, nil otherwise.")
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder;; ====================== S Y N T A X T A B L E ==================
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder;; Syntax table for CASL major mode
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder "Syntax table for CASL mode.")
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder ;; Indicate that underscore may be part of a word
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder ((modify-syntax-entry ?% ". 58" table)
ffd328462d99eb679e14c0d81e8dde21e046c59fJonathan von Schroeder (modify-syntax-entry ?\[ "(] 6" table)
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder (modify-syntax-entry ?\] ")[ 7" table))
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder (modify-syntax-entry ?% ". 14nb" table)
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder (modify-syntax-entry ?\[ "(] 2n" table)
ffd328462d99eb679e14c0d81e8dde21e046c59fJonathan von Schroeder (modify-syntax-entry ?\] ")[ 3n" table))
ffd328462d99eb679e14c0d81e8dde21e046c59fJonathan von Schroeder ;; commenting-out plus including other kinds of comment
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder ;; Some of these are actually OK by default.
81f49ee02aaa3bc870401f8883bf52742eb3ea7aJonathan von Schroeder "!#$&*+.,/\\\\:<=>?@^|~()[]{}")
(defun casl-vars ()
(defun casl-comment-indent ()
(list
;; '("\\(\\<\\|\\s-+\\)\\(%authors\\|%date\\|%display\\|%prec\\|%left_assoc\\|%number\\|%floating\\|%LATEX\\|%implies\\)[ :\t\n]+"
'("\\(\\<\\|[ \t]+\\)\\(get\\|given\\)[ \t\n]+\\(\\(\\(\\sw+\\)\\s-*,?[ \t\n]*\\)+\\)\\(=\\|:\\|$\\)"
'("\\(\\<\\|\\[\\)\\(spec\\|view\\)\\s-+\\(\\w+\\)[ \t]*\\(\\[\\s-*\\([A-Z]\\w*\\).*\\s-*\\]\\)?\\s-*.*\\([]=:]\\|::=\\)"
'("[ \t\n]*\\(\\sw+\\)[ \t\n]+to[ \t\n]+\\(\\(\\sw+\\)\\s-*\\(\\[\\([A-Z]\\sw*\\).*\\]\\)?[, \t]*\\)?"
'("\\<spec.+=\\s-*\\(%\\sw+\\s-*\\)?[ \t\n]*\\([A-Z]\\w*\\)\\s-*\\(\\[\\s-*\\([A-Z]\\w*\\).*\\s-*\\]\\)?"
'("\\(\\<\\|\\s-+\\)sorts?[ \t]+\\(\\(\\sw+\\s-*\\(\\[\\s-*\\(\\sw\\|,\\)+\\s-*\\]\\s-*\\)?\\(,\\(\\s-\\)*\\|$\\|<\\|;\\|=\\)\\(=\\|<\\|;\\|,\\)*[ \t\n]*\\)+\\)"
'("\\(\\bops?\\b\\|\\bpreds?\\b\\|\\bvars?\\b\\|^\\(__\\|<[^.{%]\\)\\(,[ \t\n]*\\)?\\)[ \t\n]*\\(\\(\\sw\\(,[ \t\n]*\\)?\\|\\s-*__\\s-*\\(,[ \t\n]*\\)?\\|\\(\\s_\\|__::?__\\)\\(,[ \t\n]*\\)?\\|\\s\(\\|\\s\)\\)*\\)\\s-*\\(\(.*\)\\)?\\s-*\\(:\\??\\|<=>\\)[^:=][^:_\n]*;?[ \t]*$"
'("[ \t\n]*\\(__[^|_]+__\\|[^[ \t\n]+\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?[ \t\n]*|->[ \t\n]*\\(__[^|_]+__\\|[^[ \t\n]+\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?[, \t]*"
'("\\(\\btype\\|\\bfree type\\)?\\s-+\\(\\sw+\\)\\s-+\\(\\sw*\\|\\[\\(\\s-*\\sw+\\s-*\\)\\]\\)[ \t\n]*::?=[ \t\n]*\\(\\(\_\_[^_]+\_\_\\|[^|][^(|]+\\)\\s-*\\(\(.*\)\\)?\\)"
'("\\(\\<\\|\\s-+\\)\\(/\\\\\\|\\\\/\\|=>\\|<=>\\|and\\|arch\\|assoc\\|behaviourally\\|closed\\|comm\\|else\\|end\\|exists\\|fit\\|forall\\|free\\|generated\\|given\\|hide\\|idem\\|if\\|local\\|not\\|refined\\|refinement\\|reveal\\|spec\\|then\\|to\\|unit\\|via\\|view\\|when\\|within\\|with\\|\\(\\(op\\|pred\\|var\\|type\\|sort\\)s?\\)\\)[,;]?[ \t\n]"
(list '("\\(\\(\"\\|^>[ \t]*\\\\\\)\\([^\"\\\\\n]\\|\\\\.\\)*\\(\"\\|\\\\[ \t]*$\\)\\|'\\([^'\\\\\n]\\|\\\\.[^'\n]*\\)'\\)" (0 casl-string-char-face t t))
(list
(defvar hets-program nil)
(defvar old-buffer nil)
(defvar casl-hets-options '()
(save-buffer nil)
(if hets-program
(if opt
(set-buffer-modified-p nil)
(let* ((process-environment
(window-width))))
hets-command)))
(if opt
(defun casl-run-hets-g ()
msg)
(let ((buffer-read-only nil)
(if (bolp)
(defun casl-parse-error ()
(re-search-forward ":\\([0-9]+\\)\\.\\([0-9]+\\)\\(-[0-9]+\\.[0-9]*\\)?[:,]" (save-excursion (end-of-line) (point)) t 1)
(defun casl-compile-goto-next-error ()
;; (message "DEBUG<Goto Error>: file: %s, line: %s, column: %s" error-file-name error-line error-column)
(defun casl-mode ()
;; Support for compile.el
(lambda()