Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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> |
Bram Moolenaar | 531da59 | 2013-05-06 05:58:55 +0200 | [diff] [blame] | 5 | " Previous Change: 2011 Dec 25 by Thilo Six |
| 6 | " Last Change: 2013 Apr 25 by Jurriën Stutterheim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 16 | let s:cpo_save = &cpo |
| 17 | set cpo&vim |
| 18 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | " Some Clean-keywords |
| 20 | syn keyword cleanConditional if case |
| 21 | syn keyword cleanLabel let! with where in of |
Bram Moolenaar | 531da59 | 2013-05-06 05:58:55 +0200 | [diff] [blame] | 22 | syn keyword cleanInclude from import qualified |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | b6b046b | 2011-12-30 13:11:27 +0100 | [diff] [blame] | 98 | let &cpo = s:cpo_save |
| 99 | unlet s:cpo_save |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 100 | " vim: ts=4 |