Initial Commit
[packages] / xemacs-packages / ocaml / caml-hilit.el.upstream
1 ; Highlighting patterns for hilit19 under caml-mode
2
3 ; defined also in caml.el
4 (defvar caml-quote-char "'"
5   "*Quote for character constants. \"'\" for Objective Caml, \"`\" for Caml-Light.")
6
7 (defconst caml-mode-patterns
8   (list
9 ;comments
10    '("\\(^\\|[^\"]\\)\\((\\*[^*]*\\*+\\([^)*][^*]*\\*+\\)*)\\)"
11      2 comment)
12 ;string
13    (list 'hilit-string-find (string-to-char caml-quote-char) 'string)
14    (list (concat caml-quote-char "\\(\\\\\\([ntbr" caml-quote-char "\\]\\|"
15                  "[0-9][0-9][0-9]\\)\\|.\\)" caml-quote-char)
16          nil
17          'string)
18 ;labels
19    '("\\(\\([~?]\\|\\<\\)[a-z][a-zA-Z0-9_']*:\\)[^:=]" 1 brown)
20    '("[~?][ (]*[a-z][a-zA-Z0-9_']*" nil brown)
21 ;modules
22    '("\\<\\(assert\\|open\\|include\\)\\>" nil brown)
23    '("`?\\<[A-Z][A-Za-z0-9_\']*\\>" nil MidnightBlue)
24 ;definition
25    (list (concat
26           "\\<\\(a\\(nd\\|s\\)\\|c\\(onstraint\\|lass\\)"
27           "\\|ex\\(ception\\|ternal\\)\\|fun\\(ct\\(ion\\|or\\)\\)?"
28           "\\|in\\(herit\\)?\\|let\\|m\\(ethod\\|utable\\|odule\\)"
29           "\\|of\\|p\\(arser\\|rivate\\)\\|rec\\|type"
30           "\\|v\\(al\\(ue\\)?\\|irtual\\)\\)\\>")
31          nil 'ForestGreen)
32 ;blocking
33    '("\\<\\(object\\|struct\\|sig\\|begin\\|end\\)\\>" 2 include)
34 ;control
35    (list (concat
36           "\\<\\(do\\(ne\\|wnto\\)?\\|else\\|for\\|i\\(f\\|gnore\\)"
37           "\\|lazy\\|match\\|new\\|or\\|t\\(hen\\|o\\|ry\\)"
38           "\\|w\\(h\\(en\\|ile\\)\\|ith\\)\\)\\>"
39           "\\|\|\\|->\\|&\\|#")
40          nil 'keyword)
41    '(";" nil struct))
42   "Hilit19 patterns used for Caml mode")
43
44 (hilit-set-mode-patterns 'caml-mode caml-mode-patterns)
45 (hilit-set-mode-patterns
46  'inferior-caml-mode
47  (append
48   (list
49 ;inferior
50    '("^[#-]"    nil     firebrick))
51   caml-mode-patterns))
52
53 (provide 'caml-hilit)