lisp/bat-file-mode.el
changeset 280 9250e3ad5f4a
parent 279 fd6164dfec82
child 305 732fe4548ed4
equal deleted inserted replaced
259:b6c514e81d2c 280:9250e3ad5f4a
       
     1 ;;; bat-file-mode.el --- batch file major mode
       
     2 
       
     3 ;; Copyright (C) 2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
       
     4 
       
     5 ;; You can do anything with this file without any warranty.
       
     6 
       
     7 ;; Author: Oleksandr Gavenko <gavenkoa@gmail.com>
       
     8 ;; Maintainer: Oleksandr Gavenko <gavenkoa@gmail.com>
       
     9 ;; Created: 2010-01-28
       
    10 ;; Version: 0.1
       
    11 ;; Keywords: languages
       
    12 
       
    13 ;;; Commentary:
       
    14 ;;
       
    15 ;; Very pure highlighting and not all available syntax.
       
    16 
       
    17 ;;; Code:
       
    18 
       
    19 ;;;###autoload
       
    20 (define-generic-mode 'bat-file-mode
       
    21   (list "REM " ":: ")
       
    22   nil
       
    23   '(
       
    24     ("\\(:[[:alnum:]_]+\\)" (1 'font-lock-function-name-face))
       
    25     ("\\<\\([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))
       
    26     ("\\(:[[:alpha:]][[:alnum:]_]*\\)" (1 'font-lock-function-name-face))
       
    27     ;; ("\\(\\%[a-z]\\)" (1 'font-lock-reference-face))
       
    28     ;; ("\\(%\\sw+%\\)" (1 'font-lock-reference-face))
       
    29     ;; ("\\(%[0-9]\\)" (1 'font-lock-reference-face))
       
    30     )
       
    31   (list "\\.\\([bB][aA][tT]\\|[cC][mM][dD]\\|[nN][sS][hH]\\)$")
       
    32   nil
       
    33   "Generic mode for batch files.")
       
    34 
       
    35 ;; (autoload 'myfunction "mypackage" "Do what I say." t)
       
    36 
       
    37 (setq bat-file-mode-hook
       
    38  (lambda ()
       
    39    (modify-syntax-entry ?\" "\"")
       
    40    (modify-syntax-entry ?' "\"")
       
    41    (modify-syntax-entry ?\\ "\\")
       
    42    (modify-syntax-entry ?= ".")
       
    43    (modify-syntax-entry ?_ "w")
       
    44    )
       
    45  )
       
    46 
       
    47 ;; (add-hook
       
    48 ;;  'bat-file-mode-hook
       
    49 ;;  (lambda ()
       
    50 ;;    (modify-syntax-entry ?\" "\"")
       
    51 ;;    (modify-syntax-entry ?' "\"")
       
    52 ;;    (modify-syntax-entry ?\\ "\\")
       
    53 ;;    (modify-syntax-entry ?= ".")
       
    54 ;;    (modify-syntax-entry ?_ "w")
       
    55 ;;    ))
       
    56 
       
    57 ;; .bat file gramma:
       
    58 ;;
       
    59 ;; cmd ::= path { arg }
       
    60 ;; path ::=
       
    61 
       
    62 (provide 'bat-file-mode)
       
    63 
       
    64 ;;; bat-file-mode.el ends here