Skip to content

Commit 745b1a1

Browse files
authored
syntax: highlight hexadecimal and octal numbers (#33)
* Highlight hexadecimal and octal numbers * Syntaxes test: hexadecimal and octal numbers
1 parent 222bedc commit 745b1a1

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

syntaxes/tests/numbers.bas

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ dec = 2.375D
77
dec = 4.000
88
' ^^^^^ constant.numeric.decimal
99

10+
Dim hex As Long
11+
hex = &H98FA2
12+
' ^^^^^^^ constant.numeric.hexadecimal
13+
14+
Dim oct As Long
15+
oct = &O75
16+
' ^^^^ constant.numeric.octal
17+
1018
Dim dub As Double
1119
' ^^^^^^ support.type.Double
1220
dub = 4.0R

syntaxes/vba.tmLanguage.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,21 @@
4242
},
4343
"numbers": {
4444
"patterns": [
45+
{
46+
"name": "constant.numeric.hexadecimal",
47+
"match": "(?i)&H[0-9A-F]+"
48+
},
49+
{
50+
"name": "constant.numeric.octal",
51+
"match": "(?i)&O[0-7]+"
52+
},
4553
{
4654
"name": "constant.numeric.decimal",
47-
"match": "([0-9]+)(\\.)([0-9]+)(D|R|F)?"
55+
"match": "[0-9]+\\.[0-9]+(D|R|F)?"
4856
},
4957
{
5058
"name": "constant.numeric.integer",
51-
"match": "(([0-9]+)([_]?))+(ui|UI|ul|UL|us|US)?"
59+
"match": "(?i)([0-9]+[_]?)+(UI|UL|US)?"
5260
}
5361
]
5462
},

0 commit comments

Comments
 (0)