-
Notifications
You must be signed in to change notification settings - Fork 1
/
bartuer-ragel.el
executable file
·61 lines (55 loc) · 2.47 KB
/
bartuer-ragel.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
(defun ragel-indent-line ()
"proxy indent line to js2"
(interactive)
(js2-indent-line)
)
(defun ragel-new-line ()
"handle new line"
(interactive)
(newline-and-indent)
(ragel-indent-line)
)
(defun bartuer-ragel-load ()
"mode hooks for ragel"
(set (make-local-variable 'ruby-block-beg-keywords) (cons "%%{" ruby-block-beg-keywords))
(set (make-local-variable 'ruby-block-beg-re) (regexp-opt ruby-block-beg-keywords))
(set (make-local-variable 'ruby-block-end-re) "\\<end\\|%%}\\>")
(font-lock-add-keywords
nil
'(
("^ *\\(#.*\\)$" . font-lock-variable-name-face)
(">=" . font-lock-negation-char-face)
("\\(fsm\\)\\(->\\)"
(1 font-lock-variable-name-face)
(2 font-lock-negation-char-face)
)
("\\<\\(\\|fhold\\|fgoto\\|fcall\\|fret\\|fentry\\|fnext\\|fexec\\|fbreak\\)\\>" . font-lock-builtin-face)
("\\<\\(any\\|ascii\\|extend\\|alpha\\|digit\\|alnum\\|lower\\|uper\\|xdigit\\|cntrl\\|graph\\|print\\|punct\\|space\\|null\\|zlen\\|empty\\)\\>" . font-lock-variable-name-face)
("\\<\\(machine\\|action\\|context\\|include\\|range\\|import\\|export\\|prepush\\|postpop\\)\\>" . font-lock-function-name-face)
("\\<\\(write\\) +\\(init\\|data\\|exec\\|exports\\|start\\|error\\|first_final\\|contained\\)\\>"
(1 font-lock-function-name-face nil t)
(2 font-lock-variable-name-face nil t)
)
("\\<\\(when\\|inwhen\\|outwhen\\|err\\|lerr\\|eof\\|from\\|to\\)\\>" . font-lock-keyword-face)
("\\<\\(fpc\\|fc\\|fcurs\\|fbuf\\|fblen\\|ftargs\\|fstack\\)\\>" . font-lock-constant-face)
("\\<\\(noerror\\|nofinal\\|noprefix\\|noend\\|nocs\\|contained\\)\\>" . font-lock-constant-face)
("\\([a-zA-Z\\)]\\|]\\)\\([*+]+\\)"
(2 font-lock-keyword-face))
("\\([a-zA-Z]+\\)\\(:\\)"
(2 font-lock-keyword-face))
("\\([*|][*|]\\)" . font-lock-keyword-face)
("\\([>$@*%<]>?\\)\\([~^~*/]\\|!\\)"
(1 font-lock-keyword-face)
(2 font-lock-keyword-face))
("[^ ]\\([+?*]\\)"
(1 font-lock-keyword-face))
("\\( \\. \\| \\.\\. \\|\\*\\*\\|[>^$%@&|\\!-]\\| ->\\|:>\\|:>>\\|<:\\|=>\\|:=\\|%%\\)" . font-lock-keyword-face)
)
(font-lock-fontify-buffer))
(set (make-local-variable 'indent-line-function) 'ragel-indent-line)
(define-key ruby-mode-map "\C-j" 'compile-ruby)
(define-key c-mode-map "\M-g\C-j" 'show-graph)
(define-key c-mode-map "\M-gj" 'show-graph)
(define-key c-mode-map "\M-gx" 'compile-xml)
(define-key c-mode-map "\C-m" 'newline-and-indent)
)