      ;; A slot is either a single symbol or a sequence along the
      ;; lines: { foo initial: "bar }
      ("\\(\\(?:\\sw\\|\\s_\\)+\\)\\|\\(?:{[ \n]+\\(\\(?:\\sw\\|\\s_\\)+\\)[^}]+\\)"
-      ((lambda (&rest foo)
-         (save-excursion
-           (re-search-forward " ;" nil t)
-           (1- (point)))))
+      (factor-find-end-of-def)
       nil
       (1 'factor-font-lock-symbol nil t)
       (2 'factor-font-lock-symbol nil t)))
 
+    ;; Highlights alien function definitions. Types in stack effect
+    ;; declarations are given a bold face.
+    (,(format "\\(\\(?:GL-\\)?FUNCTION\\):[ \n]+%s[ \n]+%s[ \n]+" symbol symbol)
+     (1 'factor-font-lock-parsing-word)
+     (2 'factor-font-lock-type-name)
+     (3 'factor-font-lock-word)
+     ;; Regexp from hell that puts every type name in the first group,
+     ;; names and brackets in the second and third.
+     ("\\(?:\\(\\(?:\\sw\\|\\s_\\)+\\)[ \n]+\\(\\(?:\\sw\\|\\s_\\)+,?\\(?:[ \n]+)\\)?\\)\\|\\([()]\\)\\)"
+      (factor-find-end-of-def)
+      nil
+      (1 'factor-font-lock-type-in-stack-effect nil t)
+      (2 'factor-font-lock-stack-effect nil t)
+      (3 'factor-font-lock-stack-effect nil t)))
+
+    ;; Almost identical to the previous one, but for function aliases.
+    (,(format "\\(FUNCTION-ALIAS\\):[ \n]+%s[ \n]+%s[ \n]+%s[ \n]+"
+              symbol symbol symbol)
+     (1 'factor-font-lock-parsing-word)
+     (2 'factor-font-lock-word)
+     (3 'factor-font-lock-type-name)
+     (4 'factor-font-lock-word)
+     ("\\(?:\\(\\(?:\\sw\\|\\s_\\)+\\)[ \n]+\\(\\(?:\\sw\\|\\s_\\)+,?\\(?:[ \n]+)\\)?\\)\\|\\([()]\\)\\)"
+      (factor-find-end-of-def)
+      nil
+      (1 'factor-font-lock-type-in-stack-effect nil t)
+      (2 'factor-font-lock-stack-effect nil t)
+      (3 'factor-font-lock-stack-effect nil t)))
+
+    (,factor-stack-effect-regex . 'factor-font-lock-stack-effect)
     (,factor-constructor-regex . 'factor-font-lock-constructor)
     (,factor-setter-regex . 'factor-font-lock-setter-word)
     (,factor-getter-regex . 'factor-font-lock-getter-word)


(defsubst factor-beginning-of-sexp-pos ()
  (save-excursion (factor-beginning-of-sexp) (point)))




(defface factor-font-lock-stack-effect '((t :inherit font-lock-comment-face))
  "Face for Factor stack effect declarations."
  :group 'factor-faces
  :group 'faces)

(defface factor-font-lock-type-in-stack-effect '((t :inherit font-lock-comment-face
                                                    :bold t))
  "Face for Factor types in stack effect declarations."
  :group 'factor-faces
  :group 'faces)

