Skip to content

Commit ea384f4

Browse files
author
deathaxe
committed
(Re-)add PowerShell 6+ number suffixes
Also fix incomplete units causing whole number to not be highlighted.
1 parent bd286e7 commit ea384f4

File tree

2 files changed

+228
-109
lines changed

2 files changed

+228
-109
lines changed

PowerShell.sublime-syntax

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ first_line_match: |-
1818
1919
variables:
2020
dec_exponent: (?:[eE][-+]?\d*)
21-
dec_suffix: '[dDlL]'
22-
double_suffix: '[dD]'
23-
long_suffix: '[lL]'
24-
unit_suffix: (?i:[kmgtp]b)
21+
dec_suffix: '[dD]'
22+
float_suffix: '[dDlL]'
23+
int_suffix: (?i:u[lsy]?|[lnsy])
24+
unit_suffix: (?i:[kmgtp]b\b)
2525
kebab_break: (?![\w-])
2626

2727
contexts:
@@ -548,14 +548,14 @@ contexts:
548548
pop: true
549549

550550
numeric-constant:
551-
- match: \b(0[bB])([01]*)({{long_suffix}}?{{unit_suffix}}?)\b
551+
- match: \b(0[bB])([01]*)({{int_suffix}}?{{unit_suffix}}?)
552552
scope: meta.number.integer.binary.powershell
553553
captures:
554554
1: constant.numeric.base.powershell
555555
2: constant.numeric.value.powershell
556556
3: constant.numeric.suffix.powershell
557557
push: members
558-
- match: \b(0[xX])(\h*)({{long_suffix}}?{{unit_suffix}}?)\b
558+
- match: \b(0[xX])(\h*)({{int_suffix}}?{{unit_suffix}}?)
559559
scope: meta.number.integer.hexadecimal.powershell
560560
captures:
561561
1: constant.numeric.base.powershell
@@ -570,11 +570,11 @@ contexts:
570570
# 1.2 1.2e-3 1.e2 1e2
571571
| \d+ (?: (\.) \d+ {{dec_exponent}}? | (\.)? {{dec_exponent}} )
572572
)
573-
( {{dec_suffix}}? {{unit_suffix}}? )\b
573+
( {{float_suffix}}? {{unit_suffix}}? )
574574
|
575575
# 10.l 10.lGB 10.GB
576576
( \d+ (\.) )
577-
( {{dec_suffix}} {{unit_suffix}}? | {{unit_suffix}} )\b
577+
( {{float_suffix}} {{unit_suffix}}? | {{unit_suffix}} )
578578
scope: meta.number.float.decimal.powershell
579579
captures:
580580
1: constant.numeric.value.powershell
@@ -586,13 +586,13 @@ contexts:
586586
7: punctuation.separator.decimal.powershell
587587
8: constant.numeric.suffix.powershell
588588
push: members
589-
- match: \b(\d+)({{double_suffix}}{{unit_suffix}}?)\b
589+
- match: \b(\d+)({{dec_suffix}}{{unit_suffix}}?)
590590
scope: meta.number.float.decimal.powershell
591591
captures:
592592
1: constant.numeric.value.powershell
593593
2: constant.numeric.suffix.powershell
594594
push: members
595-
- match: \b(\d+)({{long_suffix}}?{{unit_suffix}}?)\b
595+
- match: \b(\d+)({{int_suffix}}?{{unit_suffix}}?)
596596
scope: meta.number.integer.decimal.powershell
597597
captures:
598598
1: constant.numeric.value.powershell

0 commit comments

Comments
 (0)