7
|
1 " Vim syntax file
|
|
2 " Language: Clean
|
|
3 " Author: Pieter van Engelen <pietere@sci.kun.nl>
|
|
4 " Co-Author: Arthur van Leeuwen <arthurvl@sci.kun.nl>
|
|
5 " Last Change: Fri Sep 29 11:35:34 CEST 2000
|
|
6
|
|
7 " For version 5.x: Clear all syntax items
|
|
8 " For version 6.x: Quit when a syntax file was already loaded
|
|
9 if version < 600
|
|
10 syntax clear
|
|
11 elseif exists("b:current_syntax")
|
|
12 finish
|
|
13 endif
|
|
14
|
|
15 " Some Clean-keywords
|
|
16 syn keyword cleanConditional if case
|
|
17 syn keyword cleanLabel let! with where in of
|
|
18 syn keyword cleanInclude from import
|
|
19 syn keyword cleanSpecial Start
|
|
20 syn keyword cleanKeyword infixl infixr infix
|
|
21 syn keyword cleanBasicType Int Real Char Bool String
|
|
22 syn keyword cleanSpecialType World ProcId Void Files File
|
|
23 syn keyword cleanModuleSystem module implementation definition system
|
|
24 syn keyword cleanTypeClass class instance export
|
|
25
|
|
26 " To do some Denotation Highlighting
|
|
27 syn keyword cleanBoolDenot True False
|
|
28 syn region cleanStringDenot start=+"+ end=+"+
|
|
29 syn match cleanCharDenot "'.'"
|
|
30 syn match cleanCharsDenot "'[^'\\]*\(\\.[^'\\]\)*'" contained
|
|
31 syn match cleanIntegerDenot "[+-~]\=\<\(\d\+\|0[0-7]\+\|0x[0-9A-Fa-f]\+\)\>"
|
|
32 syn match cleanRealDenot "[+-~]\=\<\d\+\.\d+\(E[+-~]\=\d+\)\="
|
|
33
|
|
34 " To highlight the use of lists, tuples and arrays
|
|
35 syn region cleanList start="\[" end="\]" contains=ALL
|
|
36 syn region cleanRecord start="{" end="}" contains=ALL
|
|
37 syn region cleanArray start="{:" end=":}" contains=ALL
|
|
38 syn match cleanTuple "([^=]*,[^=]*)" contains=ALL
|
|
39
|
|
40 " To do some Comment Highlighting
|
|
41 syn region cleanComment start="/\*" end="\*/" contains=cleanComment
|
|
42 syn match cleanComment "//.*"
|
|
43
|
|
44 " Now for some useful typedefinitionrecognition
|
|
45 syn match cleanFuncTypeDef "\([a-zA-Z].*\|(\=[-~@#$%^?!+*<>\/|&=:]\+)\=\)[ \t]*\(infix[lr]\=\)\=[ \t]*\d\=[ \t]*::.*->.*" contains=cleanSpecial
|
|
46
|
|
47 " Define the default highlighting.
|
|
48 " For version 5.7 and earlier: only when not done already
|
|
49 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
50 if version >= 508 || !exists("did_clean_syntax_init")
|
|
51 if version < 508
|
|
52 let did_clean_syntax_init = 1
|
|
53 command -nargs=+ HiLink hi link <args>
|
|
54 else
|
|
55 command -nargs=+ HiLink hi def link <args>
|
|
56 endif
|
|
57
|
|
58 " Comments
|
|
59 HiLink cleanComment Comment
|
|
60 " Constants and denotations
|
|
61 HiLink cleanCharsDenot String
|
|
62 HiLink cleanStringDenot String
|
|
63 HiLink cleanCharDenot Character
|
|
64 HiLink cleanIntegerDenot Number
|
|
65 HiLink cleanBoolDenot Boolean
|
|
66 HiLink cleanRealDenot Float
|
|
67 " Identifiers
|
|
68 " Statements
|
|
69 HiLink cleanTypeClass Keyword
|
|
70 HiLink cleanConditional Conditional
|
|
71 HiLink cleanLabel Label
|
|
72 HiLink cleanKeyword Keyword
|
|
73 " Generic Preprocessing
|
|
74 HiLink cleanInclude Include
|
|
75 HiLink cleanModuleSystem PreProc
|
|
76 " Type
|
|
77 HiLink cleanBasicType Type
|
|
78 HiLink cleanSpecialType Type
|
|
79 HiLink cleanFuncTypeDef Typedef
|
|
80 " Special
|
|
81 HiLink cleanSpecial Special
|
|
82 HiLink cleanList Special
|
|
83 HiLink cleanArray Special
|
|
84 HiLink cleanRecord Special
|
|
85 HiLink cleanTuple Special
|
|
86 " Error
|
|
87 " Todo
|
|
88
|
|
89 delcommand HiLink
|
|
90 endif
|
|
91
|
|
92 let b:current_syntax = "clean"
|
|
93
|
|
94 " vim: ts=4
|