Font lock improvements (highlight word, symbol and tuple definitions).

db4
Jose A. Ortega Ruiz 2008-11-16 00:16:13 +01:00
parent b44bc33d1b
commit 74e5979ba8
1 changed files with 17 additions and 2 deletions

View File

@ -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"