source: other-projects/gli-rsyntax-textarea/lib/jflex-mode.el

Last change on this file was 25584, checked in by davidb, 12 years ago

Initial cut an a text edit area for GLI that supports color syntax highlighting

File size: 2.5 KB
Line 
1; -*- Mode: Emacs-Lisp; -*-
2
3;;; jflex-mode
4
5;;; author: Gerwin Klein <[email protected]>
6;;; $Revision: 50 $, $Date: 2003-06-08 21:01:12 +1000 (Sun, 08 Jun 2003) $
7
8(require 'derived)
9(require 'font-lock)
10
11(define-derived-mode jflex-mode java-mode "JFlex"
12 "Major mode for editing JFlex files"
13
14 ;; set the indentation
15 (setq c-basic-offset 2)
16
17 (c-set-offset 'knr-argdecl-intro 0)
18 (c-set-offset 'topmost-intro-cont 0)
19
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)
24
25 (use-local-map jflex-mode-map)
26
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)
30
31 (define-key jflex-mode-map [tab] 'jflex-indent-command)
32
33 )
34
35(defalias 'jflex-indent-command 'c-indent-command)
36
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
106 )
107 java-font-lock-keywords-2)
108 "JFlex keywords for font-lock mode")
109
110(put 'jflex-mode 'font-lock-defaults
111 '(jflex-font-lock-keywords
112 nil nil ((?_ . "w")) beginning-of-defun))
113
114(provide 'jflex-mode)
Note: See TracBrowser for help on using the repository browser.