; xfst-mode-el -- Major mode for editing XFST files ; Author: W.P. McNeill ; Created: 7 November 2004 ; Keywords: XFST major-mode ; This program 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 of ; the License, or (at your option) any later version. ; This program 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 this program; if not, write to the Free ; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, ; MA 02111-1307 USA ; This was based on an emacs mode authoring tutorial located here: ; http://two-wugs.net/emacs/mode-tutorial.html ; Hook for overriding the functions defined in this file (defvar xfst-mode-hook nil) ; Associate .xfst extension with this mode. (add-to-list 'auto-mode-alist '("\\.xfst\\'" . xfst-mode)) ; Keywords for syntax highlighting (defconst xfst-font-lock-keywords (list '("\\<\\(define\\|read\\|save\\|clear\\|regex\\|stack\\)\\>" . font-lock-keyword-face) '() ) "Highlighting expressions for XFST mode.") ; Define syntactic constituents (defvar xfst-mode-syntax-table (let ((xfst-mode-syntax-table (make-syntax-table))) ; The ! character is the comment delimiter (modify-syntax-entry ?! "<" xfst-mode-syntax-table) (modify-syntax-entry ?\n ">" xfst-mode-syntax-table) xfst-mode-syntax-table) "Syntax table for xfst-mode") ; Entry function called by emacs (defun xfst-mode () (interactive) (kill-all-local-variables) ; Define syntactic constituents (set-syntax-table xfst-mode-syntax-table) ; Set up font-lock (set (make-local-variable 'font-lock-defaults) '(xfst-font-lock-keywords)) ; Register our indentation function (setq major-mode 'xfst-mode) (setq mode-name "XFST") (run-hooks 'xfst-mode-hook)) ; Expose this mode to the emacs environment (provide 'xfst-mode)