]> gitweb.factorcode.org Git - factor.git/commitdiff
Font lock improvements (highlight word, symbol and tuple definitions).
authorJose A. Ortega Ruiz <jao@gnu.org>
Sat, 15 Nov 2008 23:16:13 +0000 (00:16 +0100)
committerJose A. Ortega Ruiz <jao@gnu.org>
Sat, 15 Nov 2008 23:16:13 +0000 (00:16 +0100)
misc/factor.el

index 2afb5a7b7f37ba717e91fb4c2936379f9993c0ca..553597a1c22c11c671bee4f8cd7948bdb7e380ee 100644 (file)
     "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)
     ,@(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"