move JFlex to CE source
[fedora-idea.git] / tools / lexer / jflex-1.4 / lib / jflex-mode.el
blob4149b04d98301dcb31218f504d70fa9a317d6703
1 ; -*- Mode: Emacs-Lisp; -*-
3 ;;; jflex-mode
5 ;;; author: Gerwin Klein <lsf@jflex.de>
6 ;;; $Revision: 2.1 $, $Date: 2003/06/08 11:01:12 $
8 (require 'derived)
9 (require 'font-lock)
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
38 (append
39 '(
40 ("^%%" . font-lock-reference-face)
41 "^%{"
42 "^%init{"
43 "^%initthrow{"
44 "^%eof{"
45 "^%eofthrow{"
46 "^%yylexthrow{"
47 "^%eofval{"
48 "^%}"
49 "^%init}"
50 "^%initthrow}"
51 "^%eof}"
52 "^%eofthrow}"
53 "^%yylexthrow}"
54 "^%eofval}"
55 "^%standalone"
56 "^%scanerror"
57 "^%switch"
58 "^%states" ; fixme: state identifiers
59 "^%state"
60 "^%s"
61 "^%xstates"
62 "^%xstate"
63 "^%x"
64 "^%char"
65 "^%line"
66 "^%column"
67 "^%byaccj"
68 "^%cupsym"
69 "^%cupdebug"
70 "^%cup"
71 "^%eofclose"
72 "^%class"
73 "^%function"
74 "^%type"
75 "^%integer"
76 "^%intwrap"
77 "^%int"
78 "^%yyeof"
79 "^%notunix"
80 "^%7bit"
81 "^%full"
82 "^%8bit"
83 "^%unicode"
84 "^%16bit"
85 "^%caseless"
86 "^%ignorecase"
87 "^%implements"
88 "^%extends"
89 "^%public"
90 "^%apiprivate"
91 "^%final"
92 "^%abstract"
93 "^%debug"
94 "^%table"
95 "^%pack"
96 "^%include"
97 "^%buffer"
98 "^%initthrow"
99 "^%eofthrow"
100 "^%yylexthrow"
101 "^%throws"
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)