]> code.delx.au - gnu-emacs-elpa/commitdiff
(sml-font-lock-symbols-alist): Add entries for simple type variables.
authormonnier <>
Mon, 15 Nov 2004 23:00:38 +0000 (23:00 +0000)
committermonnier <>
Mon, 15 Nov 2004 23:00:38 +0000 (23:00 +0000)
(sml-font-lock-compose-symbol): Add support for non-punctuation syms.

sml-mode.el

index 10d2fa117377400a18cf6352a185eebe33cd8e6a..7186550812e02e29ed4f9f029bd3f37924a5c811 100644 (file)
@@ -190,32 +190,46 @@ and `unicode'."
    ;; The symbols can come from a JIS0208 font.
    (and (fboundp 'make-char) (charsetp 'japanese-jisx0208)
        (memq sml-font-lock-symbols '(t japanese-jisx0208))
-       (list ;; (cons "\\" (make-char 'japanese-jisx0208 38 75))
+       (list (cons "fn" (make-char 'japanese-jisx0208 38 75))
              (cons "->" (make-char 'japanese-jisx0208 34 42))
-             ;; (cons "<-" (make-char 'japanese-jisx0208 34 43))
+             (cons "=>" (make-char 'japanese-jisx0208 34 77))
+             (cons "<-" (make-char 'japanese-jisx0208 34 43))
              (cons ">=" (make-char 'japanese-jisx0208 33 102))
              (cons "<=" (make-char 'japanese-jisx0208 33 101))
-             (cons "=>" (make-char 'japanese-jisx0208 34 77))))
+             ;; Some greek letters for type parameters.
+             (cons "'a" (make-char 'japanese-jisx0208 38 65))
+             (cons "'b" (make-char 'japanese-jisx0208 38 66))
+             (cons "'c" (make-char 'japanese-jisx0208 38 67))
+             (cons "'d" (make-char 'japanese-jisx0208 38 68))
+             ))
    ;; Or a unicode font.
    (and (fboundp 'decode-char)
        (memq sml-font-lock-symbols '(t unicode))
-       (list ;; (cons "\\" (decode-char 'ucs 955))
+       (list (cons "fn" (decode-char 'ucs 955))
+             (cons "o"  (decode-char 'ucs 9675))
              (cons "->" (decode-char 'ucs 8594))
-             ;; (cons "<-" (decode-char 'ucs 8592))
+             (cons "=>" (decode-char 'ucs 8658))
+             (cons "<-" (decode-char 'ucs 8592))
              (cons ">=" (decode-char 'ucs 8805))
              (cons "<=" (decode-char 'ucs 8804))
-             (cons "=>" (decode-char 'ucs 8658))
              ;; (cons "::" (decode-char 'ucs 8759))
+             ;; Some greek letters for type parameters.
+             (cons "'a" (decode-char 'ucs 945))
+             (cons "'b" (decode-char 'ucs 946))
+             (cons "'c" (decode-char 'ucs 947))
+             (cons "'d" (decode-char 'ucs 948))
              ))))
 
 (defun sml-font-lock-compose-symbol (alist)
   "Compose a sequence of ascii chars into a symbol.
 Regexp match data 0 points to the chars."
   ;; Check that the chars should really be composed into a symbol.
-  (let ((start (match-beginning 0))
-       (end (match-end 0)))
-    (if (or (memq (char-syntax (or (char-before start) ?\ )) '(?. ?\\))
-           (memq (char-syntax (or (char-after end) ?\ )) '(?. ?\\))
+  (let* ((start (match-beginning 0))
+        (end (match-end 0))
+        (syntaxes (if (eq (char-syntax (char-after start)) ?w)
+                      '(?w) '(?. ?\\))))
+    (if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes)
+           (memq (char-syntax (or (char-after end) ?\ )) syntaxes)
            (memq (get-text-property start 'face)
                  '(font-lock-doc-face font-lock-string-face
                    font-lock-comment-face)))