Newer
Older
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
;;; lutin.el - Major mode for editing lustre source in Emacs
(require 'font-lock)
; version of lutin-mode
(defconst lutin-mode-version "0.0")
;;; Hooks
(defvar lutin-mode-hook nil
"functions called when entering Lutin Mode.")
;;; Key-map for Lutin-mode
(defvar lutin-mode-map nil
"Keymap for lutin major mode.")
;;; Font-lock -----------------------------------------------------
(defvar lutin-font-lock-keywords nil
"Regular expression used by Font-lock mode.")
(setq lutin-font-lock-keywords
'(
("--.*$" . font-lock-comment-face)
("\\<\\(loop\\|fby\\||raise\\|try\\|trap\\|catch\\|do\\)\\>" . font-lock-builtin-face)
("\\<\\(const\\|extern\\|node\\|run\\|include\\|returns\\|type\\)\\>" . font-lock-keyword-face)
("\\<\\(let\\|assert\\|exist\\|in\\|if\\|then\\|else\\)\\>" . font-lock-keyword-face)
("\\<\\(true\\|and\\|or\\|not\\|false\\)\\>" . font-lock-reference-face)
("\\<\\(trace\\|bool\\|int\\|ref\\|real\\)\\(\\^.+\\)?\\>" . font-lock-type-face)
("\\<\\(pre\\)\\>" . font-lock-constant-face)
))
(defun lutin-font-mode ()
"Initialisation of font-lock for Lutin mode."
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
'(lutin-font-lock-keywords t)))
; font-lock isn't used if in a console
(if window-system
(prog2
(add-hook 'lutin-mode-hook
'turn-on-font-lock)
(add-hook 'lutin-mode-hook
'lutin-font-mode)))
(defun lutin-line-is-comment (&optional arg)
"non-nil means line is only a commentary."
(interactive)
(save-excursion
(beginning-of-line arg)
(skip-chars-forward " \t")
(looking-at "--")))
(setq comment-start "(*")
(setq comment-end "*)")
(setq comment-start "-- ")
(setq comment-end "")
;;; Major-mode
(defun lutin-mode ()
"Major mode for editing Lutin files.
Only keywords colaraition for the moment...
"
(interactive)
(kill-all-local-variables)
(setq major-mode 'lutin-mode)
(setq mode-name "Lutin")
(use-local-map lutin-mode-map)
(run-hooks 'lutin-mode-hook))
(provide 'lutin)
;;; lutin .el ends here...