From 74e5979ba85741aa3a56bdba015d1b6d214337cc Mon Sep 17 00:00:00 2001 From: "Jose A. Ortega Ruiz" Date: Sun, 16 Nov 2008 00:16:13 +0100 Subject: [PATCH] Font lock improvements (highlight word, symbol and tuple definitions). --- misc/factor.el | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/misc/factor.el b/misc/factor.el index 2afb5a7b7f..553597a1c2 100644 --- a/misc/factor.el +++ b/misc/factor.el @@ -91,11 +91,23 @@ "TUPLE:" "T{" "t\\??" "TYPEDEF:" "UNION:" "USE:" "USING:" "V{" "VAR:" "VARS:" "W{")) -(defconst factor--regex--parsing-words-ext +(defconst factor--regex-parsing-words-ext (regexp-opt '("B" "call-next-method" "delimiter" "f" "flushable" "foldable" "initial:" "inline" "parsing" "read-only" "recursive") 'words)) +(defun factor--regex-second-word (prefixes) + (format "^%s +\\([^ ]+\\)" (regexp-opt prefixes t))) + +(defconst factor--regex-word-definition + (factor--regex-second-word '(":" "::" "M:" "GENERIC:"))) + +(defconst factor--regex-type-definition + (factor--regex-second-word '("TUPLE:"))) + +(defconst factor--regex-const-definition + (factor--regex-second-word '("SYMBOL:"))) + (defconst factor-font-lock-keywords `(("#!.*$" . font-lock-comment-face) ("!( .* )" . font-lock-comment-face) @@ -108,7 +120,10 @@ ,@(mapcar #'(lambda (w) (cons (concat "\\(^\\| \\)\\(" w "\\)\\($\\| \\)") '(2 font-lock-keyword-face))) factor--parsing-words) - (,factor--regex--parsing-words-ext . font-lock-keyword-face))) + (,factor--regex-parsing-words-ext . font-lock-keyword-face) + (,factor--regex-word-definition 2 font-lock-function-name-face) + (,factor--regex-type-definition 2 font-lock-type-face) + (,factor--regex-const-definition 2 font-lock-constant-face))) (defun factor-indent-line () "Indent current line as Factor code"