| 1 | ;; | 
|---|
| 2 | ;; keyval.el: Mode for MPQC input files | 
|---|
| 3 | ;; | 
|---|
| 4 | ;; Copyright (C) 1996 Limit Point Systems, Inc. | 
|---|
| 5 | ;; | 
|---|
| 6 | ;; Author: Curtis Janssen <cljanss@ca.sandia.gov> | 
|---|
| 7 | ;; Maintainer: SNL | 
|---|
| 8 | ;; | 
|---|
| 9 | ;; This file is part of MPQC. | 
|---|
| 10 | ;; | 
|---|
| 11 | ;; MPQC is free software; you can redistribute it and/or modify | 
|---|
| 12 | ;; it under the terms of the GNU General Public License as published by | 
|---|
| 13 | ;; the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 14 | ;; any later version. | 
|---|
| 15 | ;; | 
|---|
| 16 | ;; MPQC is distributed in the hope that it will be useful, | 
|---|
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 19 | ;; GNU General Public License for more details. | 
|---|
| 20 | ;; | 
|---|
| 21 | ;; You should have received a copy of the GNU General Public License | 
|---|
| 22 | ;; along with the MPQC; see the file COPYING.  If not, write to | 
|---|
| 23 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 
|---|
| 24 | ;; | 
|---|
| 25 | ;; The U.S. Government is granted a limited license as per AL 91-7. | 
|---|
| 26 | ;; | 
|---|
| 27 |  | 
|---|
| 28 | ;;;###autoload | 
|---|
| 29 | (defvar keyval-mode-hook nil | 
|---|
| 30 | "*List of hook functions run by `keyval-mode' (see `run-hooks').") | 
|---|
| 31 |  | 
|---|
| 32 | (defvar keyval-mode-map | 
|---|
| 33 | (let ((map (make-sparse-keymap))) | 
|---|
| 34 | ;(define-key map " " 'scroll-up) | 
|---|
| 35 | ;(define-key map "\^?" 'scroll-down) | 
|---|
| 36 | map) | 
|---|
| 37 | "Keymap for KeyVal input buffers.") | 
|---|
| 38 |  | 
|---|
| 39 | (defun keyval-mode () | 
|---|
| 40 | "Major mode for KeyVal input files." | 
|---|
| 41 | (interactive) | 
|---|
| 42 | (fundamental-mode) | 
|---|
| 43 | (use-local-map keyval-mode-map) | 
|---|
| 44 | (setq major-mode 'keyval-mode | 
|---|
| 45 | mode-name "KeyVal") | 
|---|
| 46 | (keyval-setup) | 
|---|
| 47 | (make-local-variable 'font-lock-defaults) | 
|---|
| 48 | (setq font-lock-defaults '(keyval-font-lock-keywords t t)) | 
|---|
| 49 | (run-hooks 'keyval-mode-hook)) | 
|---|
| 50 |  | 
|---|
| 51 | (defun keyval-setup ()) | 
|---|
| 52 |  | 
|---|
| 53 | (defvar keyval-key-face 'keyval-key-face | 
|---|
| 54 | "Face for keys in KeyVal file.") | 
|---|
| 55 | (make-face keyval-key-face) | 
|---|
| 56 | (make-face-bold keyval-key-face) | 
|---|
| 57 | (set-face-foreground keyval-key-face "Cyan") | 
|---|
| 58 |  | 
|---|
| 59 | (defvar keyval-classtype-face 'keyval-classtype-face | 
|---|
| 60 | "Face for names of classes in KeyVal file.") | 
|---|
| 61 | (make-face keyval-classtype-face) | 
|---|
| 62 | (set-face-foreground keyval-classtype-face "Green") | 
|---|
| 63 |  | 
|---|
| 64 | (defvar keyval-reference-face 'keyval-reference-face | 
|---|
| 65 | "Face for references in KeyVal file.") | 
|---|
| 66 | (make-face keyval-reference-face) | 
|---|
| 67 | (set-face-foreground keyval-reference-face "Orange") | 
|---|
| 68 | (set-face-underline-p keyval-reference-face t) | 
|---|
| 69 |  | 
|---|
| 70 | (defvar keyval-font-lock-keywords | 
|---|
| 71 | '(("%.*" . font-lock-comment-face) | 
|---|
| 72 | ("<.*>" . keyval-classtype-face) | 
|---|
| 73 | ("\"[^\"\n]+\"" . font-lock-string-face) | 
|---|
| 74 | ("$[A-Za-z0-9_\.:*+-/]*" . keyval-reference-face) | 
|---|
| 75 | ("{ *\\([A-Za-z0-9_\.*+-/ ]*\\>\\) *} *=" (1 keyval-key-face)) | 
|---|
| 76 | ("\\([A-Za-z0-9_\.*+-/]*\\>\\) *=" (1 keyval-key-face)) | 
|---|
| 77 | ) | 
|---|
| 78 | "Default expressions to highlight in KeyVal mode.") | 
|---|