32702
|
1 " Vim syntax file
|
|
2 "
|
|
3 " Language: unison
|
|
4 " Maintainer: Anton Parkhomenko <anton@chuwy.me>
|
|
5 " Last Change: Aug 7, 2023
|
|
6 " Original Author: John Williams, Paul Chiusano and Rúnar Bjarnason
|
|
7
|
|
8 if exists("b:current_syntax")
|
|
9 finish
|
|
10 endif
|
|
11
|
|
12 syntax include @markdown $VIMRUNTIME/syntax/markdown.vim
|
|
13
|
|
14 syn cluster markdownLikeDocs contains=markdownBold,markdownItalic,markdownLinkText,markdownListMarker,markdownOrderedListMarker,markdownH1,markdownH2,markdownH3,markdownH4,markdownH5,markdownH6
|
|
15
|
|
16 syn match unisonOperator "[-!#$%&\*\+/<=>\?@\\^|~]"
|
|
17 syn match unisonDelimiter "[\[\](){},.]"
|
|
18
|
|
19 " Strings and constants
|
|
20 syn match unisonSpecialChar contained "\\\([0-9]\+\|o[0-7]\+\|x[0-9a-fA-F]\+\|[\"\\'&\\abfnrtv]\|^[A-Z^_\[\\\]]\)"
|
|
21 syn match unisonSpecialChar contained "\\\(NUL\|SOH\|STX\|ETX\|EOT\|ENQ\|ACK\|BEL\|BS\|HT\|LF\|VT\|FF\|CR\|SO\|SI\|DLE\|DC1\|DC2\|DC3\|DC4\|NAK\|SYN\|ETB\|CAN\|EM\|SUB\|ESC\|FS\|GS\|RS\|US\|SP\|DEL\)"
|
|
22 syn match unisonSpecialCharError contained "\\&\|'''\+"
|
|
23 syn region unisonString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=unisonSpecialChar
|
|
24 syn match unisonCharacter "[^a-zA-Z0-9_']'\([^\\]\|\\[^']\+\|\\'\)'"lc=1 contains=unisonSpecialChar,unisonSpecialCharError
|
|
25 syn match unisonCharacter "^'\([^\\]\|\\[^']\+\|\\'\)'" contains=unisonSpecialChar,unisonSpecialCharError
|
|
26 syn match unisonNumber "\<[0-9]\+\>\|\<0[xX][0-9a-fA-F]\+\>\|\<0[oO][0-7]\+\>"
|
|
27 syn match unisonFloat "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"
|
|
28
|
|
29 " Keyword definitions. These must be patterns instead of keywords
|
|
30 " because otherwise they would match as keywords at the start of a
|
|
31 " "literate" comment (see lu.vim).
|
|
32 syn match unisonModule "\<namespace\>"
|
|
33 syn match unisonImport "\<use\>"
|
|
34 syn match unisonTypedef "\<\(unique\|structural\|∀\|forall\)\>"
|
|
35 syn match unisonStatement "\<\(ability\|do\|type\|where\|match\|cases\|;\|let\|with\|handle\)\>"
|
|
36 syn match unisonConditional "\<\(if\|else\|then\)\>"
|
|
37
|
|
38 syn match unisonBoolean "\<\(true\|false\)\>"
|
|
39
|
|
40 syn match unisonType "\<\C[A-Z][0-9A-Za-z_'!]*\>"
|
|
41 syn match unisonName "\<\C[a-z_][0-9A-Za-z_'!]*\>"
|
|
42
|
|
43 " Comments
|
|
44 syn match unisonLineComment "---*\([^-!#$%&\*\+./<=>\?@\\^|~].*\)\?$"
|
|
45 syn region unisonBlockComment start="{-" end="-}" contains=unisonBlockComment
|
|
46 syn region unisonBelowFold start="^---" skip="." end="." contains=unisonBelowFold
|
|
47
|
|
48 " Docs
|
|
49 syn region unisonDocBlock matchgroup=unisonDoc start="{{" end="}}" contains=unisonDocTypecheck,unisonDocQuasiquote,unisonDocDirective,unisonDocCode,unisonDocCodeInline,unisonDocCodeRaw,unisonDocMono,@markdownLikeDocs
|
|
50 syn region unisonDocQuasiquote contained matchgroup=unisonDocQuote start="{{" end= "}}" contains=TOP
|
|
51 syn region unisonDocCode contained matchgroup=unisonDocCode start="^\s*```\s*$" end="^\s*```\s*$" contains=TOP
|
|
52 syn region unisonDocTypecheck contained matchgroup=unisonDocCode start="^\s*@typecheck\s*```\s*$" end="^\s*```\s*$" contains=TOP
|
|
53 syn region unisonDocCodeRaw contained matchgroup=unisonDocCode start="^\s*```\s*raw\s*$" end="^\s*```\s*$" contains=NoSyntax
|
|
54 syn region unisonDocCodeInline contained matchgroup=unisonDocCode start="`\@<!``" end="`\@<!``" contains=TOP
|
|
55 syn match unisonDocMono "''[^']*''"
|
|
56 syn region unisonDocDirective contained matchgroup=unisonDocDirective start="\(@\([a-zA-Z0-9_']*\)\)\?{{\@!" end="}" contains=TOP
|
|
57
|
|
58 syn match unisonDebug "\<\(todo\|bug\|Debug.trace\|Debug.evalToText\)\>"
|
|
59
|
|
60 " things like
|
|
61 " > my_func 1 3
|
|
62 " test> Function.tap.tests.t1 = check let
|
|
63 " use Nat == +
|
|
64 " ( 99, 100 ) === (withInitialValue 0 do
|
|
65 " : : :
|
|
66 syn match unisonWatch "^[A-Za-z]*>"
|
|
67
|
|
68 hi def link unisonWatch Debug
|
|
69 hi def link unisonDocMono Delimiter
|
|
70 hi def link unisonDocDirective Import
|
|
71 hi def link unisonDocQuote Delimiter
|
|
72 hi def link unisonDocCode Delimiter
|
|
73 hi def link unisonDoc String
|
|
74 hi def link unisonBelowFold Comment
|
|
75 hi def link unisonBlockComment Comment
|
|
76 hi def link unisonBoolean Boolean
|
|
77 hi def link unisonCharacter Character
|
|
78 hi def link unisonComment Comment
|
|
79 hi def link unisonConditional Conditional
|
|
80 hi def link unisonConditional Conditional
|
|
81 hi def link unisonDebug Debug
|
|
82 hi def link unisonDelimiter Delimiter
|
|
83 hi def link unisonDocBlock String
|
|
84 hi def link unisonDocDirective Import
|
|
85 hi def link unisonDocIncluded Import
|
|
86 hi def link unisonFloat Float
|
|
87 hi def link unisonImport Include
|
|
88 hi def link unisonLineComment Comment
|
|
89 hi def link unisonLink Type
|
|
90 hi def link unisonName Identifier
|
|
91 hi def link unisonNumber Number
|
|
92 hi def link unisonOperator Operator
|
|
93 hi def link unisonSpecialChar SpecialChar
|
|
94 hi def link unisonSpecialCharError Error
|
|
95 hi def link unisonStatement Statement
|
|
96 hi def link unisonString String
|
|
97 hi def link unisonType Type
|
|
98 hi def link unisonTypedef Typedef
|
|
99
|
|
100
|
|
101 let b:current_syntax = "unison"
|
|
102
|
|
103 " Options for vi: ts=8 sw=2 sts=2 nowrap noexpandtab ft=vim
|