;; v4test-font-lock.el -- Font lock support for 4Test mode. ;; $Revision: 1.1 $ $Date: 1998/03/28 21:14:16 $ ;; Author: Michael Richters ;; Maintainer: Michael Richters ;; Keywords: qa, tools, segue, 4test ;; Copyright (C) 1998 Michael Richters. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;; This file is *NOT* part of GNU Emacs. ;; Commentary: ;; This file provides font-lock support for `v4test-mode' (found in ;; "v4test-mode.el"). It requires the `font-lock' package and ;; `cc-mode'. To get syntax hilighting in 4Test code, put the ;; following lines in your .emacs file: ;; (defun my-v4test-mode-hook () ;; (cond (window-system (require 'v4test-font-lock)))) ;; (add-hook 'v4test-mode-hooks 'my-v4test-mode-hook) (defvar v4test-font-lock-keywords nil "Default font lock keywords for the 4Test language.") (defvar v4test-primitive-type-regexp (concat "\\<\\(" "A\\(NYTYPE\\|RRAY\\)\\|BOOLEAN\\|CHAR\\|" "D\\(ATA\\(CLASS\\|TYPE\\)\\|OUBLE\\)\\|FLOAT\\|" "GUITYPE\\|HANDLE\\|INT\\(\\|EGER\\)\\|" "L\\(IST\\|ONG\\)\\|NUMBER\\|OF\\|REAL\\|" "S\\(E\\(MAPHORE\\|T\\)HORT\\|TRING\\)\\|" "UNSIGNED\\|VOID\\|WINDOW" "\\|" "a\\(nytype\\|rray\\)\\|boolean\\|char\\|" "d\\(ata\\(class\\|type\\)\\|ouble\\)\\|float\\|" "guitype\\|handle\\|int\\(\\|eger\\)\\|" "l\\(ist\\|ong\\)\\|number\\|of\\|real\\|" "s\\(e\\(maphore\\|t\\)hort\\|tring\\)\\|" "unsigned\\|void\\|window" "\\)\\>") "Regular expression which matches 4Test primitive types.") (defvar v4test-primitive-type-regexp-count 8 "Number of pairs of parentheses in `v4test-primitive-type-regexp'.") (defvar v4test-keyword-regexp (concat "\\<\\(" "a\\(ccess\\|lias\\|ppstate\\|ttribute\\)\\|" "b\\(asedon\\|reak\\|uiltin\\)\\|" "c\\(ase\\|on\\(st\\|tinue\\)\\|ritical\\)\\|" "d\\(e\\(fault\\|rived\\)\\|ll\\|o\\)\\|" "e\\(ach\\|lse\\|num\\|x\\(cept\\|it\\|tern\\)\\)\\|" "for\\|goto\\|hidecalls\\|i\\(f\\|n\\(\\|out\\)\\|s\\)\\|" "n\\(one\\|ull\\)\\|o\\(bsolete\\|ptional\\|ut\\)\\|" "p\\(ar\\(allel\\|ent\\)\\|r\\(ivate\\|operty\\)\\|ublic\\)\\|" "r\\(aise\\|e\\(cord\\|ndezvous\\|raise\\|turn\\)\\)\\|" "s\\(elect\\|hare\\|ize\\|pawn\\|tep\\|witch\\)\\|" "t\\(ag\\|estcase\\|his\\|o\\|ype\\)\\|use\\|" "v\\(arargs\\|oid\\)\\|w\\(hile\\|inclass\\)" "\\)\\>") "Regular expression which matches 4Test keywords (other than variable types).") (defvar v4test-keyword-regexp-count 21 "Number of pairs of parentheses in `v4test-keyword-regexp'.") (defvar v4test-reference-regexp nil "Regular expression which matches 4Test references, or something...") (defvar v4test-reference-regexp-count 0 "Number of pairs of parentheses in `v4test-reference-regexp'.") (let ((capital-letter "A-Z\300-\326\330-\337") (letter "a-zA-Z_\300-\326\330-\366\370-\377") (digit "0-9")) (setq v4test-identifier-regexp (concat "\\<\\([" letter "][" letter digit "]*\\)\\>")) (setq v4test-identifier-regexp-count 1) (setq v4test-winclass-type-regexp (concat "\\<\\([" capital-letter "][" letter digit "]*\\)\\>")) (setq v4test-winclass-type-regexp-count 1)) (setq v4test-font-lock-keywords (list (list v4test-primitive-type-regexp '(1 font-lock-type-face)) (list v4test-keyword-regexp '(1 font-lock-keyword-face)) ; (list v4test-reference-regexp '(1 font-lock-reference-face)) ; (list v4test-function-name-regexp '(1 font-lock-function-name-face)) ; (list v4test-variable-name-regexp '(1 font-lock-variable-name-face)) )) ;;; Inform font-lock that we're around. ;; This code works only on modern versions of Emacs. On older systems ;; you have to manually set the variables `font-lock-keywords' and ;; `font-lock-syntax-table', or upgrade your Emacs. (require 'font-lock) (if (not (assq 'v4test-mode font-lock-defaults-alist)) (setq font-lock-defaults-alist (cons (cons 'v4test-mode '((v4test-font-lock-keywords) nil nil ((?_ . "w") (?$ . "w")) nil (font-lock-mark-block-function . mark-defun))) font-lock-defaults-alist))) (provide 'v4test-font-lock) ;; Change History ;; ;; $Log: v4test-font-lock.el,v $ ;; Revision 1.1 1998/03/28 21:14:16 merlin ;; Initial revision ;;