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>
|
5425
|
5 " Last Change: 2013 Oct 15 by Jurriƫn Stutterheim
|
7
|
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
|
3237
|
15 let s:cpo_save = &cpo
|
|
16 set cpo&vim
|
|
17
|
7
|
18 " Some Clean-keywords
|
|
19 syn keyword cleanConditional if case
|
|
20 syn keyword cleanLabel let! with where in of
|
|
21 syn keyword cleanSpecial Start
|
|
22 syn keyword cleanKeyword infixl infixr infix
|
|
23 syn keyword cleanBasicType Int Real Char Bool String
|
|
24 syn keyword cleanSpecialType World ProcId Void Files File
|
|
25 syn keyword cleanModuleSystem module implementation definition system
|
|
26 syn keyword cleanTypeClass class instance export
|
|
27
|
4992
|
28 " Import highlighting
|
|
29 syn region cleanIncludeRegion start="^\s*\(from\|import\|\s\+\(as\|qualified\)\)" end="\n" contains=cleanIncludeKeyword keepend
|
|
30 syn keyword cleanIncludeKeyword contained from import as qualified
|
|
31
|
7
|
32 " To do some Denotation Highlighting
|
|
33 syn keyword cleanBoolDenot True False
|
5425
|
34 syn region cleanStringDenot start=+"+ skip=+\(\(\\\\\)\+\|\\"\)+ end=+"+ display
|
|
35 syn match cleanCharDenot "'\(\\\\\|\\'\|[^'\\]\)\+'" display
|
|
36 syn match cleanIntegerDenot "[\~+-]\?\<\(\d\+\|0[0-7]\+\|0x[0-9A-Fa-f]\+\)\>" display
|
|
37 syn match cleanRealDenot "[\~+-]\?\d\+\.\d\+\(E[\~+-]\?\d\+\)\?" display
|
7
|
38
|
|
39 " To highlight the use of lists, tuples and arrays
|
|
40 syn region cleanList start="\[" end="\]" contains=ALL
|
|
41 syn region cleanRecord start="{" end="}" contains=ALL
|
|
42 syn region cleanArray start="{:" end=":}" contains=ALL
|
|
43 syn match cleanTuple "([^=]*,[^=]*)" contains=ALL
|
|
44
|
|
45 " To do some Comment Highlighting
|
5425
|
46 syn region cleanComment start="/\*" end="\*/" contains=cleanComment,cleanTodo fold
|
|
47 syn region cleanComment start="//.*" end="$" display contains=cleanTodo
|
|
48 syn keyword cleanTodo TODO FIXME XXX contained
|
7
|
49
|
5425
|
50 " Now for some useful type definition recognition
|
|
51 syn match cleanFuncTypeDef "\([a-zA-Z].*\|(\=[-~@#$%^?!+*<>\/|&=:]\+)\=\)\s*\(infix[lr]\=\)\=\s*\d\=\s*::.*->.*" contains=cleanSpecial,cleanBasicType,cleanSpecialType,cleanKeyword
|
|
52
|
7
|
53
|
|
54 " Define the default highlighting.
|
|
55 " For version 5.7 and earlier: only when not done already
|
|
56 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
57 if version >= 508 || !exists("did_clean_syntax_init")
|
|
58 if version < 508
|
|
59 let did_clean_syntax_init = 1
|
|
60 command -nargs=+ HiLink hi link <args>
|
|
61 else
|
|
62 command -nargs=+ HiLink hi def link <args>
|
|
63 endif
|
|
64
|
|
65 " Comments
|
|
66 HiLink cleanComment Comment
|
|
67 " Constants and denotations
|
|
68 HiLink cleanStringDenot String
|
|
69 HiLink cleanCharDenot Character
|
|
70 HiLink cleanIntegerDenot Number
|
|
71 HiLink cleanBoolDenot Boolean
|
|
72 HiLink cleanRealDenot Float
|
|
73 " Identifiers
|
|
74 " Statements
|
|
75 HiLink cleanTypeClass Keyword
|
|
76 HiLink cleanConditional Conditional
|
|
77 HiLink cleanLabel Label
|
|
78 HiLink cleanKeyword Keyword
|
|
79 " Generic Preprocessing
|
4992
|
80 HiLink cleanIncludeKeyword Include
|
7
|
81 HiLink cleanModuleSystem PreProc
|
|
82 " Type
|
|
83 HiLink cleanBasicType Type
|
|
84 HiLink cleanSpecialType Type
|
|
85 HiLink cleanFuncTypeDef Typedef
|
|
86 " Special
|
|
87 HiLink cleanSpecial Special
|
|
88 HiLink cleanList Special
|
|
89 HiLink cleanArray Special
|
|
90 HiLink cleanRecord Special
|
|
91 HiLink cleanTuple Special
|
|
92 " Error
|
|
93 " Todo
|
5425
|
94 HiLink cleanTodo Todo
|
7
|
95
|
|
96 delcommand HiLink
|
|
97 endif
|
|
98
|
|
99 let b:current_syntax = "clean"
|
|
100
|
3237
|
101 let &cpo = s:cpo_save
|
|
102 unlet s:cpo_save
|
7
|
103 " vim: ts=4
|