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