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