sml-mode

smlコードを読もうと思ったところ、xyzzyにsml-modeが無かった。
なので勉強がてらelisp(xyzzylisp?)を弄ってみた。
キーワードハイライトまでしか出来てない。

xyzzy Lisp Programmingのページを参考にさせていただいた。
多謝。


とりあえず次はオートインデントだろうか…難しそう。

sml-mode.l
;exports
(export '(sml-mode
	  *sml-mode-hook*
	  *sml-mode-map*))
;hook
(defvar *sml-mode-hook* nil)

;keymap
(defvar *sml-mode-map* nil)
(unless *sml-mode-map*
  (setq *sml-mode-map* (make-sparse-keymap)))

;keyword
(defvar *sml-keyword-hash-table* nil)
(defvar *sml-keyword-file* "SML")

;syntax table
(defvar *sml-mode-syntax-table* nil)
(unless *sml-mode-syntax-table*
  (setq *sml-mode-syntax-table* (make-syntax-table)))
(set-syntax-start-multi-comment *sml-mode-syntax-table* "(*")
(set-syntax-end-multi-comment *sml-mode-syntax-table* "*)")

;command
(defun sml-mode ()
  (interactive)
  (kill-all-local-variables)
  (setq mode-name "StandardML")
  (setq buffer-mode 'sml-mode)
  (use-syntax-table *sml-mode-syntax-table*)
  (use-keymap *sml-mode-map*)
  ;load keywords
  (and *sml-keyword-file*
       (null *sml-keyword-hash-table*)
       (setq *sml-keyword-hash-table*
	     (load-keyword-file *sml-keyword-file* t)))
  (when *sml-keyword-hash-table*
    (make-local-variable 'keyword-hash-table)
    (setq keyword-hash-table *sml-keyword-hash-table*))
  ;run hooks
  (run-hooks '*sml-mode-hook*))
SML
abstype
and
andalso
as
case
datatype
do
else
end
edtype
exception
fn
fun
functor
handle
if
in
include
infix
infixr
let
local
nonfix
of
op
open
orelse
raise
rec
sharing
sig
signature
struct
structure
then
type
val
where
while
with
withtype