1 ; -*- Mode: Emacs-Lisp; -*-
5 ;;; author: Gerwin Klein <lsf@jflex.de>
6 ;;; $Revision: 2.1 $, $Date: 2003/06/08 11:01:12 $
11 (define-derived-mode jflex-mode java-mode
"JFlex"
12 "Major mode for editing JFlex files"
14 ;; set the indentation
15 (setq c-basic-offset
2)
17 (c-set-offset 'knr-argdecl-intro
0)
18 (c-set-offset 'topmost-intro-cont
0)
20 ;; remove auto and hungry anything
21 (c-toggle-auto-hungry-state -
1)
22 (c-toggle-auto-state -
1)
23 (c-toggle-hungry-state -
1)
25 (use-local-map jflex-mode-map
)
27 ;; get rid of that damn electric-brace
28 (define-key jflex-mode-map
"{" 'self-insert-command
)
29 (define-key jflex-mode-map
"}" 'self-insert-command
)
31 (define-key jflex-mode-map
[tab] 'jflex-indent-command)
35 (defalias 'jflex-indent-command 'c-indent-command)
37 (defconst jflex-font-lock-keywords
40 ("^%%" . font-lock-reference-face)
58 "^%states" ; fixme: state identifiers
102 ("%[%{}0-9a-zA-Z]+" . font-lock-warning-face) ; errors
103 ("{[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*}" . font-lock-variable-name-face) ; macro uses
104 "<<EOF>>" ; special <<EOF>> symbol
105 ("<[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*\\(,[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*\\)*>" . font-lock-type-face) ; lex state list
107 java-font-lock-keywords-2)
108 "JFlex keywords for font-lock mode")
110 (put 'jflex-mode 'font-lock-defaults
111 '(jflex-font-lock-keywords
112 nil nil ((?_ . "w")) beginning-of-defun))
114 (provide 'jflex-mode)