-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.vbnet.js
220 lines (218 loc) · 7.51 KB
/
source.vbnet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/angryant0007/VBDotNetSyntax>
// and licensed `apache-2.0`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: [
'.bi',
'.rbbas',
'.rbfrm',
'.rbmnu',
'.rbres',
'.rbtbar',
'.rbuistate',
'.vb',
'.vbhtml',
'.vbs'
],
names: [
'fb',
'freebasic',
'realbasic',
'vb-.net',
'vb.net',
'vbnet',
'vbscript',
'visual-basic',
'visual-basic-.net'
],
patterns: [
{include: '#comment-single-quote'},
{include: '#comment-rem'},
{include: '#keyword-a'},
{include: '#keyword-b'},
{include: '#keyword-c'},
{include: '#keyword-d'},
{include: '#keyword-e'},
{include: '#keyword-f'},
{include: '#keyword-g'},
{include: '#keyword-h'},
{include: '#keyword-i'},
{include: '#keyword-j'},
{include: '#keyword-k'},
{include: '#keyword-l'},
{include: '#keyword-m'},
{include: '#keyword-n'},
{include: '#keyword-o'},
{include: '#keyword-p'},
{include: '#keyword-r'},
{include: '#keyword-s'},
{include: '#keyword-t'},
{include: '#keyword-u'},
{include: '#keyword-v'},
{include: '#keyword-w'},
{include: '#keyword-x'},
{include: '#keyword-y'},
{include: '#integer-literal'},
{include: '#floating-point-literal'},
{include: '#character-literal'},
{include: '#string-literal'},
{include: '#date-literal'},
{include: '#symbol'},
{include: '#identifier'}
],
repository: {
'character-literal': {
match:
'(?i:["\\x{201C}\\x{201D}]([^"\\x{201C}\\x{201D}]|["\\x{201C}\\x{201D}]{2})["\\x{201C}\\x{201D}]C)',
name: 'string.quoted.double.vbnet'
},
'comment-rem': {
match:
'(?i)(?<=[^_\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}\\p{Nl}\\p{Nd}\\p{Mn}\\p{Mc}\\p{Cf}\\p{Pc}])REM((?=[\\r|\\n])| [^\\r\\n]*)',
name: 'comment.line.singlequote.vbnet'
},
'comment-single-quote': {
match: "['\\x{2018}\\x{2019}][^\\r\\n]*",
name: 'comment.line.singlequote.vbnet'
},
'date-literal': {
match:
'(#\\s*(((((\\d+/\\d+/\\d+)|(\\d+-\\d+-\\d+))\\s+(\\d+:\\d+(:\\d+)?\\s*(AM|PM)?)))|((\\d+/\\d+/\\d+)|(\\d+-\\d+-\\d+))|(\\d+:\\d+(:\\d+)?\\s*(AM|PM)?))\\s*#)',
name: 'string.quoted.double.vbnet'
},
'floating-point-literal': {
match:
'(?i:[0-9]*(\\.[0-9]+)?((?<=[0-9])E[+-]?[0-9]+)?(?<=[0-9])[FRD@&#]?)',
name: 'string.quoted.double.vbnet'
},
identifier: {
match:
'(([\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}\\p{Nl}]|_[_\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}\\p{Nl}\\p{Nd}\\p{Mn}\\p{Mc}\\p{Cf}\\p{Pc}])[_\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}\\p{Nl}\\p{Nd}\\p{Mn}\\p{Mc}\\p{Cf}\\p{Pc}]*[%&@!#$]?|\\[([\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}\\p{Nl}]|_[_\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}\\p{Nl}\\p{Nd}\\p{Mn}\\p{Mc}\\p{Cf}\\p{Pc}])[_\\p{Lu}\\p{Ll}\\p{Lt}\\p{Lm}\\p{Lo}\\p{Nl}\\p{Nd}\\p{Mn}\\p{Mc}\\p{Cf}\\p{Pc}]*\\])',
name: 'variable.other.namespace-alias.vbnet'
},
'integer-literal': {
match: '(?i)(&H[0-9A-F]+|&O[0-7]+|&B[0-1]+|[0-9]+)(S|I|L|US|UI|UL|%|!)?',
name: 'string.quoted.double.vbnet'
},
'keyword-a': {
match:
'(?i)(?<![.!])(AddHandler|AddressOf|Aggregate|Alias|And|AndAlso|Ansi|As|Ascending|Assembly|Async(?=\\s+(Sub|Function))|Auto|Await)\\b',
name: 'keyword.other.vbnet'
},
'keyword-b': {
match:
'(?i)(?<![.!])((?<=Compare)\\s+Binary|Boolean|ByRef|Byte|ByVal)\\b',
name: 'keyword.other.vbnet'
},
'keyword-c': {
match:
'(?i)(?<![.!])(Call|Case|Catch|CBool|CByte|CChar|CDate|CDbl|CDec|Char|CInt|Class|CLng|CObj|(?<=Option\\s)Compare|Const|Continue|CShort|CSng|CStr|CType|Custom(?=\\s+Event))\\b',
name: 'keyword.other.vbnet'
},
'keyword-d': {
match:
'(?i)(?<![.!])(Date|Decimal|Declare|Default|Delegate|Descending|Dim|DirectCast|Distinct|Do|Double)\\b',
name: 'keyword.other.vbnet'
},
'keyword-e': {
match:
'(?i)(?<![.!])(Each|Else|ElseIf|End|EndIf|Enum|Equals|Erase|Error|Event|Exit|(?<=Option)\\s+Explicit)\\b',
name: 'keyword.other.vbnet'
},
'keyword-f': {
match:
'(?i)(?<![.!])(False|Finally|For|Friend|From(?=\\s+{)|From|Function)\\b',
name: 'keyword.other.vbnet'
},
'keyword-g': {
match:
'(?i)(?<![.!])(Get|GetType|Global|GoSub|GoTo|Group\\s+By|Group)\\b',
name: 'keyword.other.vbnet'
},
'keyword-h': {
match: '(?i)(?<![.!])(Handles)\\b',
name: 'keyword.other.vbnet'
},
'keyword-i': {
match:
'(?i)(?<![.!])(If|Implements|Imports|In|(?<=Option)\\s+Infer|Inherits|Integer|Interface|Into|Is|IsNot|Iterator(?=\\s+(Function|Property)))\\b',
name: 'keyword.other.vbnet'
},
'keyword-j': {match: '(?i)(?<![.!])(Join)\\b', name: 'keyword.other.vbnet'},
'keyword-k': {match: '(?i)(?<![.!])(Key)\\b', name: 'keyword.other.vbnet'},
'keyword-l': {
match: '(?i)(?<![.!])(Let|Lib|Like|Long|Loop)\\b',
name: 'keyword.other.vbnet'
},
'keyword-m': {
match:
'(?i)(?<![.!])(Me|Mod|Module|MustInherit|MustOverride|MyBase|MyClass)\\b',
name: 'keyword.other.vbnet'
},
'keyword-n': {
match:
'(?i)(?<![.!])(NameOf|Namespace|Narrowing|New|Next|Not|Nothing|NotInheritable|NotOverridable)\\b',
name: 'keyword.other.vbnet'
},
'keyword-o': {
match:
'(?i)(?<![.!])(Object|Of|(?<=Explicit|Infer|Strict)\\s+Off|On|Operator|Option|Optional|Or|Order\\s+By|OrElse|Out|Overloads|Overridable|Overrides)\\b',
name: 'keyword.other.vbnet'
},
'keyword-p': {
match:
'(?i)(?<![.!])(ParamArray|Partial(?=\\s+(Class|Structure|Module|Interface))|Partial(?=\\s+(Class|Structure|Module|Interface|Sub|Public|Private|Protected|Friend|MustInherit|NotInheritable|NotOverrideable|Overridable|Shared))|Preserve|Private|Property|Protected|Public)\\b',
name: 'keyword.other.vbnet'
},
'keyword-r': {
match:
'(?i)(?<![.!])(RaiseEvent|ReadOnly|ReDim|(?<=#|#End\\s)Region|RemoveHandler|Resume|Return)\\b',
name: 'keyword.other.vbnet'
},
'keyword-s': {
match:
'(?i)(?<![.!])(Select|Set|Shadows|Shared|Short|Single|Skip|Static|Step|Stop|(?<=Option)\\s+Strict|String|Structure|Sub|SyncLock)\\b',
name: 'keyword.other.vbnet'
},
'keyword-t': {
match:
'(?i)(?<![.!])(Take|(?<=Compare)\\s+Text|Then|Throw|To|True|Try|TryCast|TypeOf)\\b',
name: 'keyword.other.vbnet'
},
'keyword-u': {
match: '(?i)(?<![.!])(Unicode|Until|Using)\\b',
name: 'keyword.other.vbnet'
},
'keyword-v': {
match: '(?i)(?<![.!])(Variant)\\b',
name: 'keyword.other.vbnet'
},
'keyword-w': {
match:
'(?i)(?<![.!])(Wend|When|Where|While|Widening|With|WithEvents|WriteOnly)\\b',
name: 'keyword.other.vbnet'
},
'keyword-x': {match: '(?i)(?<![.!])(Xor)\\b', name: 'keyword.other.vbnet'},
'keyword-y': {
match: '(?i)(?<![.!])(Yield)\\b',
name: 'keyword.other.vbnet'
},
'string-literal': {
match:
'(["\\x{201C}\\x{201D}]([^"\\x{201C}\\x{201D}]|["\\x{201C}\\x{201D}]{2})*["\\x{201C}\\x{201D}])',
name: 'string.quoted.double.vbnet'
},
symbol: {
match: '(([&*+\\-/\\\\^<=>])|([(){}!#,.:]|((?<= )_(?=\\s$)))|\\?)',
name: 'variable.other.namespace-alias.vbnet'
}
},
scopeName: 'source.vbnet'
}
export default grammar