Skip to content

Commit e847299

Browse files
author
Lukas Neubert
committed
syntax: hitghlight types and As
fix #10, fix #11
1 parent 495de61 commit e847299

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

syntaxes/tests/main.bas

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
' SYNTAX TEST "source.vba" "main syntax test"
22

33
Attribute VB_Name = "SyntaxTest"
4-
' ^^^^^^^^^ keyword.attribute
4+
' ^^^^^^^^^ keyword.Attribute.vba
55

6-
Public Const FOO As Int = 1
6+
Public Const FOO As Integer = 1
77
' ^^^^^^ storage.modifier.visibility
8+
' ^^ keyword.As.vba
9+
' ^^^^^^^ support.type.Integer
810

911
' some comment
10-
' ^^^^^^^^^^^^^^ comment.line
12+
' ^^^^^^^^^^^^^^ comment.line.quote
1113

1214
Private Sub doStuff()
1315
' ^^^^^^^ storage.modifier.visibility
14-
' ^^^ keyword.procedure
16+
' ^^^ keyword.Sub.vba
1517
End Sub
16-
' ^^^ keyword.other
17-
' ^^^ keyword.procedure
18+
' ^^^ keyword.End.vba
19+
' ^^^ keyword.Sub.vba
1820

19-
Function foobar()
20-
' ^^^^^^^^ keyword.procedure
21+
Function foobar() As Boolean
22+
' ^^^^^^^^ keyword.Function.vba
23+
' ^^ keyword.As.vba
24+
' ^^^^^^^ support.type.Boolean
2125
End Function
22-
' ^^^ keyword.other
23-
' ^^^^^^^^ keyword.procedure
26+
' ^^^ keyword.End.vba
27+
' ^^^^^^^^ keyword.Function.vba

syntaxes/vba.tmLanguage.json

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,33 @@
77
],
88
"patterns": [
99
{ "include": "#comments" },
10-
{ "include": "#visibility" },
10+
{ "include": "#keywords" },
1111
{ "include": "#option" },
12-
{ "include": "#keywords" }
12+
{ "include": "#types" },
13+
{ "include": "#visibility" }
1314
],
1415
"repository": {
1516
"comments": {
16-
"name": "comment.line",
17+
"name": "comment.line.quote",
1718
"begin": "'",
1819
"end": "$"
1920
},
2021
"keywords": {
2122
"patterns": [
2223
{
23-
"name": "keyword.attribute",
24-
"match": "\\b(Attribute)\\b"
25-
},
26-
{
27-
"name": "keyword.procedure",
28-
"match": "\\b(Function|Sub)\\b"
29-
},
30-
{
31-
"name": "keyword.other",
32-
"match": "\\b(End)\\b"
24+
"name": "keyword.$1.vba",
25+
"match": "\\b(As|Attribute|Function|Sub|End)\\b"
3326
}
3427
]
3528
},
3629
"option": {
3730
"name": "storage.modifier.option",
3831
"match": "\\b(Option (Explicit|Private Module|Base|(Compare (Binary|Text)+))?)\\b"
3932
},
33+
"types": {
34+
"name": "support.type.$1",
35+
"match": "\\b(Boolean|Byte|Char|Date|Decimal|Double|Integer|Long|Object|SByte|Short|Single|String|UInteger|ULong|UShort)\\b"
36+
},
4037
"visibility": {
4138
"name": "storage.modifier.visibility",
4239
"match": "\\b(Public|Private)\\b"

0 commit comments

Comments
 (0)