Added base incomplete bat-file mode.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 28 Jan 2010 21:28:44 +0200
changeset 273 3b0d646154dc
parent 272 f7fba93f4028
child 274 7c18567f0754
Added base incomplete bat-file mode.
lisp/bat-file-mode.el
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/bat-file-mode.el	Thu Jan 28 21:28:44 2010 +0200
@@ -0,0 +1,62 @@
+;;; bat-file-mode.el --- batch file major mode
+
+;; Copyright (C) 2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
+
+;; 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