Added new InstallShield keywords.
[bpt/emacs.git] / lisp / generic-x.el
CommitLineData
ca1e63a5
RS
1;;; generic-x.el --- Extra Modes for generic-mode
2
3;; Copyright (C) 1997, 1998 Free Software Foundation, Inc.
4
5;; Author: Peter Breton <pbreton@cs.umb.edu>
6;; Created: Tue Oct 08 1996
7;; Keywords: generic, comment, font-lock
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs 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;; GNU Emacs 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 GNU Emacs; see the file COPYING. If not, write to the
23;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24;; Boston, MA 02111-1307, USA.
25
26;;; Commentary:
27;;
28;; This file contains some pre-defined generic-modes.
ffe0c7ef 29;;
ca1e63a5
RS
30;; INSTALLATION:
31;;
32;; Add this line to your .emacs file:
33;;
34;; (require 'generic-x)
35;;
36;; You can decide which modes to load by setting the variable
37;; `generic-extras-enable-list'. Some platform-specific modes are
38;; affected by the variables `generic-define-mswindows-modes' and
39;; `generic-define-unix-modes' (which see).
ffe0c7ef 40;;
ca1e63a5
RS
41;; You can also send in new modes; if the file types a reasonably common,
42;; we would like to install them.
43;;
44;; PROBLEMS WHEN USED WITH FOLDING MODE:
45;;
762f539b
DL
46;; [The following relates to the obsolete selective-display technique.
47;; Folding mode should use invisible text properties instead. -- Dave
48;; Love]
49;;
ca1e63a5 50;; From Anders Lindgren <andersl@csd.uu.se>
ffe0c7ef 51;;
ca1e63a5
RS
52;; Problem summary: Wayne Adams has found a problem when using folding
53;; mode in conjuction with font-lock for a mode defined in
54;; `generic-x.el'.
55;;
56;; The problem, as Wayne described it, was that error messages of the
57;; following form appeared when both font-lock and folding are used:
ffe0c7ef 58;;
ca1e63a5
RS
59;; > - various msgs including "Fontifying region...(error Stack
60;; > overflow in regexp matcher)" appear
ffe0c7ef 61;;
ca1e63a5
RS
62;; I have just tracked down the cause of the problem. The regexp:s in
63;; `generic-x.el' does not take into account the way that folding
64;; hides sections of the buffer. The technique is known as
65;; `selective-display' and has been available for a very long time (I
66;; started using it back in the good old' Emacs 18 days). Basically, a
67;; section is hidden by creating one very long line were the newline
68;; character (C-j) is replaced by a linefeed (C-m) character.
ffe0c7ef 69;;
ca1e63a5
RS
70;; Many other hiding packages, besides folding, use the same technique,
71;; the problem should occur when using them as well.
ffe0c7ef 72;;
ca1e63a5
RS
73;; The erroronous lines in `generic-extras' look like the following (this
74;; example is from the `ini' section):
ffe0c7ef
PB
75;;
76;; '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)
ca1e63a5 77;; ("^\\(.*\\)=" 1 'font-lock-variable-name-face)
ffe0c7ef 78;;
ca1e63a5
RS
79;; The intention of these lines is to highlight lines of the following
80;; form:
ffe0c7ef 81;;
ca1e63a5
RS
82;; [foo]
83;; bar = xxx
ffe0c7ef 84;;
ca1e63a5
RS
85;; However, since the `.' regexp symbol match the linefeed character the
86;; entire folded section is searched, resulting in a regexp stack
87;; overflow.
ffe0c7ef 88;;
ca1e63a5
RS
89;; Solution suggestion 2: Instead of using ".", use the sequence
90;; "[^\n\r]". This will make the rules behave just as before, but they
91;; will work together with selective-display.
92
93;;; Code:
94
95(require 'generic)
96(require 'font-lock)
97
ef1c5063
RS
98(defgroup generic-x nil
99 "Extra modes for generic mode."
100 :prefix "generic-"
10714c98
DN
101 :group 'generic
102 :version "20.3")
ef1c5063 103
ca1e63a5
RS
104(defcustom generic-extras-enable-list nil
105 "*List of generic modes to enable by default.
106Each entry in the list should be a symbol.
107The variables `generic-define-mswindows-modes' and `generic-define-unix-modes'
108also affect which generic modes are defined.
ffe0c7ef 109Please note that if you set this variable after generic-x is loaded,
ca1e63a5
RS
110you must reload generic-x to enable the specified modes."
111 :group 'generic-x
ffe0c7ef 112 :type '(repeat sexp)
ca1e63a5
RS
113 )
114
ffe0c7ef 115(defcustom generic-define-mswindows-modes
ca1e63a5
RS
116 (memq system-type (list 'windows-nt 'ms-dos))
117 "*If non-nil, some MS-Windows specific generic modes will be defined."
118 :group 'generic-x
119 :type 'boolean
120 )
121
122(defcustom generic-define-unix-modes
123 (not (memq system-type (list 'windows-nt 'ms-dos)))
124 "*If non-nil, some Unix specific generic modes will be defined."
125 :group 'generic-x
126 :type 'boolean
127 )
128
129(and generic-define-mswindows-modes
130 (setq generic-extras-enable-list
ffe0c7ef
PB
131 (append (list 'bat-generic-mode 'ini-generic-mode
132 'inf-generic-mode 'rc-generic-mode
ef1c5063 133 'reg-generic-mode 'rul-generic-mode
ffe0c7ef
PB
134 'hosts-generic-mode
135 'apache-conf-generic-mode
136 'apache-log-generic-mode
137 )
ca1e63a5
RS
138 generic-extras-enable-list)))
139
140(and generic-define-unix-modes
141 (setq generic-extras-enable-list
ffe0c7ef
PB
142 (append (list 'apache-conf-generic-mode
143 'apache-log-generic-mode
144 'samba-generic-mode
145 'hosts-generic-mode 'fvwm-generic-mode
146 'x-resource-generic-mode
ef1c5063 147 'alias-generic-mode
bb53e1ee
RS
148 'inetd-conf-generic-mode
149 'etc-services-generic-mode
150 'etc-passwd-generic-mode
ffe0c7ef 151 'etc-fstab-generic-mode
ca1e63a5
RS
152 )
153 generic-extras-enable-list)))
154
155;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
156;; Generic-modes
157;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
158
159;;; Apache
ffe0c7ef
PB
160(and
161 (memq 'apache-conf-generic-mode generic-extras-enable-list)
162
163(define-generic-mode 'apache-conf-generic-mode
164 (list ?#)
165 nil
166 '(("^\\(<.*>\\)" 1 'font-lock-constant-face)
167 ("^\\(\\sw+\\)\\s-" 1 'font-lock-variable-name-face))
ca1e63a5 168 (list "srm\\.conf\\'" "httpd\\.conf\\'" "access\\.conf\\'")
ffe0c7ef 169 (list
bb53e1ee
RS
170 (function
171 (lambda ()
ffe0c7ef
PB
172 (setq imenu-generic-expression
173 '((nil "^\\([-A-Za-z0-9_]+\\)" 1)
174 ("*Directories*" "^\\s-*<Directory\\s-*\\([^>]+\\)>" 1)
175 ("*Locations*" "^\\s-*<Location\\s-*\\([^>]+\\)>" 1)
176 ))
bb53e1ee 177 )))
ca1e63a5 178 "Generic mode for Apache or HTTPD configuration files."))
ffe0c7ef
PB
179
180(and
181 (memq 'apache-log-generic-mode generic-extras-enable-list)
182
183(define-generic-mode 'apache-log-generic-mode
184 nil
185 nil
186 ;; Hostname ? user date request return-code number-of-bytes
187 '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)"
188 (1 font-lock-constant-face)
189 (2 font-lock-variable-name-face))
190 )
191 (list "access_log\\'")
192 nil
193 "Mode for Apache log files"))
194
ca1e63a5 195;;; Samba
ffe0c7ef 196(and
ca1e63a5
RS
197 (memq 'samba-generic-mode generic-extras-enable-list)
198
199(define-generic-mode 'samba-generic-mode
bb53e1ee 200 (list ?\; ?#)
ca1e63a5 201 nil
bb53e1ee 202 '(
ffe0c7ef 203 ("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)
bb53e1ee
RS
204 ("^\\s-*\\(.+\\)=\\([^\r\n]*\\)"
205 (1 'font-lock-variable-name-face)
206 (2 'font-lock-type-face))
207 )
ca1e63a5
RS
208 (list "smb\\.conf\\'")
209 (list 'generic-bracket-support)
210 "Generic mode for Samba configuration files."))
211
212;;; Fvwm
213;; This is pretty basic. Also, modes for other window managers could
214;; be defined as well.
ffe0c7ef 215(and
ca1e63a5
RS
216(memq 'fvwm-generic-mode generic-extras-enable-list)
217
218(define-generic-mode 'fvwm-generic-mode
219 (list ?#)
ffe0c7ef 220 (list
ca1e63a5
RS
221 "AddToMenu"
222 "AddToFunc"
223 "ButtonStyle"
ffe0c7ef 224 "EndFunction"
ca1e63a5 225 "EndPopup"
ffe0c7ef 226 "Function"
ca1e63a5
RS
227 "IconPath"
228 "Key"
229 "ModulePath"
230 "Mouse"
231 "PixmapPath"
ffe0c7ef
PB
232 "Popup"
233 "Style"
ca1e63a5
RS
234 )
235 nil
236 (list "\\.fvwmrc\\'" "\\.fvwm2rc\\'")
237 nil
238 "Generic mode for FVWM configuration files."))
239
240;;; X Resource
241;; I'm pretty sure I've seen an actual mode to do this, but I don't
242;; think it's standard with Emacs
ffe0c7ef 243(and
ca1e63a5
RS
244 (memq 'x-resource-generic-mode generic-extras-enable-list)
245
246(define-generic-mode 'x-resource-generic-mode
247 (list ?!)
248 nil
249 '(("^\\([^:\n]+:\\)" 1 'font-lock-variable-name-face))
ffe0c7ef 250 (list "\\.Xdefaults\\'" "\\.Xresources\\'" "\\.Xenvironment\\'" "\\.ad\\'")
ca1e63a5
RS
251 nil
252 "Generic mode for X Resource configuration files."))
253
254;;; Hosts
ffe0c7ef 255(and
ca1e63a5
RS
256 (memq 'hosts-generic-mode generic-extras-enable-list)
257
258(define-generic-mode 'hosts-generic-mode
259 (list ?#)
260 (list "localhost")
ffe0c7ef 261 '(("\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face))
ca1e63a5
RS
262 (list "[hH][oO][sS][tT][sS]\\'")
263 nil
264 "Generic mode for HOSTS files."))
265
266;;; Windows INF files
ffe0c7ef 267(and
ca1e63a5
RS
268 (memq 'inf-generic-mode generic-extras-enable-list)
269
270(define-generic-mode 'inf-generic-mode
271 (list ?\;)
ffe0c7ef
PB
272 nil
273 '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face))
ca1e63a5
RS
274 (list "\\.[iI][nN][fF]\\'")
275 (list 'generic-bracket-support)
276 "Generic mode for MS-Windows INF files."))
277
278;;; Windows INI files
279;; Should define escape character as well!
ffe0c7ef 280(and
ca1e63a5
RS
281 (memq 'ini-generic-mode generic-extras-enable-list)
282
283(define-generic-mode 'ini-generic-mode
284 (list ?\;)
285 nil
ffe0c7ef 286 '(("^\\(\\[.*\\]\\)" 1 'font-lock-constant-face)
ca1e63a5
RS
287 ("^\\([^=\n\r]*\\)=\\([^\n\r]*\\)$"
288 (1 font-lock-function-name-face)
289 (2 font-lock-variable-name-face)))
290 (list "\\.[iI][nN][iI]\\'")
ffe0c7ef 291 (list
bb53e1ee
RS
292 (function
293 (lambda ()
ffe0c7ef 294 (setq imenu-generic-expression
bb53e1ee
RS
295 '((nil "^\\[\\(.*\\)\\]" 1)
296 ("*Variables*" "^\\s-*\\([^=]+\\)\\s-*=" 1)))
297 )))
ca1e63a5
RS
298 "Generic mode for MS-Windows INI files."))
299
300;;; Windows REG files
301;;; Unfortunately, Windows 95 and Windows NT have different REG file syntax!
ffe0c7ef 302(and
ca1e63a5
RS
303 (memq 'reg-generic-mode generic-extras-enable-list)
304
305(define-generic-mode 'reg-generic-mode
306 '(?\;)
307 '("key" "classes_root" "REGEDIT" "REGEDIT4")
ffe0c7ef 308 '(("\\(\\[.*]\\)" 1 'font-lock-constant-face)
ca1e63a5
RS
309 ("^\\([^\n\r]*\\)\\s-*=" 1 'font-lock-variable-name-face))
310 '("\\.[rR][eE][gG]\\'")
ffe0c7ef 311 (list
ca1e63a5
RS
312 (function
313 (lambda ()
ffe0c7ef 314 (setq imenu-generic-expression
ca1e63a5
RS
315 '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
316 "Generic mode for MS-Windows Registry files."))
317
60bdd17f 318;;; DOS/Windows BAT files
ca1e63a5
RS
319(if (not (memq 'bat-generic-mode generic-extras-enable-list))
320 nil
321(define-generic-mode 'bat-generic-mode
322 nil
323 nil
324 (list
325 ;; Make this one first in the list, otherwise comments will
326 ;; be over-written by other variables
327 (list "^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 'font-lock-comment-face t)
774b98f3 328 (list "^[ \t]*\\(::.*\\)" 1 'font-lock-comment-face t)
60bdd17f
EZ
329 (list
330 "^[@ \t]*\\([bB][rR][eE][aA][kK]\\|[vV][eE][rR][iI][fF][yY]\\)[ \t]+\\([oO]\\([nN]\\|[fF][fF]\\)\\)"
331 '(1 font-lock-builtin-face)
774b98f3 332 '(2 font-lock-constant-face t t))
60bdd17f
EZ
333 ;; Any text (except ON/OFF) following ECHO is a string.
334 (list
335 "^[@ \t]*\\([eE][cC][hH][oO]\\)[ \t]+\\(\\([oO]\\([nN]\\|[fF][fF]\\)\\)\\|\\([^>|\r\n]+\\)\\)"
336 '(1 font-lock-builtin-face)
337 '(3 font-lock-constant-face t t)
338 '(5 font-lock-string-face t t))
339 ;; These keywords appear as the first word on a line. (Actually, they
340 ;; can also appear after "if ..." or "for ..." clause, but since they
341 ;; are frequently used in simple text, we punt.)
bb53e1ee
RS
342 ;; In `generic-bat-mode-setup-function' we make the keywords
343 ;; case-insensitive
ca1e63a5
RS
344 (generic-make-keywords-list
345 (list
bb53e1ee
RS
346 "for"
347 "if"
ca1e63a5
RS
348 )
349 'font-lock-keyword-face "^[@ \t]*")
350 ;; These keywords can be anywhere on a line
bb53e1ee
RS
351 ;; In `generic-bat-mode-setup-function' we make the keywords
352 ;; case-insensitive
ca1e63a5
RS
353 (generic-make-keywords-list
354 (list
774b98f3 355 "do"
bb53e1ee
RS
356 "exist"
357 "errorlevel"
358 "goto"
359 "not"
360 ) 'font-lock-keyword-face)
361 ;; These are built-in commands. Only frequently-used ones are listed.
60bdd17f
EZ
362 (generic-make-keywords-list
363 (list
364 "CALL" "call" "Call"
365 "CD" "cd" "Cd"
366 "CLS" "cls" "Cls"
367 "COPY" "copy" "Copy"
368 "DEL" "del" "Del"
369 "ECHO" "echo" "Echo"
370 "MD" "md" "Md"
371 "PATH" "path" "Path"
372 "PAUSE" "pause" "Pause"
373 "PROMPT" "prompt" "Prompt"
374 "RD" "rd" "Rd"
375 "REN" "ren" "Ren"
376 "SET" "set" "Set"
377 "START" "start" "Start"
378 "SHIFT" "shift" "Shift"
379 ) 'font-lock-builtin-face "[ \t|\n]")
ca1e63a5 380 (list "^[ \t]*\\(:\\sw+\\)" 1 'font-lock-function-name-face t)
60bdd17f
EZ
381 (list "\\(%\\sw+%\\)" 1 'font-lock-variable-name-face t)
382 (list "\\(%[0-9]\\)" 1 'font-lock-variable-name-face t)
ca1e63a5
RS
383 (list "\\(/[^/ \"\t\n]+\\)" 1 'font-lock-type-face)
384 (list "[\t ]+\\([+-][^\t\n\" ]+\\)" 1 'font-lock-type-face)
ffe0c7ef 385 (list "[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
ca1e63a5
RS
386 '(1 font-lock-keyword-face)
387 '(2 font-lock-function-name-face nil t))
60bdd17f
EZ
388 (list "[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?"
389 '(1 font-lock-builtin-face)
390 '(2 font-lock-variable-name-face t t))
ffe0c7ef 391
ca1e63a5 392 )
60bdd17f
EZ
393 (list
394 "\\.[bB][aA][tT]\\'"
395 "\\`[cC][oO][nN][fF][iI][gG]\\."
396 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\." )
ca1e63a5
RS
397 (list 'generic-bat-mode-setup-function)
398 "Generic mode for MS-Windows BAT files.")
399
400 (defvar bat-generic-mode-syntax-table nil
401 "Syntax table in use in bat-generic-mode buffers.")
ffe0c7ef 402
ca1e63a5
RS
403 ;; Make underscores count as words
404 (if bat-generic-mode-syntax-table
405 nil
406 (setq bat-generic-mode-syntax-table (make-syntax-table))
407 (modify-syntax-entry ?_ "w" bat-generic-mode-syntax-table))
ffe0c7ef 408
ca1e63a5
RS
409 ;; bat-generic-mode doesn't use the comment functionality of generic-mode
410 ;; because it has a three-letter comment-string, so we do it
411 ;; here manually instead
412 (defun generic-bat-mode-setup-function ()
413 (make-local-variable 'parse-sexp-ignore-comments)
414 (make-local-variable 'comment-start)
415 (make-local-variable 'comment-start-skip)
416 (make-local-variable 'comment-end)
417 (setq imenu-generic-expression '((nil "^:\\(\\sw+\\)" 1))
418 parse-sexp-ignore-comments t
419 comment-end ""
ef1c5063 420 comment-start "REM "
ca1e63a5
RS
421 comment-start-skip "[Rr][Ee][Mm] *"
422 )
423 (set-syntax-table bat-generic-mode-syntax-table)
bb53e1ee
RS
424 ;; Make keywords case-insensitive
425 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t))
ca1e63a5
RS
426 )
427 )
428
429;;; Mailagent
430;; Mailagent is a Unix mail filtering program. Anyone wanna do a generic mode
431;; for procmail?
ffe0c7ef 432(and
ca1e63a5
RS
433 (memq 'mailagent-rules-generic-mode generic-extras-enable-list)
434
435(define-generic-mode 'mailagent-rules-generic-mode
ffe0c7ef 436 (list ?#)
ca1e63a5
RS
437 (list "SAVE" "DELETE" "PIPE" "ANNOTATE" "REJECT")
438 '(("^\\(\\sw+\\)\\s-*=" 1 'font-lock-variable-name-face)
ffe0c7ef 439 ("\\s-/\\([^/]+\\)/[i, \t\n]" 1 'font-lock-constant-face))
ca1e63a5
RS
440 (list "\\.rules\\'")
441 (list 'mailagent-rules-setup-function)
442 "Mode for Mailagent rules files.")
ffe0c7ef
PB
443
444(defun mailagent-rules-setup-function ()
ca1e63a5 445 (make-local-variable 'imenu-generic-expression)
ffe0c7ef 446 (setq imenu-generic-expression
ca1e63a5
RS
447 '((nil "\\s-/\\([^/]+\\)/[i, \t\n]" 1))))
448 )
449
450;; Solaris/Sys V prototype files
ffe0c7ef 451(and
ca1e63a5
RS
452 (memq 'prototype-generic-mode generic-extras-enable-list)
453
454(define-generic-mode 'prototype-generic-mode
455 (list ?#)
456 nil
457 '(
458 ("^\\([0-9]\\)?\\s-*\\([a-z]\\)\\s-+\\([A-Za-z_]+\\)\\s-+\\([^\n\r]*\\)$"
ffe0c7ef 459 (2 font-lock-constant-face)
ca1e63a5
RS
460 (3 font-lock-keyword-face))
461 ("^\\([a-z]\\) \\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
ffe0c7ef 462 (1 font-lock-constant-face)
ca1e63a5
RS
463 (2 font-lock-keyword-face)
464 (3 font-lock-variable-name-face))
465 ("^\\(!\\s-*\\(search\\|include\\|default\\)\\)\\s-*\\([^\n\r]*\\)$"
466 (1 font-lock-keyword-face)
467 (3 font-lock-variable-name-face))
468 ("^\\(!\\s-*\\sw+\\)=\\([^\n\r]*\\)$"
469 (1 font-lock-keyword-face)
470 (2 font-lock-variable-name-face))
471 )
472 (list "prototype\\'")
473 nil
474 "Mode for Sys V prototype files."))
475
476;; Solaris/Sys V pkginfo files
ffe0c7ef 477(and
ca1e63a5
RS
478 (memq 'pkginfo-generic-mode generic-extras-enable-list)
479
480(define-generic-mode 'pkginfo-generic-mode
481 (list ?#)
482 nil
483 '(
484 ("^\\([A-Za-z_]+\\)=\\([^\n\r]*\\)$"
485 (1 font-lock-keyword-face)
486 (2 font-lock-variable-name-face))
487 )
488 (list "pkginfo\\'")
489 nil
490 "Mode for Sys V pkginfo files."))
491
492;; Javascript mode
ffe0c7ef 493;; Includes extra keywords from Armando Singer [asinger@MAIL.COLGATE.EDU]
ca1e63a5
RS
494(define-generic-mode 'javascript-generic-mode
495 (list "//")
496 (list
ffe0c7ef
PB
497 "break"
498 "case"
499 "continue"
500 "default"
501 "delete"
502 "do"
ca1e63a5 503 "else"
ffe0c7ef
PB
504 "export"
505 "for"
ca1e63a5
RS
506 "function"
507 "if"
ffe0c7ef
PB
508 "import"
509 "in"
510 "new"
511 "return"
512 "switch"
513 "this"
514 "typeof"
ca1e63a5 515 "var"
ffe0c7ef
PB
516 "void"
517 "while"
518 "with"
519 ;; words reserved for ECMA extensions below
520 "catch"
521 "class"
522 "const"
523 "debugger"
524 "enum"
525 "extends"
526 "finally"
527 "super"
528 "throw"
529 "try"
530 ;; Java Keywords reserved by JavaScript
531 "abstract"
532 "boolean"
533 "byte"
534 "char"
535 "double"
536 "false"
537 "final"
538 "float"
539 "goto"
540 "implements"
541 "instanceof"
542 "int"
543 "interface"
544 "long"
545 "native"
546 "null"
547 "package"
548 "private"
549 "protected"
550 "public"
551 "short"
552 "static"
553 "synchronized"
554 "throws"
555 "transient"
556 "true"
ca1e63a5
RS
557 )
558 (list
ffe0c7ef
PB
559 (list "^\\s-*function\\s-+\\([A-Za-z0-9_]+\\)"
560 '(1 font-lock-function-name-face))
561 (list "^\\s-*var\\s-+\\([A-Za-z0-9_]+\\)"
562 '(1 font-lock-variable-name-face))
563 )
ca1e63a5
RS
564 (list "\\.js\\'")
565 (list
ffe0c7ef 566 (function
ca1e63a5 567 (lambda ()
ffe0c7ef
PB
568 (setq imenu-generic-expression
569 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)
570 ("*Variables*" "^var\\s-+\\([A-Za-z0-9_]+\\)" 1)
571 ))
ca1e63a5
RS
572 )))
573 "Mode for JavaScript files.")
574
575;; VRML files
576(define-generic-mode 'vrml-generic-mode
577 (list ?#)
578 (list
579 "DEF"
580 "NULL"
581 "USE"
582 "Viewpoint"
583 "ambientIntensity"
584 "appearance"
585 "children"
586 "color"
587 "coord"
588 "coordIndex"
589 "creaseAngle"
590 "diffuseColor"
591 "emissiveColor"
592 "fieldOfView"
593 "geometry"
594 "info"
595 "material"
596 "normal"
597 "orientation"
598 "position"
599 "shininess"
600 "specularColor"
601 "texCoord"
602 "texture"
603 "textureTransform"
604 "title"
605 "transparency"
606 "type"
607 )
608 (list
609 (list "USE\\s-+\\([-A-Za-z0-9_]+\\)"
ffe0c7ef 610 '(1 font-lock-constant-face))
ca1e63a5
RS
611 (list "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
612 '(1 font-lock-type-face)
ffe0c7ef 613 '(2 font-lock-constant-face))
ca1e63a5
RS
614 (list "^\\s-*\\([-A-Za-z0-9_]+\\)\\s-*{"
615 '(1 font-lock-function-name-face))
ffe0c7ef 616 (list
ca1e63a5
RS
617 "^\\s-*\\(geometry\\|appearance\\|material\\)\\s-+\\([-A-Za-z0-9_]+\\)"
618 '(2 font-lock-variable-name-face))
619 )
620 (list "\\.wrl\\'")
621 (list
ffe0c7ef 622 (function
ca1e63a5 623 (lambda ()
ffe0c7ef 624 (setq imenu-generic-expression
ca1e63a5 625 '((nil "^\\([A-Za-z0-9_]+\\)\\s-*{" 1)
ffe0c7ef 626 ("*Definitions*"
ca1e63a5
RS
627 "DEF\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([A-Za-z0-9]+\\)\\s-*{"
628 1)))
629 )))
630 "Generic Mode for VRML files.")
631
632;; Java Manifests
633(define-generic-mode 'java-manifest-generic-mode
634 (list ?#)
ffe0c7ef
PB
635 (list
636 "Name"
637 "Digest-Algorithms"
638 "Manifest-Version"
639 "Required-Version"
ca1e63a5
RS
640 "Signature-Version"
641 "Magic"
642 "Java-Bean"
643 "Depends-On"
644 )
645 '(("^Name:\\s-+\\([^\n\r]*\\)$"
646 (1 font-lock-variable-name-face))
647 ("^\\(Manifest\\|Required\\|Signature\\)-Version:\\s-+\\([^\n\r]*\\)$"
ffe0c7ef 648 (2 font-lock-constant-face))
ca1e63a5 649 )
ffe0c7ef 650 (list "[mM][aA][nN][iI][fF][eE][sS][tT]\\.[mM][fF]\\'")
ca1e63a5
RS
651 nil
652 "Mode for Java Manifest files")
653
654;; Java properties files
655(define-generic-mode 'java-properties-generic-mode
bb53e1ee 656 (list ?! ?#)
ca1e63a5 657 nil
ffe0c7ef 658 (let ((java-properties-key
bb53e1ee 659 "\\(\\([-A-Za-z0-9_\\./]\\|\\(\\\\[ =:]\\)\\)+\\)")
ffe0c7ef 660 (java-properties-value
bb53e1ee
RS
661 "\\([^\r\n]*\\)")
662 )
663 ;; Property and value can be separated in a number of different ways:
664 ;; * whitespace
665 ;; * an equal sign
666 ;; * a colon
667 (mapcar
ffe0c7ef 668 (function
bb53e1ee 669 (lambda (elt)
ffe0c7ef 670 (list
bb53e1ee 671 (concat "^" java-properties-key elt java-properties-value "$")
ffe0c7ef 672 '(1 font-lock-constant-face)
bb53e1ee
RS
673 '(4 font-lock-variable-name-face)
674 )))
675 ;; These are the separators
ffe0c7ef 676 (list ":\\s-*" "\\s-+" "\\s-*=\\s-*")
bb53e1ee
RS
677 )
678 )
ca1e63a5 679 nil
bb53e1ee
RS
680 (list
681 (function
682 (lambda ()
ffe0c7ef 683 (setq imenu-generic-expression
bb53e1ee 684 '((nil "^\\([^#! \t\n\r=:]+\\)" 1)))
ffe0c7ef 685 )))
ca1e63a5
RS
686 "Mode for Java properties files.")
687
688;; C shell alias definitions
ffe0c7ef 689(and
ef1c5063
RS
690 (memq 'alias-generic-mode generic-extras-enable-list)
691
ca1e63a5
RS
692(define-generic-mode 'alias-generic-mode
693 (list ?#)
694 (list "alias" "unalias")
695 '(("^alias\\s-+\\([-A-Za-z0-9_]+\\)\\s-+"
696 (1 font-lock-variable-name-face))
697 ("^unalias\\s-+\\([-A-Za-z0-9_]+\\)\\s-*$"
698 (1 font-lock-variable-name-face))
699 )
700 (list "alias\\'")
701 (list
702 (function
703 (lambda ()
ffe0c7ef 704 (setq imenu-generic-expression
ca1e63a5
RS
705 '((nil "^\\(alias\\|unalias\\)\\s-+\\([-a-zA-Z0-9_]+\\)" 2)))
706 )))
707 "Mode for C Shell alias files.")
ef1c5063 708)
ca1e63a5
RS
709
710;;; Windows RC files
711;; Contributed by ACorreir@pervasive-sw.com (Alfred Correira)
ffe0c7ef 712(and
ca1e63a5
RS
713 (memq 'rc-generic-mode generic-extras-enable-list)
714
715(define-generic-mode 'rc-generic-mode
716;; (list ?\/)
717 (list "//")
718 '("ACCELERATORS"
719 "AUTO3STATE"
720 "AUTOCHECKBOX"
721 "AUTORADIOBUTTON"
722 "BITMAP"
723 "BOTTOMMARGIN"
724 "BUTTON"
725 "CAPTION"
726 "CHARACTERISTICS"
727 "CHECKBOX"
728 "CLASS"
729 "COMBOBOX"
730 "CONTROL"
731 "CTEXT"
732 "CURSOR"
733 "DEFPUSHBUTTON"
734 "DESIGNINFO"
735 "DIALOG"
736 "DISCARDABLE"
737 "EDITTEXT"
738 "EXSTYLE"
739 "FONT"
740 "GROUPBOX"
741 "GUIDELINES"
742 "ICON"
743 "LANGUAGE"
744 "LEFTMARGIN"
745 "LISTBOX"
746 "LTEXT"
ffe0c7ef
PB
747 "MENUITEM SEPARATOR"
748 "MENUITEM"
ca1e63a5
RS
749 "MENU"
750 "MOVEABLE"
751 "POPUP"
752 "PRELOAD"
753 "PURE"
754 "PUSHBOX"
755 "PUSHBUTTON"
756 "RADIOBUTTON"
757 "RCDATA"
758 "RIGHTMARGIN"
759 "RTEXT"
760 "SCROLLBAR"
761 "SEPARATOR"
762 "STATE3"
763 "STRINGTABLE"
764 "STYLE"
765 "TEXTINCLUDE"
766 "TOOLBAR"
767 "TOPMARGIN"
768 "VERSIONINFO"
769 "VERSION"
770 )
771 ;; the choice of what tokens go where is somewhat arbitrary,
772 ;; as is the choice of which value tokens are included, as
773 ;; the choice of face for each token group
774 (list
775 (generic-make-keywords-list
776 (list
777 "FILEFLAGSMASK"
778 "FILEFLAGS"
779 "FILEOS"
780 "FILESUBTYPE"
781 "FILETYPE"
782 "FILEVERSION"
783 "PRODUCTVERSION"
784 ) 'font-lock-type-face)
785 (generic-make-keywords-list
786 (list
787 "BEGIN"
788 "BLOCK"
789 "END"
790 "VALUE"
791 ) 'font-lock-function-name-face)
792 '("^#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1 font-lock-string-face)
793 '("^#[ \t]*define[ \t]+\\(\\sw+\\)(" 1 font-lock-function-name-face)
794 '("^#[ \t]*\\(elif\\|if\\)\\>"
795 ("\\<\\(defined\\)\\>[ \t]*(?\\(\\sw+\\)?" nil nil
ffe0c7ef 796 (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))
ca1e63a5 797 '("^#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
ffe0c7ef 798 (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t)))
ca1e63a5
RS
799 (list "\\.[rR][cC]$")
800 nil
801 "Generic mode for MS-Windows Resource files."))
802
ef1c5063 803;; InstallShield RUL files
ca1e63a5 804;; Contributed by Alfred.Correira@Pervasive.Com
ffe0c7ef 805(and
ca1e63a5 806(memq 'rul-generic-mode generic-extras-enable-list)
ef1c5063
RS
807;;; build the regexp strings using regexp-opt
808(defvar installshield-statement-keyword-list
809 (list
810 "abort"
811 "begin"
812 "call"
813 "case"
814 "declare"
815 "default"
816 "downto"
817 "elseif"
818 "else"
819 "endfor"
820 "endif"
821 "endswitch"
822 "endwhile"
823 "end"
824 "exit"
825 "external"
826 "for"
827 "function"
828 ;; "goto" -- handled elsewhere
829 "if"
830 "program"
831 "prototype"
832 "repeat"
833 "return"
834 "step"
835 "switch"
836 "then"
837 "to"
838 "typedef"
839 "until"
840 "void"
841 "while"
842 )
843 "Statement keywords used in InstallShield 3 and 5.")
844
845(defvar installshield-system-functions-list
846 (list
847 "AddFolderIcon"
848 "AddProfString"
849 "AddressString"
850 "AppCommand"
851 "AskDestPath"
852 "AskOptions"
853 "AskPath"
854 "AskText"
855 "AskYesNo"
856 "BatchDeleteEx"
857 "BatchFileLoad"
858 "BatchFileSave"
859 "BatchFind"
860 "BatchGetFileName"
861 "BatchMoveEx"
862 "BatchSetFileName"
ffe0c7ef 863 "ChangeDirectory"
ef1c5063
RS
864 "CloseFile"
865 "CmdGetHwndDlg"
866 "ComponentAddItem" ; differs between IS3 and IS5
867 "ComponentCompareSizeRequired" ; IS5 only
868 "ComponentDialog"
869 "ComponentError" ; IS5 only
870 "ComponentFileEnum" ; IS5 only
871 "ComponentFileInfo" ; IS5 only
872 "ComponentFilterLanguage" ; IS5 only
873 "ComponentFilterOS" ; IS5 only
874 "ComponentGetData" ; IS5 only
875 "ComponentGetItemInfo" ; IS3 only
876 "ComponentGetItemSize" ; differs between IS3 and IS5
877 "ComponentIsItemSelected" ; differs between IS3 and IS5
878 "ComponentListItems"
879 "ComponentMoveData" ; IS5 only
880 "ComponentSelectItem" ; differs between IS3 and IS5
881 "ComponentSetData" ; IS5 only
882 "ComponentSetItemInfo" ; IS3 only
883 "ComponentSetTarget" ; IS5 only
884 "ComponentSetupTypeEnum" ; IS5 only
885 "ComponentSetupTypeGetData" ; IS5 only
886 "ComponentSetupTypeSet" ; IS5 only
887 "ComponentTotalSize"
888 "ComponentValidate" ; IS5 only
889 "CompressAdd" ; IS3 only
890 "CompressDel" ; IS3 only
891 "CompressEnum" ; IS3 only
892 "CompressGet" ; IS3 only
893 "CompressInfo" ; IS3 only
894 "CopyFile"
895 "CreateDir"
896 "CreateFile"
897 "CreateProgramFolder"
898 "DeinstallSetReference" ; IS5 only
899 "DeinstallStart"
900 "Delay"
901 "DeleteDir"
902 "DeleteFile"
903 "DialogSetInfo"
904 "Disable"
905 "DoInstall"
906 "Do"
907 "Enable"
908 "EnterDisk"
909 "ExistsDir"
910 "ExistsDisk"
911 "ExitProgMan"
912 "EzBatchAddPath"
913 "EzBatchAddString"
914 "EzBatchReplace"
915 "EzConfigAddDriver"
916 "EzConfigAddString"
917 "EzConfigGetValue"
918 "EzConfigSetValue"
919 "EzDefineDialog"
920 "FileCompare"
921 "FileDeleteLine"
922 "FileGrep"
923 "FileInsertLine"
924 "FileSetBeginDefine" ; IS3 only
925 "FileSetEndDefine" ; IS3 only
926 "FileSetPerformEz" ; IS3 only
927 "FileSetPerform" ; IS3 only
928 "FileSetReset" ; IS3 only
929 "FileSetRoot" ; IS3 only
930 "FindAllDirs"
931 "FindAllFiles"
932 "FindFile"
933 "FindWindow"
934 "GetDiskSpace"
935 "GetDisk"
936 "GetEnvVar"
937 "GetExtents"
938 "GetFileInfo"
939 "GetLine"
ffe0c7ef 940 "GetProfInt"
ef1c5063
RS
941 "GetProfString"
942 "GetSystemInfo"
943 "GetValidDrivesList"
944 "GetVersion"
945 "GetWindowHandle"
946 "InstallationInfo"
947 "Is"
948 "LaunchApp"
ffe0c7ef 949 "LaunchAppAndWait"
ef1c5063
RS
950 "ListAddItem"
951 "ListAddString"
952 "ListCount"
953 "ListCreate"
954 "ListDestroy"
955 "ListFindItem"
956 "ListFindString"
957 "ListGetFirstItem"
958 "ListGetFirstString"
959 "ListGetNextItem"
960 "ListGetNextString"
961 "ListReadFromFile"
ffe0c7ef 962 "ListSetCurrentItem"
ef1c5063
RS
963 "ListSetNextItem"
964 "ListSetNextString"
965 "ListSetIndex"
966 "ListWriteToFile"
967 "LongPathToQuote"
968 "LongPathToShortPath"
969 "MessageBox"
970 "NumToStr"
971 "OpenFileMode"
972 "OpenFile"
973 "ParsePath"
974 "PathAdd"
975 "PathDelete"
976 "PathFind"
977 "PathGet"
978 "PathMove"
979 "PathSet"
980 "Path"
981 "PlaceBitmap"
982 "PlaceWindow"
983 "PlayMMedia" ; IS5 only
984 "ProgDefGroupType"
985 "RegDBCreateKeyEx"
ffe0c7ef 986 "RegDBDeleteValue"
ef1c5063
RS
987 "RegDBGetItem"
988 "RegDBKeyExist"
989 "RegDBSetItem"
990 "RegDBGetKeyValueEx"
991 "RegDBSetKeyValueEx"
992 "RegDBSetDefaultRoot"
993 "RenameFile"
994 "ReplaceFolderIcon"
995 "ReplaceProfString"
996 "SdAskDestPath"
997 "SdAskOptions"
998 "SdAskOptionsList"
999 "SdBitmap"
1000 "SdCloseDlg"
1001 "SdComponentAdvCheckSpace"
1002 "SdComponentAdvInit"
1003 "SdComponentAdvUpdateSpace"
1004 "SdComponentDialog"
1005 "SdComponentDialog2"
1006 "SdComponentDialogAdv"
1007 "SdComponentDialogEx"
1008 "SdComponentDlgCheckSpace"
1009 "SdComponentMult"
1010 "SdConfirmNewDir"
1011 "SdConfirmRegistration"
1012 "SdDiskSpace"
1013 "SdDisplayTopics"
1014 "SdDoStdButton"
1015 "SdEnablement"
1016 "SdError"
1017 "SdFinish"
1018 "SdFinishInit32"
1019 "SdFinishReboot"
1020 "SdGeneralInit"
1021 "SdGetItemName"
1022 "SdGetTextExtent"
1023 "SdGetUserCompanyInfo"
1024 "SdInit"
1025 "SdIsShellExplorer"
1026 "SdIsStdButton"
1027 "SdLicense"
1028 "SdMakeName"
1029 "SdOptionInit"
1030 "SdOptionSetState"
1031 "SdOptionsButtons"
1032 "SdOptionsButtonsInit"
1033 "SdPlugInProductName"
1034 "SdProductName"
1035 "SdRegEnableButton"
1036 "SdRegExEnableButton"
1037 "SdRegisterUser"
1038 "SdRegisterUserEx"
1039 "SdRemoveEndSpace"
1040 "SdSelectFolder"
1041 "SdSetSequentialItems"
1042 "SdSetStatic"
1043 "SdSetupTypeEx" ; IS5 only
1044 "SdSetupType"
1045 "SdShowAnyDialog"
1046 "SdShowDlgEdit1"
1047 "SdShowDlgEdit2"
1048 "SdShowDlgEdit3"
1049 "SdShowFileMods"
1050 "SdShowInfoList"
1051 "SdShowMsg"
1052 "SdStartCopy"
1053 "SdUnInit"
1054 "SdUpdateComponentSelection"
1055 "SdWelcome"
1056 "SendMessage"
1057 "SetColor"
1058 "SetFont"
1059 "SetDialogTitle"
1060 "SetDisplayEffect" ; IS5 only
1061 "SetFileInfo"
1062 "SetForegroundWindow"
1063 "SetStatusWindow"
1064 "SetTitle"
1065 "SetupType"
1066 "ShowProgramFolder"
1067 "Split" ; IS3 only
1068 "SprintfBox"
1069 "Sprintf"
1070 "StatusUpdate"
1071 "StrCompare"
1072 "StrFind"
1073 "StrGetTokens"
1074 "StrLength"
1075 "StrRemoveLastSlash"
1076 "StrToLower"
ffe0c7ef 1077 "StrToNum"
ef1c5063
RS
1078 "StrToUpper"
1079 "StrSub"
1080 "VarRestore"
1081 "VarSave"
1082 "VerCompare"
1083 "VerGetFileVersion"
1084 "WaitOnDialog"
1085 "Welcome"
1086 "WriteLine"
1087 "WriteProfString"
1088 "XCopyFile"
1089 )
1090 "System functions defined in InstallShield 3 and 5.")
1091
1092(defvar installshield-system-variables-list
1093 (list
ffe0c7ef 1094 "BATCH_INSTALL"
ef1c5063 1095 "CMDLINE"
ffe0c7ef 1096 "COMMONFILES"
ef1c5063 1097 "CORECOMPONENTHANDLING"
ffe0c7ef 1098 "DIALOGCACHE"
ef1c5063 1099 "ERRORFILENAME"
ffe0c7ef
PB
1100 "FOLDER_DESKTOP"
1101 "FOLDER_PROGRAMS"
1102 "FOLDER_STARTMENU"
1103 "FOLDER_STARTUP"
ef1c5063
RS
1104 "INFOFILENAME"
1105 "ISRES"
1106 "ISUSER"
1107 "ISVERSION"
ffe0c7ef 1108 "MEDIA"
ef1c5063 1109 "MODE"
ffe0c7ef
PB
1110 "PROGRAMFILES"
1111 "SELECTED_LANGUAGE"
ef1c5063
RS
1112 "SRCDIR"
1113 "SRCDISK"
1114 "SUPPORTDIR"
1115 "TARGETDIR"
1116 "TARGETDISK"
ffe0c7ef 1117 "UNINST"
ef1c5063
RS
1118 "WINDIR"
1119 "WINDISK"
1120 "WINMAJOR"
1121 "WINSYSDIR"
1122 "WINSYSDISK"
1123 )
1124 "System variables used in InstallShield 3 and 5.")
1125
1126(defvar installshield-types-list
1127 (list
1128 "BOOL"
1129 "BYREF"
1130 "CHAR"
1131 "HIWORD"
1132 "HWND"
1133 "INT"
1134 "LIST"
1135 "LONG"
1136 "LOWORD"
ffe0c7ef 1137 "LPSTR"
ef1c5063 1138 "NUMBER"
ffe0c7ef 1139 "NUMBERLIST"
ef1c5063
RS
1140 "POINTER"
1141 "QUAD"
1142 "RGB"
1143 "SHORT"
1144 "STRINGLIST"
1145 "STRING"
1146 )
1147 "Type keywords used in InstallShield 3 and 5.")
1148
1149;;; some might want to skip highlighting these to improve performance
1150(defvar installshield-funarg-constants-list
1151 (list
1152 "AFTER"
1153 "APPEND"
1154 "ALLCONTENTS"
1155 "BACKBUTTON"
1156 "BACKGROUNDCAPTION"
1157 "BACKGROUND"
1158 "BACK"
1159 "BASEMEMORY"
1160 "BEFORE"
1161 "BIOS"
1162 "BITMAPICON"
1163 "BK_BLUE"
1164 "BK_GREEN"
1165 "BK_RED"
1166 "BLUE"
1167 "BOOTUPDRIVE"
1168 "CANCEL"
1169 "CDROM_DRIVE"
1170 "CDROM"
1171 "CHECKBOX95"
1172 "CHECKBOX"
1173 "CHECKLINE"
1174 "CHECKMARK"
1175 "COLORS"
1176 "COMMANDEX"
1177 "COMMAND"
1178 "COMP_NORMAL"
1179 "COMP_UPDATE_DATE"
1180 "COMP_UPDATE_SAME"
1181 "COMP_UPDATE_VERSION"
1182 "COMPACT"
1183 "CONTINUE"
1184 "CPU"
1185 "CUSTOM"
1186 "DATE"
1187 "DEFWINDOWMODE"
1188 "DIR_WRITEABLE"
1189 "DIRECTORY"
1190 "DISABLE"
1191 "DISK_TOTALSPACE"
1192 "DISK"
1193 "DLG_OPTIONS"
1194 "DLG_PATH"
1195 "DLG_TEXT"
1196 "DLG_ASK_YESNO"
1197 "DLG_ENTER_DISK"
1198 "DLG_ERR"
1199 "DLG_INFO_ALTIMAGE"
1200 "DLG_INFO_CHECKSELECTION"
1201 "DLG_INFO_KUNITS"
1202 "DLG_INFO_USEDECIMAL"
1203 "DLG_MSG_INFORMATION"
1204 "DLG_MSG_SEVERE"
1205 "DLG_MSG_WARNING"
1206 "DLG_STATUS"
1207 "DLG_WARNING"
1208 "DLG_USER_CAPTION"
1209 "DRIVE"
1210 "ENABLE"
1211 "END_OF_FILE"
1212 "END_OF_LIST"
1213 "ENVSPACE"
1214 "EQUALS"
1215 "EXCLUDE_SUBDIR"
1216 "EXCLUSIVE"
1217 "EXISTS"
1218 "EXIT"
1219 "EXTENDED_MEMORY"
1220 "EXTENSION_ONLY"
1221 "FAILIFEXISTS"
1222 "FALSE"
1223 "FEEDBACK_FULL"
1224 "FILE_ATTR_ARCHIVED"
1225 "FILE_ATTR_DIRECTORY"
1226 "FILE_ATTR_HIDDEN"
1227 "FILE_ATTR_NORMAL"
1228 "FILE_ATTR_READONLY"
1229 "FILE_ATTR_SYSTEM"
1230 "FILE_ATTRIBUTE"
1231 "FILE_DATE"
1232 "FILE_LINE_LENGTH"
1233 "FILE_MODE_APPEND"
1234 "FILE_MODE_BINARYREADONLY"
1235 "FILE_MODE_BINARY"
1236 "FILE_MODE_NORMAL"
1237 "FILE_NO_VERSION"
1238 "FILE_NOT_FOUND"
1239 "FILE_SIZE"
1240 "FILE_TIME"
1241 "FILENAME_ONLY"
1242 "FILENAME"
1243 "FIXED_DRIVE"
1244 "FOLDER_DESKTOP"
ffe0c7ef 1245 "FOLDER_PROGRAMS"
ef1c5063
RS
1246 "FOLDER_STARTMENU"
1247 "FOLDER_STARTUP"
1248 "FREEENVSPACE"
1249 "FULLWINDOWMODE"
1250 "FULL"
1251 "FONT_TITLE"
1252 "GREATER_THAN"
1253 "GREEN"
ffe0c7ef
PB
1254 "HKEY_CLASSES_ROOT"
1255 "HKEY_CURRENT_USER"
1256 "HKEY_LOCAL_MACHINE"
1257 "HKEY_USERS"
ef1c5063
RS
1258 "HOURGLASS"
1259 "INCLUDE_SUBDIR"
1260 "INDVFILESTATUS"
1261 "INFORMATION"
1262 "IS_WINDOWSNT"
1263 "IS_WINDOWS95"
1264 "IS_WINDOWS"
1265 "IS_WIN32S"
1266 "ISTYPE"
1267 "LANGUAGE_DRV"
1268 "LANGUAGE"
1269 "LESS_THAN"
1270 "LIST_NULL"
1271 "LISTFIRST"
1272 "LISTNEXT"
1273 "LOCKEDFILE"
1274 "LOGGING"
1275 "LOWER_LEFT"
1276 "LOWER_RIGHT"
1277 "MAGENTA"
1278 "MOUSE_DRV"
1279 "MOUSE"
1280 "NETWORK_DRV"
1281 "NETWORK"
1282 "NEXT"
1283 "NONEXCLUSIVE"
1284 "NORMALMODE"
1285 "NOSET"
1286 "NOTEXISTS"
1287 "NOWAIT"
1288 "NO"
1289 "OFF"
1290 "ONLYDIR"
1291 "ON"
1292 "OSMAJOR"
1293 "OSMINOR"
1294 "OS"
1295 "OTHER_FAILURE"
1296 "PARALLEL"
1297 "PARTIAL"
1298 "PATH_EXISTS"
1299 "PATH"
1300 "RED"
1301 "REGDB_APPPATH_DEFAULT"
1302 "REGDB_APPPATH"
1303 "REGDB_BINARY"
1304 "REGDB_ERR_CONNECTIONEXISTS"
1305 "REGDB_ERR_CORRUPTEDREGSITRY"
1306 "REGDB_ERR_INITIALIZATION"
1307 "REGDB_ERR_INVALIDHANDLE"
1308 "REGDB_ERR_INVALIDNAME"
1309 "REGDB_NUMBER"
1310 "REGDB_STRING_EXPAND"
1311 "REGDB_STRING_MULTI"
1312 "REGDB_STRING"
1313 "REGDB_UNINSTALL_NAME"
1314 "REMOTE_DRIVE"
1315 "REMOVALE_DRIVE"
1316 "REPLACE_ITEM"
1317 "REPLACE"
1318 "RESET"
1319 "RESTART"
1320 "ROOT"
1321 "SELFREGISTER"
1322 "SERIAL"
1323 "SET"
1324 "SEVERE"
1325 "SHAREDFILE"
1326 "SHARE"
1327 "SILENTMODE"
1328 "SRCTARGETDIR"
1329 "STATUSBAR"
1330 "STATUSDLG"
1331 "STATUSOLD"
1332 "STATUS"
1333 "STYLE_NORMAL"
1334 "SW_MAXIMIZE"
1335 "SW_MINIMIZE"
1336 "SW_RESTORE"
1337 "SW_SHOW"
ffe0c7ef 1338 "SYS_BOOTMACHINE"
ef1c5063
RS
1339 "TIME"
1340 "TRUE"
1341 "TYPICAL"
1342 "UPPER_LEFT"
1343 "UPPER_RIGHT"
1344 "VALID_PATH"
1345 "VERSION"
1346 "VIDEO"
1347 "VOLUMELABEL"
1348 "YELLOW"
1349 "YES"
1350 "WAIT"
1351 "WARNING"
1352 "WINMAJOR"
1353 "WINMINOR"
1354 "WIN32SINSTALLED"
1355 "WIN32SMAJOR"
1356 "WIN32SMINOR"
1357 )
1358 "Function argument constants used in InstallShield 3 and 5.")
ca1e63a5 1359
ffe0c7ef 1360(define-generic-mode 'rul-generic-mode
ef1c5063
RS
1361 ;; Using "/*" and "*/" doesn't seem to be working right
1362 (list "//")
1363 installshield-statement-keyword-list
ca1e63a5
RS
1364 (list
1365 ;; preprocessor constructs
1366 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1367 1 font-lock-string-face)
1368 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
ffe0c7ef 1369 (1 font-lock-constant-face)
ca1e63a5
RS
1370 (2 font-lock-variable-name-face nil t))
1371 ;; indirect string constants
18e5a64a 1372 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
ca1e63a5 1373 ;; gotos
ffe0c7ef
PB
1374 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-constant-face)
1375 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
ca1e63a5 1376 (1 font-lock-keyword-face)
ffe0c7ef 1377 (2 font-lock-constant-face nil t))
ca1e63a5
RS
1378 ;; system variables
1379 (generic-make-keywords-list
ef1c5063
RS
1380 installshield-system-variables-list
1381 'font-lock-variable-name-face "[^_]" "[^_]")
ca1e63a5
RS
1382 ;; system functions
1383 (generic-make-keywords-list
ef1c5063
RS
1384 installshield-system-functions-list
1385 'font-lock-function-name-face "[^_]" "[^_]")
ca1e63a5
RS
1386 ;; type keywords
1387 (generic-make-keywords-list
ef1c5063
RS
1388 installshield-types-list
1389 'font-lock-type-face "[^_]" "[^_]")
1390 ;; function argument constants
ca1e63a5 1391 (generic-make-keywords-list
ef1c5063
RS
1392 installshield-funarg-constants-list
1393 'font-lock-variable-name-face "[^_]" "[^_]") ; is this face the best choice?
ca1e63a5
RS
1394 )
1395 (list "\\.[rR][uU][lL]$")
1396 (list
ffe0c7ef 1397 (function
ca1e63a5 1398 (lambda ()
ffe0c7ef 1399 (setq imenu-generic-expression
ca1e63a5
RS
1400 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1)))
1401 )))
1402 "Generic mode for InstallShield RUL files.")
1403
1404(define-skeleton rul-if
1405 "Insert an if statement."
1406 "condition: "
1407 "if(" str ") then" \n
1408 > _ \n
1409 ( "other condition, %s: "
1410 > "elseif(" str ") then" \n
ffe0c7ef 1411 > \n)
ca1e63a5
RS
1412 > "else" \n
1413 > \n
1414 resume:
1415 > "endif;"
1416 )
1417
1418(define-skeleton rul-function
1419 "Insert a function statement."
1420 "function: "
1421 "function " str " ()" \n
1422 ( "local variables, %s: "
1423 > " " str ";" \n)
1424 > "begin" \n
1425 > _ \n
1426 resume:
1427 > "end;")
1428
1429)
1430
1431;; Additions by ACorreir@pervasive-sw.com (Alfred Correira)
1432(define-generic-mode 'mailrc-generic-mode
1433 (list ?#)
ffe0c7ef
PB
1434 (list
1435 "alias"
1436 "else"
1437 "endif"
1438 "group"
1439 "if"
1440 "ignore"
1441 "set"
ca1e63a5
RS
1442 "unset"
1443 )
1444 '(("^\\s-*\\(alias\\|group\\)\\s-+\\([-A-Za-z0-9_]+\\)\\s-+\\([^\n\r#]*\\)\\(#.*\\)?$"
ffe0c7ef 1445 (2 font-lock-constant-face) (3 font-lock-variable-name-face))
ca1e63a5 1446 ("^\\s-*\\(unset\\|set\\|ignore\\)\\s-+\\([-A-Za-z0-9_]+\\)=?\\([^\n\r#]*\\)\\(#.*\\)?$"
ffe0c7ef 1447 (2 font-lock-constant-face) (3 font-lock-variable-name-face)))
ca1e63a5
RS
1448 (list "\\.mailrc\\'")
1449 nil
1450 "Mode for mailrc files.")
1451
bb53e1ee 1452;; Inetd.conf
ffe0c7ef 1453(and
bb53e1ee
RS
1454 (memq 'inetd-conf-generic-mode generic-extras-enable-list)
1455
1456(define-generic-mode 'inetd-conf-generic-mode
1457 (list ?#)
ffe0c7ef 1458 (list
bb53e1ee
RS
1459 "stream"
1460 "dgram"
1461 "tcp"
1462 "udp"
1463 "wait"
1464 "nowait"
1465 "internal"
1466 )
1467 '(
1468 ("^\\([-A-Za-z0-9_]+\\)"
1469 1 'font-lock-type-face)
1470 )
1471 '("/etc/inetd.conf\\'")
ffe0c7ef 1472 (list
bb53e1ee
RS
1473 (function
1474 (lambda ()
ffe0c7ef 1475 (setq imenu-generic-expression
bb53e1ee
RS
1476 '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))
1477 )))
1478 )
1479)
1480
1481;; Services
ffe0c7ef 1482(and
bb53e1ee
RS
1483 (memq 'etc-services-generic-mode generic-extras-enable-list)
1484
1485(define-generic-mode 'etc-services-generic-mode
1486 (list ?#)
ffe0c7ef 1487 (list
bb53e1ee
RS
1488 "tcp"
1489 "udp"
1490 "ddp"
1491 )
1492 '(
1493 ("^\\([-A-Za-z0-9_]+\\)\\s-+\\([0-9]+\\)/"
1494 (1 'font-lock-type-face)
1495 (2 'font-lock-variable-name-face)
1496 )
1497 )
1498 '("/etc/services\\'")
ffe0c7ef 1499 (list
bb53e1ee
RS
1500 (function
1501 (lambda ()
ffe0c7ef 1502 (setq imenu-generic-expression
bb53e1ee
RS
1503 '((nil "^\\([-A-Za-z0-9_]+\\)" 1)))
1504 )))
1505 )
1506)
1507
1508;; Password and Group files
ffe0c7ef 1509(and
bb53e1ee
RS
1510 (memq 'etc-passwd-generic-mode generic-extras-enable-list)
1511
1512(define-generic-mode 'etc-passwd-generic-mode
1513 nil ;; No comment characters
1514 (list "root") ;; Only one keyword
1515 (list
1516 (list
1517 (concat
1518 "^"
1519 ;; User name -- Never blank!
1520 "\\([^:]+\\)"
1521 ":"
1522 ;; Password, UID and GID
1523 (mapconcat
1524 'identity
1525 (make-list 3 "\\([^:]+\\)")
1526 ":"
1527 )
1528 ":"
1529 ;; GECOS/Name -- might be blank
1530 "\\([^:]*\\)"
1531 ":"
1532 ;; Home directory and shell
1533 "\\([^:]+\\)"
1534 ":?"
1535 "\\([^:]*\\)"
1536 "$"
1537 )
1538 '(1 'font-lock-type-face)
1539 '(5 'font-lock-variable-name-face)
ffe0c7ef 1540 '(6 'font-lock-constant-face)
bb53e1ee
RS
1541 '(7 'font-lock-warning-face)
1542 )
1543 '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
1544 (1 'font-lock-type-face)
1545 (4 'font-lock-variable-name-face)
1546 )
1547 )
1548 '("/etc/passwd\\'" "/etc/group\\'")
ffe0c7ef 1549 (list
bb53e1ee
RS
1550 (function
1551 (lambda ()
ffe0c7ef 1552 (setq imenu-generic-expression
bb53e1ee
RS
1553 '((nil "^\\([-A-Za-z0-9_]+\\):" 1)))
1554 )))
1555 )
1556)
1557
1558
1559;; From Jacques Duthen <jacques.duthen@sncf.fr>
1560(defvar show-tabs-generic-mode-font-lock-defaults-1
1561 '( ;; trailing spaces must come before...
1562 ("[ \t]+$" . 'show-tabs-space-face)
1563 ;; ...embedded tabs
1564 ("[^\n\t]\\(\t+\\)" (1 'show-tabs-tab-face))))
1565
1566(defvar show-tabs-generic-mode-font-lock-defaults-2
1567 '( ;; trailing spaces must come before...
1568 ("[ \t]+$" . 'show-tabs-space-face)
1569 ;; ...tabs
1570 ("\t+" . 'show-tabs-tab-face)))
1571
1572(defface show-tabs-tab-face
1573 '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
1574 (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
1575 (((class color) (background light)) (:foreground "red"))
1576 (((class color) (background dark)) (:foreground "red"))
1577 (t (:bold t)))
1578 "Font Lock mode face used to highlight TABs."
1579 :group 'show-tabs)
1580
1581(defface show-tabs-space-face
1582 '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
1583 (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
1584 (((class color) (background light)) (:foreground "yellow"))
1585 (((class color) (background dark)) (:foreground "yellow"))
1586 (t (:bold t)))
1587 "Font Lock mode face used to highlight spaces."
1588 :group 'show-tabs)
1589
1590(define-generic-mode 'show-tabs-generic-mode
1591 () ;; no comment char
1592 () ;; no keywords
1593 show-tabs-generic-mode-font-lock-defaults-1
1594 () ;; no auto-mode-alist
1595 ;; (list 'show-tabs-generic-mode-hook-fun)
1596 nil
1597 "Generic mode to show tabs and trailing spaces")
1598
ffe0c7ef
PB
1599;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1600;; DNS modes
1601;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1602
1603(define-generic-mode 'named-boot-generic-mode
1604 ;;List of comment characters
1605 (list ?\;)
1606 ;;List of keywords
1607 (list "cache" "primary" "secondary" "forwarders" "limit" "options"
1608 "directory" "check-names")
1609 ;;List of additional font-lock-expressions
1610 (list
1611 (list "\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face)
1612 (list "^directory\\s-+\\(.*\\)" 1 'font-lock-variable-name-face)
1613 (list "^\\(primary\\|cache\\)\\s-+\\([.A-Za-z]+\\)\\s-+\\(.*\\)"
1614 (list 2 'font-lock-variable-name-face)
1615 (list 3 'font-lock-constant-face))
1616 )
1617 ;;List of additional automode-alist expressions
1618 (list "/etc/named.boot\\'")
1619 ;;List of set up functions to call
1620 nil
1621 )
1622
1623(define-generic-mode 'named-database-generic-mode
1624 ;;List of comment characters
1625 (list ?\;)
1626 ;;List of keywords
1627 (list "IN" "NS" "CNAME" "SOA" "PTR" "MX" "A")
1628 ;;List of additional font-lock-expressions
1629 (list
1630 (list "\\([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\\)" 1 'font-lock-constant-face)
1631 (list "^\\([.A-Za-z0-9]+\\)" 1 'font-lock-variable-name-face)
1632 )
1633 ;;List of additional automode-alist expressions
1634 nil
1635 ;;List of set up functions to call
1636 nil
1637 )
1638
1639(defvar named-database-time-string "%Y%m%d%H"
1640 "Timestring for named serial numbers.")
1641
1642(defun named-database-print-serial ()
1643 "Print a serial number based on the current date."
1644 (interactive)
1645 (insert (format-time-string named-database-time-string (current-time)))
1646 )
1647
1648(define-generic-mode 'resolve-conf-generic-mode
1649 ;;List of comment characters
1650 (list ?#)
1651 ;;List of keywords
1652 (list "nameserver" "domain" "search" "sortlist" "options")
1653 ;;List of additional font-lock-expressions
1654 nil
1655 ;;List of additional automode-alist expressions
1656 (list "/etc/resolv[e]?.conf\\'")
1657 ;;List of set up functions to call
1658 nil
1659 )
1660
1661;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1662;; Modes for spice and common electrical engineering circuit netlist formats
1663;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1664
1665(define-generic-mode 'spice-generic-mode
1666 nil
1667 (list
1668 "and"
1669 "cccs"
1670 "ccvs"
1671 "delay"
1672 "nand"
1673 "nor"
1674 "npwl"
1675 "or"
1676 "par"
1677 "ppwl"
1678 "pwl"
1679 "vccap"
1680 "vccs"
1681 "vcr"
1682 "vcvs"
1683 )
1684 '(
1685 ("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
1686 (" \\(\\$ .*\\)$" 1 'font-lock-comment-face)
1687 ("^\\(\\$ .*\\)$" 1 'font-lock-comment-face)
1688 ("\\([*].*\\)" 1 'font-lock-comment-face)
1689 ("^\\([+]\\)" 1 'font-lock-string-face)
1690 ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face)
1691 ("\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face)
1692 ("\\('[^']+'\\)" 1 'font-lock-string-face)
1693 ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face)
1694 )
1695 (list "\\.[sS][pP]\\'"
1696 "\\.[sS][pP][iI]\\'"
1697 "\\.[sS][pP][iI][cC][eE]\\'"
1698 "\\.[iI][nN][cC]\\'")
1699 (list
1700 'generic-bracket-support
1701 ;; Make keywords case-insensitive
1702 (function
1703 (lambda()
1704 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t))))
1705 )
1706 "Generic mode for SPICE circuit netlist files."
1707 )
1708
1709(define-generic-mode 'ibis-generic-mode
1710 (list ?|)
1711 nil
1712 '(
1713 ("[[]\\([^]]*\\)[]]" 1 'font-lock-keyword-face)
1714 ("\\(\\(_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face)
1715 )
1716 (list "\\.[iI][bB][sS]\\'")
1717 (list 'generic-bracket-support)
1718 "Generic mode for IBIS circuit netlist files."
1719 )
1720
1721(define-generic-mode 'astap-generic-mode
1722 nil
1723 (list
1724 "analyze"
1725 "description"
1726 "elements"
1727 "execution"
1728 "features"
1729 "functions"
1730 "ground"
1731 "model"
1732 "outputs"
1733 "print"
1734 "run"
1735 "controls"
1736 "table"
1737 )
1738 '(
1739 ("^\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
1740 (";\\s-*\\([*].*\\)" 1 'font-lock-comment-face)
1741 ("^\\s-*\\([.]\\w+\\>\\)" 1 'font-lock-keyword-face)
1742 ("\\('[^']+'\\)" 1 'font-lock-string-face)
1743 ("\\(\"[^\"]+\"\\)" 1 'font-lock-string-face)
1744 ("[(,]\\s-*\\(\\([.]\\|_\\|\\w\\)+\\)\\s-*=" 1 'font-lock-variable-name-face)
1745 )
1746 (list "\\.[aA][pP]\\'"
1747 "\\.[aA][sS][xX]\\'"
1748 "\\.[aA][sS][tT][aA][pP]\\'"
1749 "\\.[pP][sS][pP]\\'"
1750 "\\.[dD][eE][cC][kK]\\'"
1751 "\\.[gG][oO][dD][aA][tT][aA]")
1752 (list
1753 'generic-bracket-support
1754 ;; Make keywords case-insensitive
1755 (function
1756 (lambda()
1757 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t))))
1758 )
1759 "Generic mode for ASTAP circuit netlist files."
1760 )
1761
1762
ca1e63a5
RS
1763(provide 'generic-x)
1764
1765;;; generic-x.el ends here