Skip to content

Commit 55cf3d4

Browse files
author
Lukas Neubert
committed
syntax: highlight numbers
fix #12
1 parent e847299 commit 55cf3d4

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

syntaxes/tests/numbers.bas

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
' SYNTAX TEST "source.vba" "numbers"
2+
3+
Dim dec As Decimal
4+
dec = 2.375D
5+
' ^^^^^^ constant.numeric.decimal
6+
dec = 4.000
7+
' ^^^^^ constant.numeric.decimal
8+
9+
Dim doub As Double
10+
doub= 4.0R
11+
' ^^^^ constant.numeric.decimal
12+
13+
Dim sing As Single
14+
sing = 4.2F
15+
' ^^^^ constant.numeric.decimal
16+
17+
Dim i As Integer
18+
i = 123
19+
' ^^^ constant.numeric.integer
20+
i = 1_000_000
21+
' ^^^^^^^^^ constant.numeric.integer

syntaxes/vba.tmLanguage.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"patterns": [
99
{ "include": "#comments" },
1010
{ "include": "#keywords" },
11+
{ "include": "#numbers" },
1112
{ "include": "#option" },
1213
{ "include": "#types" },
1314
{ "include": "#visibility" }
@@ -26,6 +27,18 @@
2627
}
2728
]
2829
},
30+
"numbers": {
31+
"patterns": [
32+
{
33+
"name": "constant.numeric.decimal",
34+
"match": "([0-9]+)(\\.)([0-9]+)(D|R|F)?"
35+
},
36+
{
37+
"name": "constant.numeric.integer",
38+
"match": "(([0-9]+)([_]?))+"
39+
}
40+
]
41+
},
2942
"option": {
3043
"name": "storage.modifier.option",
3144
"match": "\\b(Option (Explicit|Private Module|Base|(Compare (Binary|Text)+))?)\\b"

0 commit comments

Comments
 (0)