;; yue-mode.el --- a simple major mode for editing Yue files

;; Version: 201509155555.0000
;; Author: Getty Ritter
;; Url: https://github.com/aisamanra/yue-mode

(setq yue-font-lock
      '(( "\\<\\(and\\|do\\|else\\|elseif\\|end\\|for\\|function\\|if\\|in\\|local\\|match\\|mut\\|not\\|or\\|repeat\\|return\\|then\\|type\\|until\\|while\\)\\>" . font-lock-keyword-face )
        ( "\\<\\(\\(u\\|s\\)\\(8\\|16\\|32\\|64\\)\\|f32\\|f64\\|arr\\)\\>" . font-lock-builtin-face )
        ( "\\(type\\|function\\) \\([A-Za-z][A-Za-z0-9_]*\\)" 2 font-lock-function-name-face )
        ( "\\(for\\|local\\) \\([A-Za-z][A-Za-z0-9_]*\\)" 2 font-lock-variable-name-face )
        ( "\\([A-Za-z_][A-Za-z0-9_]*\\) *:" 1 font-lock-variable-name-face )))

(defvar yue-syntax-table nil "Syntax table for `yue-mode'.")
(setq yue-syntax-table
      (let ((table (make-syntax-table)))

        (modify-syntax-entry ?- ". 12b" table)
        (modify-syntax-entry ?\n "> b" table)
        table))

(define-derived-mode yue-mode prog-mode
  "Yue mode is a major mode for editing Yue files"
  :syntax-table yue-syntax-table

  (setq font-lock-defaults '(yue-font-lock))
  (setq mode-name "Yue mode")
  (setq comment-start "--")
  (setq comment-end ""))

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

(provide 'yue-mode)

;;; yue-mode.el ends here
