comparison lisp/generic-x.el @ 23375:2656333fd35e

(bat-generic-mode): Fix regexps for keywords and built-in commands. Add more built-in commands and fix face names.
author Eli Zaretskii <eliz@gnu.org>
date Tue, 06 Oct 1998 12:19:11 +0000
parents 47ffa41d5ed5
children ba60301081e8
comparison
equal deleted inserted replaced
23374:0110032de8b3 23375:2656333fd35e
272 (lambda () 272 (lambda ()
273 (setq imenu-generic-expression 273 (setq imenu-generic-expression
274 '((nil "^\\s-*\\(.*\\)\\s-*=" 1)))))) 274 '((nil "^\\s-*\\(.*\\)\\s-*=" 1))))))
275 "Generic mode for MS-Windows Registry files.")) 275 "Generic mode for MS-Windows Registry files."))
276 276
277 ;;; Windows BAT files 277 ;;; DOS/Windows BAT files
278 (if (not (memq 'bat-generic-mode generic-extras-enable-list)) 278 (if (not (memq 'bat-generic-mode generic-extras-enable-list))
279 nil 279 nil
280 (define-generic-mode 'bat-generic-mode 280 (define-generic-mode 'bat-generic-mode
281 nil 281 nil
282 nil 282 nil
283 (list 283 (list
284 ;; Make this one first in the list, otherwise comments will 284 ;; Make this one first in the list, otherwise comments will
285 ;; be over-written by other variables 285 ;; be over-written by other variables
286 (list "^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 'font-lock-comment-face t) 286 (list "^[@ \t]*\\([rR][eE][mM][^\n\r]*\\)" 1 'font-lock-comment-face t)
287 (list "^[ \t]*\\(::-.*\\)" 1 'font-lock-comment-face t) 287 (list "^[ \t]*\\(::-.*\\)" 1 'font-lock-comment-face t)
288 ;; These keywords appear as the first word on a line 288 (list
289 "^[@ \t]*\\([bB][rR][eE][aA][kK]\\|[vV][eE][rR][iI][fF][yY]\\)[ \t]+\\([oO]\\([nN]\\|[fF][fF]\\)\\)"
290 '(1 font-lock-builtin-face)
291 '(2 font-lock-constant-face 'append t))
292 ;; Any text (except ON/OFF) following ECHO is a string.
293 (list
294 "^[@ \t]*\\([eE][cC][hH][oO]\\)[ \t]+\\(\\([oO]\\([nN]\\|[fF][fF]\\)\\)\\|\\([^>|\r\n]+\\)\\)"
295 '(1 font-lock-builtin-face)
296 '(3 font-lock-constant-face t t)
297 '(5 font-lock-string-face t t))
298 ;; These keywords appear as the first word on a line. (Actually, they
299 ;; can also appear after "if ..." or "for ..." clause, but since they
300 ;; are frequently used in simple text, we punt.)
289 (generic-make-keywords-list 301 (generic-make-keywords-list
290 (list 302 (list
291 "[cC][aA][lL][lL]" 303 "FOR" "for" "For"
292 "[eE][cC][hH][oO]" 304 "IF" "if" "If"
293 "[fF][oO][rR]"
294 "[iI][fF]"
295 "[pP][aA][tT][hH]"
296 "[pP][aA][uU][sS][eE]"
297 "[pP][rR][oO][mM][pP][tT]"
298 "[sS][eE][tT]"
299 "[sS][tT][aA][rR][tT]"
300 ) 305 )
301 'font-lock-keyword-face "^[@ \t]*") 306 'font-lock-keyword-face "^[@ \t]*")
302 ;; These keywords can be anywhere on a line 307 ;; These keywords can be anywhere on a line
303 (generic-make-keywords-list 308 (generic-make-keywords-list
304 (list 309 (list
305 "[eE][xX][iI][sS][tT]" 310 "DO" "do" "Do"
306 "[eE][rR][rR][oO][rR][lL][eE][vV][eE][lL]" 311 "EXIST" "exist" "Exist"
307 "[gG][oO][tT][oO]" 312 "ERRORLEVEL" "errorlevel" "ErrorLevel" "Errorlevel"
308 "[nN][oO][tT]" 313 "GOTO" "goto" "GoTo" "Goto"
309 ) 'font-lock-keyword-face) 314 "NOT" "not" "Not"
315 ) 'font-lock-keyword-face "[ \t|\n]")
316 ; These are built-in commands. Only frequently-used ones are listed.
317 (generic-make-keywords-list
318 (list
319 "CALL" "call" "Call"
320 "CD" "cd" "Cd"
321 "CLS" "cls" "Cls"
322 "COPY" "copy" "Copy"
323 "DEL" "del" "Del"
324 "ECHO" "echo" "Echo"
325 "MD" "md" "Md"
326 "PATH" "path" "Path"
327 "PAUSE" "pause" "Pause"
328 "PROMPT" "prompt" "Prompt"
329 "RD" "rd" "Rd"
330 "REN" "ren" "Ren"
331 "SET" "set" "Set"
332 "START" "start" "Start"
333 "SHIFT" "shift" "Shift"
334 ) 'font-lock-builtin-face "[ \t|\n]")
310 (list "^[ \t]*\\(:\\sw+\\)" 1 'font-lock-function-name-face t) 335 (list "^[ \t]*\\(:\\sw+\\)" 1 'font-lock-function-name-face t)
311 (list "\\(%\\sw+%\\)" 1 'font-lock-reference-face) 336 (list "\\(%\\sw+%\\)" 1 'font-lock-variable-name-face t)
312 (list "\\(%[0-9]\\)" 1 'font-lock-reference-face) 337 (list "\\(%[0-9]\\)" 1 'font-lock-variable-name-face t)
313 (list "\\(/[^/ \"\t\n]+\\)" 1 'font-lock-type-face) 338 (list "\\(/[^/ \"\t\n]+\\)" 1 'font-lock-type-face)
314 (list "[\t ]+\\([+-][^\t\n\" ]+\\)" 1 'font-lock-type-face) 339 (list "[\t ]+\\([+-][^\t\n\" ]+\\)" 1 'font-lock-type-face)
315 (list "\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?" 340 (list "[ \t\n|]\\<\\([gG][oO][tT][oO]\\)\\>[ \t]*\\(\\sw+\\)?"
316 '(1 font-lock-keyword-face) 341 '(1 font-lock-keyword-face)
317 '(2 font-lock-function-name-face nil t)) 342 '(2 font-lock-function-name-face nil t))
343 (list "[ \t\n|]\\<\\([sS][eE][tT]\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*=?"
344 '(1 font-lock-builtin-face)
345 '(2 font-lock-variable-name-face t t))
318 346
319 ) 347 )
320 (list "\\.[bB][aA][tT]\\'" "CONFIG\\." "AUTOEXEC\\." ) 348 (list
349 "\\.[bB][aA][tT]\\'"
350 "\\`[cC][oO][nN][fF][iI][gG]\\."
351 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\." )
321 (list 'generic-bat-mode-setup-function) 352 (list 'generic-bat-mode-setup-function)
322 "Generic mode for MS-Windows BAT files.") 353 "Generic mode for MS-Windows BAT files.")
323 354
324 (defvar bat-generic-mode-syntax-table nil 355 (defvar bat-generic-mode-syntax-table nil
325 "Syntax table in use in bat-generic-mode buffers.") 356 "Syntax table in use in bat-generic-mode buffers.")