lisp/bat-file-mode.el
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 28 Jan 2010 21:39:42 +0200
changeset 279 fd6164dfec82
parent 273 3b0d646154dc
child 305 732fe4548ed4
permissions -rw-r--r--
Update copyright statement and year.

;;; bat-file-mode.el --- batch file major mode

;; Copyright (C) 2010 by Oleksandr Gavenko <gavenkoa@gmail.com>

;; You can do anything with this file without any warranty.

;; Author: Oleksandr Gavenko <gavenkoa@gmail.com>
;; Maintainer: Oleksandr Gavenko <gavenkoa@gmail.com>
;; Created: 2010-01-28
;; Version: 0.1
;; Keywords: languages

;;; Commentary:
;;
;; Very pure highlighting and not all available syntax.

;;; Code:

;;;###autoload
(define-generic-mode 'bat-file-mode
  (list "REM " ":: ")
  nil
  '(
    ("\\(:[[:alnum:]_]+\\)" (1 'font-lock-function-name-face))
    ("\\<\\([iI][fF]\\|[fF][oO][rR]\\|[gG][oO][tT][oO]\\|[pP][aA][uU][sS][eE]\\|[eE][cC][hH][oO]\\|[pP][rR][oO][mM][pP][tT]\\|[cC][aA][lL][lL]\\|[sS][eE][tT]\\|[sS][tT][aA][rR][tT]\\)\\>" (1 'font-lock-keyword-face))
    ("\\(:[[:alpha:]][[:alnum:]_]*\\)" (1 'font-lock-function-name-face))
    ;; ("\\(\\%[a-z]\\)" (1 'font-lock-reference-face))
    ;; ("\\(%\\sw+%\\)" (1 'font-lock-reference-face))
    ;; ("\\(%[0-9]\\)" (1 'font-lock-reference-face))
    )
  (list "\\.\\([bB][aA][tT]\\|[cC][mM][dD]\\|[nN][sS][hH]\\)$")
  nil
  "Generic mode for batch files.")

;; (autoload 'myfunction "mypackage" "Do what I say." t)

(setq bat-file-mode-hook
 (lambda ()
   (modify-syntax-entry ?\" "\"")
   (modify-syntax-entry ?' "\"")
   (modify-syntax-entry ?\\ "\\")
   (modify-syntax-entry ?= ".")
   (modify-syntax-entry ?_ "w")
   )
 )

;; (add-hook
;;  'bat-file-mode-hook
;;  (lambda ()
;;    (modify-syntax-entry ?\" "\"")
;;    (modify-syntax-entry ?' "\"")
;;    (modify-syntax-entry ?\\ "\\")
;;    (modify-syntax-entry ?= ".")
;;    (modify-syntax-entry ?_ "w")
;;    ))

;; .bat file gramma:
;;
;; cmd ::= path { arg }
;; path ::=

(provide 'bat-file-mode)

;;; bat-file-mode.el ends here