;; *****************************************************************************
;;
;; jam-mode.el
;; Font-lock support for Jam files
;;
;; Copyright (C) 2000, Eric Scouten
;; Started Sat, 05 Aug 2000
;;
;; *****************************************************************************
;;
;; This 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.
;;
;; jam-mode.el 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, 675 Mass Ave, Cambridge, MA 02139, USA.
;;
;; *****************************************************************************
;;
;; To add font-lock support for Jam files, simply add the line
;; (require 'jam-mode) to your .emacs file. Make sure generic-mode.el
;; is visible in your load-path as well.
;;
;; *****************************************************************************
;; Generic-mode is a meta-mode which can be used to define small modes
;; which provide basic comment and font-lock support. Jam-mode depends on
;; this mode.
(require 'generic-mode)
(define-generic-mode 'jam-mode
; Jam comments always start with '#'
(list ?# )
; Jam keywords (defined later)
nil
; Extra stuff to colorize
(list
; Jam keywords
(generic-make-keywords-list
(list "actions" "bind" "case" "default" "else" "existing" "for" "if"
"ignore" "in" "include" "local" "on" "piecemeal" "quietly" "rule" "switch"
"together" "updated")
'font-lock-keyword-face)
; Jam built-in variables
(generic-make-keywords-list
(list
"JAMDATE" "JAMSHELL" "JAMUNAME" "JAMVERSION" "MAC" "NT" "OS" "OS2"
"OSPLAT" "OSVER" "UNIX" "VMS")
'font-lock-constant-face)
; Jam built-in targets
(generic-make-keywords-list
(list
"ALWAYS" "DEPENDS" "ECHO" "INCLUDES" "LEAVES" "LOCATE" "NOCARE"
"NOTFILE" "NOUPDATE" "SEARCH" "TEMPORARY")
'font-lock-builtin-face)
; Jam built-in targets (warnings)
(generic-make-keywords-list
(list
"EXIT")
'font-lock-warning-face)
; Jambase rules
(generic-make-keywords-list
(list
"Archive" "As" "Bulk" "Cc" "CcMv" "C\\+\\+" "Chgrp" "Chmod" "Chown" "Clean" "CreLib"
"Depends" "File" "Fortran" "GenFile" "GenFile1" "HardLink"
"HdrRule" "Install" "InstallBin" "InstallFile" "InstallInto" "InstallLib" "InstallMan"
"InstallShell" "Lex" "Library" "LibraryFromObjects" "Link" "LinkLibraries"
"Main" "MainFromObjects" "MakeLocate" "MkDir" "MkDir1" "Object" "ObjectC\\+\\+Flags"
"ObjectCcFlags" "ObjectHdrs" "Objects" "Ranlib" "RmTemps" "Setuid" "SubDir"
"SubDirC\\+\\+Flags" "SubDirCcFlags" "SubDirHdrs" "SubInclude" "Shell" "Undefines"
"UserObject" "Yacc" "Yacc1" "BULK" "FILE" "HDRRULE" "INSTALL" "INSTALLBIN" "INSTALLLIB"
"INSTALLMAN" "LIBRARY" "LIBS" "LINK" "MAIN" "SETUID" "SHELL" "UNDEFINES"
"addDirName" "makeCommon" "makeDirName" "makeGrist" "makeGristedName" "makeRelPath"
"makeString" "makeSubDir" "makeSuffixed" "unmakeDir")
'font-lock-function-name-face)
; Jambase built-in targets
(generic-make-keywords-list
(list
"all" "clean" "dirs" "exe" "files" "first" "install" "lib" "obj" "shell" "uninstall")
'font-lock-builtin-face)
; Jambase built-in variables
(generic-make-keywords-list
(list
"ALL_LOCATE_TARGET" "AR" "ARFLAGS" "AS" "ASFLAGS" "AWK" "BCCROOT" "BINDIR" "CC" "CCFLAGS"
"C\+\+" "C\\+\\+FLAGS" "CHMOD" "CP" "CRELIB" "CW" "CWGUSI" "CWMAC" "CWMSL" "DOT" "DOTDOT"
"EXEMODE" "FILEMODE" "FORTRAN" "FORTRANFLAGS" "GROUP" "HDRGRIST" "HDRPATTERN" "HDRRULE"
"HDRS" "HDRSCAN" "HDRSEARCH" "INSTALL" "JAMFILE" "JAMRULES" "LEX" "LIBDIR" "LINK"
"LINKFLAGS" "LINKLIBS" "LOCATE_SOURCE" "LOCATE_TARGET" "LN" "MACINC" "MANDIR" "MKDIR"
"MODE" "MSLIB" "MSLINK" "MSIMPLIB" "MSRC" "MSVC" "MSVCNT" "MV" "NEEDLIBS" "NOARSCAN"
"OSFULL" "OPTIM" "OWNER" "RANLIB" "RCP" "RELOCATE" "RM" "RSH" "RUNVMS" "SEARCH_SOURCE"
"SED" "SHELLHEADER" "SHELLMODE" "SLASH" "SLASHINC" "SOURCE_GRIST" "STDHDRS" "STDLIBPATH"
"SUBDIR" "SUBDIRASFLAGS" "SUBDIRC\\+\\+FLAGS" "SUBDIRCCFLAGS" "SUBDIRHDRS" "SUBDIR_TOKENS"
"SUFEXE" "SUFLIB" "SUFOBJ" "UNDEFFLAG" "UNDEFS" "WATCOM" "YACC" "YACCFLAGS" "YACCFILES")
'font-lock-function-name-face)
; Jam variable references $(foo)
'("$(\\([^ :\\[()\t\r\n]+\\)[)\\[:]" 1 font-lock-variable-name-face))
; Apply this mode to all files whose names start with "Jam".
(list "\\Jam")
; Attach setup function so we can modify syntax table.
(list 'jam-mode-setup-function)
; Brief description
"Generic mode for Jam rules files")
(defun jam-mode-setup-function ()
(modify-syntax-entry ?_ "w")
(modify-syntax-entry ?. "w")
(modify-syntax-entry ?/ "w")
(modify-syntax-entry ?\\ "w")
(modify-syntax-entry ?- "w")
(modify-syntax-entry ?+ "w"))
(provide 'jam-mode)
;; jam-mode.el ends here