casl-mode.el revision f5ca7e49a6d1602c3f3a12ea6723fa67fea5757a
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg;;;###autoload
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(autoload 'turn-on-casl-indent "casl-indent" "Turn on CASL indentation." t)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg;; Version number
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg "Version of CASL-Mode")
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg "Major mode for editing (heterogeneous) CASL programs."
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(defvar casl-mode-map (let ((keymap (make-keymap)))
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (define-key keymap "\C-c\C-c" 'comment-region)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (define-key keymap "\C-c\C-r" 'casl-run-hets)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (define-key keymap "\C-c\C-g" 'casl-run-hets-g)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (define-key keymap "\C-c\C-n" 'casl-compile-goto-next-error)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg "Keymap for CASL major mode")
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg;; Are we running FSF Emacs or XEmacs?
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (string-match "Lucid\\|XEmacs" emacs-version)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg "non-nil if we are running XEmacs, nil otherwise.")
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg;; ============= K E Y W O R D H I G H L I G H T I N G ============
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(defvar casl-black-komma-face 'casl-black-komma-face
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg "Face name to use for black komma.")
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(defvar casl-annotation-face 'casl-annotation-face
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg "CASL mode face for Annotations")
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(setq casl-annotation-face 'font-lock-constant-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(setq casl-keyword-face 'font-lock-keyword-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(defvar casl-library-name-face 'casl-library-name-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(setq casl-library-name-face 'font-lock-type-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(setq casl-name-face 'font-lock-variable-name-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(setq casl-builtin-face 'font-lock-builtin-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(setq casl-comment-face 'font-lock-comment-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(defvar casl-other-name-face 'casl-other-name-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(setq casl-other-name-face 'font-lock-function-name-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(defvar casl-string-char-face 'casl-string-char-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg(setq casl-string-char-face 'font-lock-string-face)
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg;; Syntax highlighting of CASL
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; Keywords of loading Library
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\(\\<\\|\\s-+\\)\\(logic\\|from\\|get\\|library\\|version\\)[ :\t\n]+"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg;; '("\\(\\<\\|\\s-+\\)\\(%authors\\|%date\\|%display\\|%prec\\|%left_assoc\\|%number\\|%floating\\|%LATEX\\|%implies\\)[ :\t\n]+"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg;; (2 casl-annotation-face keep t))
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; Library and Logic name
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\(\\<\\|\\s-+\\)\\(library\\|logic\\)\\s-+\\(\\(\\w\\|/\\)+\\)[ \t\n]*"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; name of from, get and given
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\(\\<\\|[ \t]+\\)\\(get\\|given\\)[ \t\n]+\\(\\(\\sw+\\s-*\\(,\\|$\\)[ \t\n]*\\)+\\)"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\(\\<\\|\\s-+\\)from\\([ \t]+\\)\\(.+\\)\\(get\\|\\s-*\\)"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; the name of specification and view
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\(\\<\\|\\[\\)\\(spec\\|view\\)\\s-+\\(\\w+\\)[ \t]*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?\\s-*.*\\([]=:]\\|::=\\)"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (3 casl-name-face keep t) (5 casl-name-face keep t))
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; then, and + name
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\(\\<\\|\\s-+\\)\\(and\\|then\\)[ \t\n]*\\([A-Z]\\w*\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (3 casl-name-face keep t) (5 casl-name-face keep t))
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; names before and after to
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("[ \t\n]*\\(\\w+\\)[ \t\n]+to[ \t\n]+\\(\\(\\w+\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?[, \t]*\\)?"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (1 casl-name-face keep t) (3 casl-name-face keep t) (5 casl-name-face keep t))
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; instance name of specification
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\<spec.+=\\s-*\\(%\\sw+\\s-*\\)?[ \t\n]*\\([A-Z]\\sw*\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (2 casl-name-face keep t) (4 casl-name-face keep t))
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; Basic signature: sort X, Y, Z
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\(\\<\\|\\s-+\\)sorts?[ \t]+\\(\\(\\sw+\\s-*\\(\\[\\(\\sw\\|,\\)+\\]\\s-*\\)?\\(,\\(\\s-\\)*\\|$\\|<\\|;\\|=\\)\\(\\sw\\|=\\|<\\|;\\|,\\)*[ \t\n]*\\)+\\)"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; Basic signature: op ,pred and var name
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\(^\\|\\bops?\\|\\bpreds?\\|\\bvars?\\)\\s-+\\([^.]\\(,\\s-*\\)?\\(\\sw\\(,\\s-*\\)?\\|\\(\\s_\\|\\s_+::?\\s_+\\)\\(,\\s-*\\)?\\|\\s(\\|\\s)\\)*\\)\\s-*\\(\(.*\)\\)?\\s-*\\(:\\??\\|<=>\\)[^:\n]*;?[ \t]*$"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\s-+\\(\\sw+\\)[ \t\n]*::?=\\s-*\\(\\sw*\\).*"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (1 casl-other-name-face keep t) (2 casl-other-name-face keep t) )
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg ;; constructor
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\\(\\sw+\\)?\\s-*|\\s-*\\(\\sw+\\)\\s-*[|(]?\\([ \t\n]*\\|$\\)"
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg (1 casl-other-name-face keep t) (2 casl-other-name-face keep t))
c26d823dc3bd1807572e31d2d4d85c4eabf1cc7cJoe Bandenburg '("\(\\(\\(\\sw\\|,\\)*\\)\\s-*:\\??[^)]*\)"
'("[ \t\n]*\\([^[ \t\n]+\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?[ \t\n]+|->[ \t\n]+\\([^[ \t\n]+\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?[, \t]*"
'("\\(\\<\\|\\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 casl-mode-syntax-table nil
(defun casl-vars ()
(defun casl-comment-indent ()
(defvar hets-program nil)
(defvar old-buffer nil)
(save-buffer nil)
(if hets-program
(if opt
(set-buffer-modified-p nil)
(let* ((process-environment
(window-width))))
hets-command)))
(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()