@@ -11,14 +11,16 @@ syntax keyword resBoolean true false
11
11
" Keywords
12
12
syntax keyword resKeyword let rec type external mutable lazy private of with
13
13
syntax keyword resKeyword if else switch when
14
- syntax keyword resKeyword and as open include module in constraint import export
15
- syntax keyword resKeyword for to downto while
16
- syntax keyword resKeyword try catch exception assert
14
+ syntax keyword resKeyword and as module constraint import export
15
+ syntax keyword resInclude open include
16
+ syntax keyword resRepeat for to downto while in
17
+ syntax keyword resException try catch exception assert
17
18
syntax keyword resKeyword async await
18
19
19
20
" Types
20
- syntax keyword resType bool int float char string unit
21
- syntax keyword resType list array option ref exn format
21
+ syntax keyword resType bool int float char string unit promise
22
+ syntax keyword resType array option ref exn format
23
+ syntax match resType " list{\@ !"
22
24
23
25
" Operators
24
26
syntax keyword resOperator mod land lor lxor lsl lsr asr
@@ -44,9 +46,11 @@ syntax match resOperator "\v\>\="
44
46
syntax match resOperator " \v\@ "
45
47
46
48
syntax match resOperator " \v\! "
47
- syntax match resOperator " \v\| "
48
49
syntax match resOperator " \v\& "
49
50
51
+ " Delimiter
52
+ syntax match resDelimiter " \v\| "
53
+
50
54
" Refs
51
55
syntax match resOperator " \v\:\= "
52
56
@@ -56,6 +60,9 @@ syntax match resArrowPipe "\v\-\>"
56
60
syntax match resArrowPipe " \v\|\> "
57
61
syntax match resArrowPipe " \v\@\@ "
58
62
63
+ " Builtin functions
64
+ syntax match resFunction " list{\@ ="
65
+
59
66
" Comment
60
67
syntax region resSingleLineComment start =" //" end =" $" contains =resTodo,@Spell
61
68
syntax region resMultiLineComment start =" /\*\s *" end =" \* /" contains =@Spell,resTodo,resMultiLineComment
@@ -76,7 +83,10 @@ syntax match resModuleOrVariant "\v<[A-Z][A-Za-z0-9_'$]*"
76
83
syntax match resModuleChain " \v <[A-Z][A-Za-z0-9_'$]*\. "
77
84
78
85
" Attribute
79
- syntax match resAttribute " \v\@ ([a-zA-z][A-Za-z0-9_']*)(\. ([a-zA-z])[A-Za-z0-9_']*)*"
86
+ syntax match resAttribute " \v (\@ |\@\@ )([a-zA-z][A-Za-z0-9_']*)(\. ([a-zA-z])[A-Za-z0-9_']*)*"
87
+
88
+ " Extension
89
+ syntax match resExtension " \v (\% |\%\% )([a-zA-z][A-Za-z0-9_']*)(\. ([a-zA-z])[A-Za-z0-9_']*)*"
80
90
81
91
" String
82
92
syntax match resUnicodeChar " \v\\ u[A-Fa-f0-9]\{ 4}" contained
@@ -85,6 +95,9 @@ syntax match resInterpolatedStringEscapeSeq "\v\\[\\`ntbrf]" contained
85
95
86
96
syntax region resString start =" \v\" " end =" \v\" " contains =resStringEscapeSeq,resUnicodeChar
87
97
98
+ " Custom Operator
99
+ syntax region resCustomOperator start =" \v\\\" " end =" \v\" "
100
+
88
101
" Interpolation
89
102
syntax match resInterpolationVariable " \v\$ [a-z_][A-Za-z0-0_'$]*" contained
90
103
syntax region resInterpolationBlock matchgroup =resInterpolationDelimiters start =" \v\$\{ " end =" \v\} " contained contains =TOP
@@ -97,11 +110,27 @@ syntax match resPolyVariant "\v#[0-9]+"
97
110
syntax match resPolyVariant " \v #\" .*\" "
98
111
syntax match resPolyVariant " \v #\\\" .*\" "
99
112
113
+ " Errors
114
+ syn match resBraceErr " }"
115
+ syn match resBrackErr " \] "
116
+ syn match resParenErr " )"
117
+ syn match resArrErr " |]"
118
+
119
+ " Enclosing delimiters
120
+ syn region resNone transparent matchgroup =resEncl start =" (" matchgroup =resEncl end =" )" contains =ALLBUT,resParenErr
121
+ syn region resNone transparent matchgroup =resEncl start =" {" matchgroup =resEncl end =" }" contains =ALLBUT,resBraceErr
122
+ syn region resNone transparent matchgroup =resEncl start =" \[ " matchgroup =resEncl end =" \] " contains =ALLBUT,resBrackErr
123
+ syn region resNone transparent matchgroup =resEncl start =" \[ |" matchgroup =resEncl end =" |\] " contains =ALLBUT,resArrErr
124
+
100
125
highlight default link resBoolean Boolean
101
126
highlight default link resKeyword Keyword
127
+ highlight default link resInclude Include
128
+ highlight default link resException Exception
129
+ highlight default link resRepeat Repeat
102
130
highlight default link resType Type
103
131
highlight default link resOperator Operator
104
132
highlight default link resArrowPipe Operator
133
+ highlight default link resDelimiter Operator
105
134
highlight default link resSingleLineComment Comment
106
135
highlight default link resMultiLineComment Comment
107
136
highlight default link resTodo TODO
@@ -118,5 +147,9 @@ highlight default link resString String
118
147
highlight default link resInterpolationDelimiters Macro
119
148
highlight default link resInterpolationVariable Macro
120
149
highlight default link resAttribute PreProc
150
+ highlight default link resExtension PreProc
151
+ highlight default link resEncl Keyword
152
+ highlight default link resFunction Function
153
+ highlight default link resCustomOperator String
121
154
122
155
let b: current_syntax = " rescript"
0 commit comments