comparison lisp/generic-x.el @ 50265:e8baa2ffdd8f

Use fixes to rul-generic-mode, contributed by "Rolf Sandau" <Rolf.Sandau@marconi.com> Add etc-modules-conf-generic-mode
author Peter Breton <pbreton@attbi.com>
date Sat, 22 Mar 2003 13:00:38 +0000
parents bef3b39de757
children dad40750b182
comparison
equal deleted inserted replaced
50264:251a71560199 50265:e8baa2ffdd8f
843 nil 843 nil
844 "Generic mode for MS-Windows Resource files.")) 844 "Generic mode for MS-Windows Resource files."))
845 845
846 ;; InstallShield RUL files 846 ;; InstallShield RUL files
847 ;; Contributed by Alfred.Correira@Pervasive.Com 847 ;; Contributed by Alfred.Correira@Pervasive.Com
848 ;; Bugfixes by "Rolf Sandau" <Rolf.Sandau@marconi.com>
848 (and 849 (and
849 (memq 'rul-generic-mode generic-extras-enable-list) 850 (memq 'rul-generic-mode generic-extras-enable-list)
850 ;;; build the regexp strings using regexp-opt 851 ;;; build the regexp strings using regexp-opt
851 (defvar installshield-statement-keyword-list 852 (defvar installshield-statement-keyword-list
852 (list 853 (list
1398 "WIN32SMAJOR" 1399 "WIN32SMAJOR"
1399 "WIN32SMINOR" 1400 "WIN32SMINOR"
1400 ) 1401 )
1401 "Function argument constants used in InstallShield 3 and 5.") 1402 "Function argument constants used in InstallShield 3 and 5.")
1402 1403
1403 (define-generic-mode 'rul-generic-mode 1404 (progn
1404 ;; Using "/*" and "*/" doesn't seem to be working right 1405 (defvar rul-generic-mode-syntax-table nil
1405 (list "//") 1406 "Syntax table to use in rul-generic-mode buffers.")
1406 installshield-statement-keyword-list 1407
1407 (list 1408 (setq rul-generic-mode-syntax-table
1408 ;; preprocessor constructs 1409 (make-syntax-table c++-mode-syntax-table))
1409 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1410
1410 1 font-lock-string-face) 1411 (modify-syntax-entry ?\r "> b" rul-generic-mode-syntax-table)
1411 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?" 1412 (modify-syntax-entry ?\n "> b" rul-generic-mode-syntax-table)
1412 (1 font-lock-constant-face) 1413
1413 (2 font-lock-variable-name-face nil t)) 1414 (cond
1414 ;; indirect string constants 1415 ;; XEmacs 19 & 20 & 21
1415 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face) 1416 ((memq '8-bit c-emacs-features)
1416 ;; gotos 1417 (modify-syntax-entry ?/ ". 1456" rul-generic-mode-syntax-table)
1417 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-constant-face) 1418 (modify-syntax-entry ?* ". 23" rul-generic-mode-syntax-table)
1418 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?" 1419 )
1419 (1 font-lock-keyword-face) 1420 ;; Emacs 19 & 20
1420 (2 font-lock-constant-face nil t)) 1421 ((memq '1-bit c-emacs-features)
1421 ;; system variables 1422 (modify-syntax-entry ?/ ". 124b" rul-generic-mode-syntax-table)
1422 (generic-make-keywords-list 1423 (modify-syntax-entry ?* ". 23" rul-generic-mode-syntax-table)
1423 installshield-system-variables-list 1424 )
1424 'font-lock-variable-name-face "[^_]" "[^_]") 1425 ;; incompatible
1425 ;; system functions 1426 (t (error "Run Mode is incompatible with this version of Emacs"))
1426 (generic-make-keywords-list 1427 )
1427 installshield-system-functions-list 1428
1428 'font-lock-function-name-face "[^_]" "[^_]") 1429 ;; here manually instead
1429 ;; type keywords 1430 (defun generic-rul-mode-setup-function ()
1430 (generic-make-keywords-list 1431 (make-local-variable 'parse-sexp-ignore-comments)
1431 installshield-types-list 1432 (make-local-variable 'comment-start)
1432 'font-lock-type-face "[^_]" "[^_]") 1433 (make-local-variable 'comment-start-skip)
1433 ;; function argument constants 1434 (make-local-variable 'comment-end)
1434 (generic-make-keywords-list 1435 (setq imenu-generic-expression
1435 installshield-funarg-constants-list 1436 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))
1436 'font-lock-variable-name-face "[^_]" "[^_]") ; is this face the best choice? 1437 parse-sexp-ignore-comments t
1437 ) 1438 comment-end "*/"
1438 (list "\\.[rR][uU][lL]$") 1439 comment-start "/*"
1439 (list 1440 ;; comment-end ""
1440 (function 1441 ;; comment-start "//"
1441 (lambda () 1442 ;; comment-start-skip ""
1442 (setq imenu-generic-expression 1443 )
1443 '((nil "^function\\s-+\\([A-Za-z0-9_]+\\)" 1))) 1444 ;; (set-syntax-table rul-generic-mode-syntax-table)
1444 ))) 1445 (setq font-lock-syntax-table rul-generic-mode-syntax-table)
1445 "Generic mode for InstallShield RUL files.") 1446 )
1446 1447
1448 ;; moved mode-definition behind defun-definition to be warning-free - 15.11.02/RSan
1449 (define-generic-mode 'rul-generic-mode
1450 ;; Using "/*" and "*/" doesn't seem to be working right
1451 (list "//" '("/*" . "*/" ))
1452 installshield-statement-keyword-list
1453 (list
1454 ;; preprocessor constructs
1455 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1456 1 font-lock-string-face)
1457 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1458 (1 font-lock-reference-face)
1459 (2 font-lock-variable-name-face nil t))
1460 ;; indirect string constants
1461 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
1462 ;; gotos
1463 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face)
1464 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1465 (1 font-lock-keyword-face)
1466 (2 font-lock-reference-face nil t))
1467 ;; system variables
1468 (generic-make-keywords-list
1469 installshield-system-variables-list
1470 'font-lock-variable-name-face "[^_]" "[^_]")
1471 ;; system functions
1472 (generic-make-keywords-list
1473 installshield-system-functions-list
1474 'font-lock-function-name-face "[^_]" "[^_]")
1475 ;; type keywords
1476 (generic-make-keywords-list
1477 installshield-types-list
1478 'font-lock-type-face "[^_]" "[^_]")
1479 ;; function argument constants
1480 (generic-make-keywords-list
1481 installshield-funarg-constants-list
1482 'font-lock-variable-name-face "[^_]" "[^_]") ; is this face the best choice?
1483 )
1484 (list "\\.[rR][uU][lL]$")
1485 (list 'generic-rul-mode-setup-function)
1486 "Generic mode for InstallShield RUL files.")
1487 )
1447 (define-skeleton rul-if 1488 (define-skeleton rul-if
1448 "Insert an if statement." 1489 "Insert an if statement."
1449 "condition: " 1490 "condition: "
1450 "if(" str ") then" \n 1491 "if(" str ") then" \n
1451 > _ \n 1492 > _ \n
1833 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t)))) 1874 (setq font-lock-defaults (list 'generic-font-lock-defaults nil t))))
1834 ) 1875 )
1835 "Generic mode for ASTAP circuit netlist files." 1876 "Generic mode for ASTAP circuit netlist files."
1836 ) 1877 )
1837 1878
1879 (define-generic-mode 'etc-modules-conf-generic-mode
1880 ;;List of comment characters
1881 (list ?#)
1882 ;;List of keywords
1883 (list "alias" "pre-install" "post-install" "options" "probeall")
1884 ;;List of additional font-lock-expressions
1885 nil
1886 ;;List of additional automode-alist expressions
1887 (list "/etc/modules.conf" "/etc/conf.modules")
1888 ;;List of set up functions to call
1889 nil
1890 )
1838 1891
1839 (provide 'generic-x) 1892 (provide 'generic-x)
1840 1893
1841 ;;; generic-x.el ends here 1894 ;;; generic-x.el ends here