-
Notifications
You must be signed in to change notification settings - Fork 0
/
jflex-mode.el
114 lines (99 loc) · 2.5 KB
/
jflex-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
; -*- Mode: Emacs-Lisp; -*-
;;; jflex-mode
;;; author: Gerwin Klein <[email protected]>
;;; $Revision: 50 $, $Date: 2003-06-08 21:01:12 +1000 (Sun, 08 Jun 2003) $
(require 'derived)
(require 'font-lock)
(define-derived-mode jflex-mode java-mode "JFlex"
"Major mode for editing JFlex files"
;; set the indentation
(setq c-basic-offset 2)
(c-set-offset 'knr-argdecl-intro 0)
(c-set-offset 'topmost-intro-cont 0)
;; remove auto and hungry anything
(c-toggle-auto-hungry-state -1)
(c-toggle-auto-state -1)
(c-toggle-hungry-state -1)
(use-local-map jflex-mode-map)
;; get rid of that damn electric-brace
(define-key jflex-mode-map "{" 'self-insert-command)
(define-key jflex-mode-map "}" 'self-insert-command)
(define-key jflex-mode-map [tab] 'jflex-indent-command)
)
(defalias 'jflex-indent-command 'c-indent-command)
(defconst jflex-font-lock-keywords
(append
'(
("^%%" . font-lock-reference-face)
"^%{"
"^%init{"
"^%initthrow{"
"^%eof{"
"^%eofthrow{"
"^%yylexthrow{"
"^%eofval{"
"^%}"
"^%init}"
"^%initthrow}"
"^%eof}"
"^%eofthrow}"
"^%yylexthrow}"
"^%eofval}"
"^%standalone"
"^%scanerror"
"^%switch"
"^%states" ; fixme: state identifiers
"^%state"
"^%s"
"^%xstates"
"^%xstate"
"^%x"
"^%char"
"^%line"
"^%column"
"^%byaccj"
"^%cupsym"
"^%cupdebug"
"^%cup"
"^%eofclose"
"^%class"
"^%function"
"^%type"
"^%integer"
"^%intwrap"
"^%int"
"^%yyeof"
"^%notunix"
"^%7bit"
"^%full"
"^%8bit"
"^%unicode"
"^%16bit"
"^%caseless"
"^%ignorecase"
"^%implements"
"^%extends"
"^%public"
"^%apiprivate"
"^%final"
"^%abstract"
"^%debug"
"^%table"
"^%pack"
"^%include"
"^%buffer"
"^%initthrow"
"^%eofthrow"
"^%yylexthrow"
"^%throws"
("%[%{}0-9a-zA-Z]+" . font-lock-warning-face) ; errors
("{[ \t]*[a-zA-Z][0-9a-zA-Z_]+[ \t]*}" . font-lock-variable-name-face) ; macro uses
"<<EOF>>" ; special <<EOF>> symbol
("<[ \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
)
java-font-lock-keywords-2)
"JFlex keywords for font-lock mode")
(put 'jflex-mode 'font-lock-defaults
'(jflex-font-lock-keywords
nil nil ((?_ . "w")) beginning-of-defun))
(provide 'jflex-mode)