changeset 9386:17dfca2d42e2

(perl-font-lock-keywords): New variable. (perl-mode): Set font-lock-keywords locally.
author Richard M. Stallman <rms@gnu.org>
date Fri, 07 Oct 1994 10:08:48 +0000
parents 297f0781c8ae
children ccd27c6ef48d
files lisp/progmodes/perl-mode.el
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/perl-mode.el	Fri Oct 07 10:07:02 1994 +0000
+++ b/lisp/progmodes/perl-mode.el	Fri Oct 07 10:08:48 1994 +0000
@@ -146,6 +146,25 @@
   (modify-syntax-entry ?| "." perl-mode-syntax-table)
 )
 
+(defvar perl-font-lock-keywords
+  (list
+;   ("if" "until" "while" "elsif" "else" "unless" "for" "foreach" "continue"
+;    "exit" "die" "last" "goto" "next" "redo" "return" "local" "exec")
+   (concat "\\<\\("
+	   "continue\\|die\\|e\\(ls\\(e\\|if\\)\\|x\\(ec\\|it\\)\\)\\|"
+	   "for\\(\\|each\\)\\|goto\\|if\\|l\\(ast\\|ocal\\)\\|next\\|"
+	   "re\\(do\\|turn\\)\\|un\\(less\\|til\\)\\|while"
+	   "\\)\\>")
+;   ("#endif" "#else" "#ifdef" "#ifndef" "#if" "#include" "#define" "#undef")
+   (cons (concat "#\\(define\\|e\\(lse\\|ndif\\)\\|"
+		 "i\\(f\\(\\|def\\|ndef\\)\\|nclude\\)\\|undef\\)\\>")
+	 'font-lock-reference-face)
+   '("^[ \n\t]*sub[ \t]+\\([^ \t{]+\\)[ \t]*[{]" 1 font-lock-function-name-face)
+   '("[ \n\t{]*\\(eval\\)[ \n\t(;]" 1 font-lock-function-name-face)
+   '("\\(--- .* ---\\|=== .* ===\\)" . font-lock-string-face)
+   )
+  "Additional expressions to highlight in Perl mode.")
+
 (defvar perl-indent-level 4
   "*Indentation of Perl statements with respect to containing block.")
 (defvar perl-continued-statement-offset 4
@@ -249,6 +268,8 @@
   (setq comment-indent-function 'perl-comment-indent)
   (make-local-variable 'parse-sexp-ignore-comments)
   (setq parse-sexp-ignore-comments t)
+  (make-local-variable 'font-lock-keywords)
+  (setq font-lock-keywords perl-font-lock-keywords)
   (run-hooks 'perl-mode-hook))
 
 ;; This is used by indent-for-comment