]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/ocaml/contrib/emacs/caml-hilit.el
Update
[l4.git] / l4 / pkg / ocaml / ocaml / contrib / emacs / caml-hilit.el
1 ;(***********************************************************************)
2 ;(*                                                                     *)
3 ;(*                           Objective Caml                            *)
4 ;(*                                                                     *)
5 ;(*                Jacques Garrigue and Ian T Zimmerman                 *)
6 ;(*                                                                     *)
7 ;(*  Copyright 1997 Institut National de Recherche en Informatique et   *)
8 ;(*  en Automatique.  All rights reserved.  This file is distributed    *)
9 ;(*  under the terms of the GNU General Public License.                 *)
10 ;(*                                                                     *)
11 ;(***********************************************************************)
12
13 ;(* $Id: caml-hilit.el 6612 2004-08-20 17:04:35Z doligez $ *)
14
15 ; Highlighting patterns for hilit19 under caml-mode
16
17 ; defined also in caml.el
18 (defvar caml-quote-char "'"
19   "*Quote for character constants. \"'\" for Objective Caml, \"`\" for Caml-Light.")
20
21 (defconst caml-mode-patterns
22   (list
23 ;comments
24    '("\\(^\\|[^\"]\\)\\((\\*[^*]*\\*+\\([^)*][^*]*\\*+\\)*)\\)"
25      2 comment)
26 ;string
27    (list 'hilit-string-find (string-to-char caml-quote-char) 'string)
28    (list (concat caml-quote-char "\\(\\\\\\([ntbr" caml-quote-char "\\]\\|"
29                  "[0-9][0-9][0-9]\\)\\|.\\)" caml-quote-char)
30          nil
31          'string)
32 ;labels
33    '("\\(\\([~?]\\|\\<\\)[a-z][a-zA-Z0-9_']*:\\)[^:=]" 1 brown)
34    '("[~?][ (]*[a-z][a-zA-Z0-9_']*" nil brown)
35 ;modules
36    '("\\<\\(assert\\|open\\|include\\)\\>" nil brown)
37    '("`?\\<[A-Z][A-Za-z0-9_\']*\\>" nil MidnightBlue)
38 ;definition
39    (list (concat
40           "\\<\\(a\\(nd\\|s\\)\\|c\\(onstraint\\|lass\\)"
41           "\\|ex\\(ception\\|ternal\\)\\|fun\\(ct\\(ion\\|or\\)\\)?"
42           "\\|in\\(herit\\)?\\|let\\|m\\(ethod\\|utable\\|odule\\)"
43           "\\|of\\|p\\(arser\\|rivate\\)\\|rec\\|type"
44           "\\|v\\(al\\|irtual\\)\\)\\>")
45          nil 'ForestGreen)
46 ;blocking
47    '("\\<\\(object\\|struct\\|sig\\|begin\\|end\\)\\>" 2 include)
48 ;control
49    (list (concat
50           "\\<\\(do\\(ne\\|wnto\\)?\\|else\\|for\\|i\\(f\\|gnore\\)"
51           "\\|lazy\\|match\\|new\\|or\\|t\\(hen\\|o\\|ry\\)"
52           "\\|w\\(h\\(en\\|ile\\)\\|ith\\)\\)\\>"
53           "\\|\|\\|->\\|&\\|#")
54          nil 'keyword)
55    '(";" nil struct))
56   "Hilit19 patterns used for Caml mode")
57
58 (hilit-set-mode-patterns 'caml-mode caml-mode-patterns)
59 (hilit-set-mode-patterns
60  'inferior-caml-mode
61  (append
62   (list
63 ;inferior
64    '("^[#-]"    nil     firebrick))
65   caml-mode-patterns))
66
67 (provide 'caml-hilit)