blob: 7bdacfc50708f971ed4ae9ed49bc0e9f8eae45f5 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" 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>
Bram Moolenaar531da592013-05-06 05:58:55 +02005" Previous Change: 2011 Dec 25 by Thilo Six
6" Last Change: 2013 Apr 25 by Jurriën Stutterheim
Bram Moolenaar071d4272004-06-13 20:20:40 +00007
8" For version 5.x: Clear all syntax items
9" For version 6.x: Quit when a syntax file was already loaded
10if version < 600
11 syntax clear
12elseif exists("b:current_syntax")
13 finish
14endif
15
Bram Moolenaarb6b046b2011-12-30 13:11:27 +010016let s:cpo_save = &cpo
17set cpo&vim
18
Bram Moolenaar071d4272004-06-13 20:20:40 +000019" Some Clean-keywords
20syn keyword cleanConditional if case
21syn keyword cleanLabel let! with where in of
Bram Moolenaar531da592013-05-06 05:58:55 +020022syn keyword cleanInclude from import qualified
Bram Moolenaar071d4272004-06-13 20:20:40 +000023syn keyword cleanSpecial Start
24syn keyword cleanKeyword infixl infixr infix
25syn keyword cleanBasicType Int Real Char Bool String
26syn keyword cleanSpecialType World ProcId Void Files File
27syn keyword cleanModuleSystem module implementation definition system
28syn keyword cleanTypeClass class instance export
29
30" To do some Denotation Highlighting
31syn keyword cleanBoolDenot True False
32syn region cleanStringDenot start=+"+ end=+"+
33syn match cleanCharDenot "'.'"
34syn match cleanCharsDenot "'[^'\\]*\(\\.[^'\\]\)*'" contained
35syn match cleanIntegerDenot "[+-~]\=\<\(\d\+\|0[0-7]\+\|0x[0-9A-Fa-f]\+\)\>"
36syn match cleanRealDenot "[+-~]\=\<\d\+\.\d+\(E[+-~]\=\d+\)\="
37
38" To highlight the use of lists, tuples and arrays
39syn region cleanList start="\[" end="\]" contains=ALL
40syn region cleanRecord start="{" end="}" contains=ALL
41syn region cleanArray start="{:" end=":}" contains=ALL
42syn match cleanTuple "([^=]*,[^=]*)" contains=ALL
43
44" To do some Comment Highlighting
45syn region cleanComment start="/\*" end="\*/" contains=cleanComment
46syn match cleanComment "//.*"
47
48" Now for some useful typedefinitionrecognition
49syn 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
54if 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
94endif
95
96let b:current_syntax = "clean"
97
Bram Moolenaarb6b046b2011-12-30 13:11:27 +010098let &cpo = s:cpo_save
99unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +0000100" vim: ts=4