blob: 70bf654fb72c1345216aabb89a14cd046d458405 [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 Moolenaard5d015d2013-11-03 21:14:31 +01005" Last Change: 2013 Oct 15 by Jurriƫn Stutterheim
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02007" quit when a syntax file was already loaded
8if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +00009 finish
10endif
11
Bram Moolenaarb6b046b2011-12-30 13:11:27 +010012let s:cpo_save = &cpo
13set cpo&vim
14
Bram Moolenaar071d4272004-06-13 20:20:40 +000015" Some Clean-keywords
16syn keyword cleanConditional if case
17syn keyword cleanLabel let! with where in of
Bram Moolenaar071d4272004-06-13 20:20:40 +000018syn keyword cleanSpecial Start
19syn keyword cleanKeyword infixl infixr infix
20syn keyword cleanBasicType Int Real Char Bool String
21syn keyword cleanSpecialType World ProcId Void Files File
22syn keyword cleanModuleSystem module implementation definition system
23syn keyword cleanTypeClass class instance export
24
Bram Moolenaar56b45b92013-06-24 22:22:18 +020025" Import highlighting
26syn region cleanIncludeRegion start="^\s*\(from\|import\|\s\+\(as\|qualified\)\)" end="\n" contains=cleanIncludeKeyword keepend
27syn keyword cleanIncludeKeyword contained from import as qualified
28
Bram Moolenaar071d4272004-06-13 20:20:40 +000029" To do some Denotation Highlighting
30syn keyword cleanBoolDenot True False
Bram Moolenaard5d015d2013-11-03 21:14:31 +010031syn region cleanStringDenot start=+"+ skip=+\(\(\\\\\)\+\|\\"\)+ end=+"+ display
32syn match cleanCharDenot "'\(\\\\\|\\'\|[^'\\]\)\+'" display
33syn match cleanIntegerDenot "[\~+-]\?\<\(\d\+\|0[0-7]\+\|0x[0-9A-Fa-f]\+\)\>" display
34syn match cleanRealDenot "[\~+-]\?\d\+\.\d\+\(E[\~+-]\?\d\+\)\?" display
Bram Moolenaar071d4272004-06-13 20:20:40 +000035
36" To highlight the use of lists, tuples and arrays
37syn region cleanList start="\[" end="\]" contains=ALL
38syn region cleanRecord start="{" end="}" contains=ALL
39syn region cleanArray start="{:" end=":}" contains=ALL
40syn match cleanTuple "([^=]*,[^=]*)" contains=ALL
41
42" To do some Comment Highlighting
Bram Moolenaard5d015d2013-11-03 21:14:31 +010043syn region cleanComment start="/\*" end="\*/" contains=cleanComment,cleanTodo fold
44syn region cleanComment start="//.*" end="$" display contains=cleanTodo
45syn keyword cleanTodo TODO FIXME XXX contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000046
Bram Moolenaard5d015d2013-11-03 21:14:31 +010047" Now for some useful type definition recognition
48syn match cleanFuncTypeDef "\([a-zA-Z].*\|(\=[-~@#$%^?!+*<>\/|&=:]\+)\=\)\s*\(infix[lr]\=\)\=\s*\d\=\s*::.*->.*" contains=cleanSpecial,cleanBasicType,cleanSpecialType,cleanKeyword
49
Bram Moolenaar071d4272004-06-13 20:20:40 +000050
51" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020052" Only when an item doesn't have highlighting yet
Bram Moolenaar071d4272004-06-13 20:20:40 +000053
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020054 " Comments
Bram Moolenaarf37506f2016-08-31 22:22:10 +020055 hi def link cleanComment Comment
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020056 " Constants and denotations
Bram Moolenaarf37506f2016-08-31 22:22:10 +020057 hi def link cleanStringDenot String
58 hi def link cleanCharDenot Character
59 hi def link cleanIntegerDenot Number
60 hi def link cleanBoolDenot Boolean
61 hi def link cleanRealDenot Float
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020062 " Identifiers
63 " Statements
Bram Moolenaarf37506f2016-08-31 22:22:10 +020064 hi def link cleanTypeClass Keyword
65 hi def link cleanConditional Conditional
66 hi def link cleanLabel Label
67 hi def link cleanKeyword Keyword
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020068 " Generic Preprocessing
Bram Moolenaarf37506f2016-08-31 22:22:10 +020069 hi def link cleanIncludeKeyword Include
70 hi def link cleanModuleSystem PreProc
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020071 " Type
Bram Moolenaarf37506f2016-08-31 22:22:10 +020072 hi def link cleanBasicType Type
73 hi def link cleanSpecialType Type
74 hi def link cleanFuncTypeDef Typedef
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020075 " Special
Bram Moolenaarf37506f2016-08-31 22:22:10 +020076 hi def link cleanSpecial Special
77 hi def link cleanList Special
78 hi def link cleanArray Special
79 hi def link cleanRecord Special
80 hi def link cleanTuple Special
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020081 " Error
82 " Todo
Bram Moolenaarf37506f2016-08-31 22:22:10 +020083 hi def link cleanTodo Todo
Bram Moolenaar071d4272004-06-13 20:20:40 +000084
Bram Moolenaar071d4272004-06-13 20:20:40 +000085
86let b:current_syntax = "clean"
87
Bram Moolenaarb6b046b2011-12-30 13:11:27 +010088let &cpo = s:cpo_save
89unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +000090" vim: ts=4