;; pico-ml-mode.el --- a simple major mode for editing PicoML files

;; Version: 20150815.0000
;; Author: Getty ritter
;; Url: https://github.com/aisamanra/pico-ml-mode

(setq pico-ml-font-lock
      '(( "data\\|record\\|let\\|in\\|if\\|implicit\\|exports\\|import" . font-lock-keyword-face )
        ( "^\\(implicit *\\)?\\([a-z][A-Za-z0-9]*\\|[_+*/\!@~#$%^&=|<>]+\\)" 2 font-lock-function-name-face )
        ( "\\.[a-z][A-Za-z-9]*" . font-lock-variable-name-face )
        ( "Bool\\|Nat\\|Int\\|Float\\|String" . font-lock-builtin-face )
        ( "[A-Z][A-Za-z0-9]+" . font-lock-type-face )))

(defvar pico-ml-syntax-table nil "Syntax table for `pico-ml-mode'.")
(setq pico-ml-syntax-table
      (let ((table (make-syntax-table)))
        (modify-syntax-entry ?- ". 12b" table)
        (modify-syntax-entry ?\n "> b" table)
        (modify-syntax-entry ?( "($")
        (modify-syntax-entry ?) ")^")

        table))

(define-derived-mode pico-ml-mode prog-mode
  "PicoML mode is a major mode for editing PicoML files"
  :syntax-table pico-ml-syntax-table

  (setq font-lock-defaults '(pico-ml-font-lock))
  (setq mode-name "PicoML mode")
  (setq comment-start "--")
  (setq comment-end ""))

;;;###autoload
(add-to-list 'auto-mode-alist '("\\.pml\\'" . pico-ml-mode))

(provide 'pico-ml-mode)

;;; pico-ml-mode.el ends here
