Skip to content

Commit 9dd72ff

Browse files
committed
syntax: highlight binary numbers
- fix underscores in hex and oct
1 parent 745b1a1 commit 9dd72ff

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

syntaxes/tests/numbers.bas

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,20 @@ Dim hex As Long
1111
hex = &H98FA2
1212
' ^^^^^^^ constant.numeric.hexadecimal
1313

14+
hex = &h98_FA2
15+
' ^^^^^^^^ constant.numeric.hexadecimal
16+
1417
Dim oct As Long
1518
oct = &O75
1619
' ^^^^ constant.numeric.octal
20+
oct = &o23_22
21+
' ^^^^^^ constant.numeric.octal
22+
23+
Dim bin As Long
24+
bin = &B0011
25+
' ^^^^^^ constant.numeric.binary
26+
bin = &b1000_0101
27+
' ^^^^^^^^^^^ constant.numeric.binary
1728

1829
Dim dub As Double
1930
' ^^^^^^ support.type.Double

syntaxes/vba.tmLanguage.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@
4444
"patterns": [
4545
{
4646
"name": "constant.numeric.hexadecimal",
47-
"match": "(?i)&H[0-9A-F]+"
47+
"match": "(?i)&H([0-9A-F]+[_]?)+"
4848
},
4949
{
5050
"name": "constant.numeric.octal",
51-
"match": "(?i)&O[0-7]+"
51+
"match": "(?i)&O([0-7]+[_]?)+"
52+
},
53+
{
54+
"name": "constant.numeric.binary",
55+
"match": "(?i)&B([0-1]+[_]?)+"
5256
},
5357
{
5458
"name": "constant.numeric.decimal",

0 commit comments

Comments
 (0)