@@ -17,11 +17,11 @@ first_line_match: |-
17
17
)
18
18
19
19
variables :
20
- dec_digits : (?:[\d_]*\d )
21
- dec_exponent : (?:[eE][-+]?{{dec_digits}})
22
- float_suffix : (?i:[fdm](?!b))
23
- integer_suffix : (?i:ul?|lu?)
24
- bytes_unit : (?i:[kmgtp]b)
20
+ dec_exponent : (?:[eE][-+]?\d* )
21
+ dec_suffix : ' [dDlL] '
22
+ double_suffix : ' [dD] '
23
+ long_suffix : ' [lL] '
24
+ unit_suffix : (?i:[kmgtp]b)
25
25
kebab_break : (?![\w-])
26
26
27
27
contexts :
@@ -548,48 +548,56 @@ contexts:
548
548
pop : true
549
549
550
550
numeric-constant :
551
- - match : \b((0[xX])[\h_]*\h({{integer_suffix}})?)({{bytes_unit}})?\b
552
- captures :
553
- 1 : constant.numeric.integer.hexadecimal.powershell
554
- 2 : punctuation.definition.numeric.base.powershell
555
- 3 : storage.type.numeric.powershell
556
- 4 : keyword.other.unit.powershell
557
- - match : \b((0[bB])[01_]*[01]({{integer_suffix}})?)({{bytes_unit}})?\b
558
- captures :
559
- 1 : constant.numeric.integer.binary.powershell
560
- 2 : punctuation.definition.numeric.base.powershell
561
- 3 : storage.type.numeric.powershell
562
- 4 : keyword.other.unit.powershell
551
+ - match : \b(0[bB])([01]*)({{long_suffix}}?{{unit_suffix}}?)\b
552
+ scope : meta.number.integer.binary.powershell
553
+ captures :
554
+ 1 : constant.numeric.base.powershell
555
+ 2 : constant.numeric.value.powershell
556
+ 3 : constant.numeric.suffix.powershell
557
+ push : members
558
+ - match : \b(0[xX])(\h*)({{long_suffix}}?{{unit_suffix}}?)\b
559
+ scope : meta.number.integer.hexadecimal.powershell
560
+ captures :
561
+ 1 : constant.numeric.base.powershell
562
+ 2 : constant.numeric.value.powershell
563
+ 3 : constant.numeric.suffix.powershell
564
+ push : members
563
565
- match : |-
564
- (?x:
565
- (
566
- \b{{dec_digits}}
567
- (?:
568
- (?:
569
- (?:(\.(?!\.))\d*) # No `_` after the `.`
570
- {{dec_exponent}}?
571
- | {{dec_exponent}}
572
- )
573
- ({{float_suffix}})?
574
- | ({{float_suffix}})
575
- )
576
- | \b{{dec_digits}}\.(?!\.)
577
- | (\.)\d+
578
- )
579
- ({{bytes_unit}}\b)?
566
+ (?x)
567
+ (
568
+ # .10 .10e5
569
+ (\.)\d+{{dec_exponent}}?
570
+ # 1.2 1.2e-3 1.e2 1e2
571
+ | \d+ (?: (\.) \d+ {{dec_exponent}}? | (\.)? {{dec_exponent}} )
580
572
)
581
- captures:
582
- 1: constant.numeric.float.decimal.powershell
573
+ ( {{dec_suffix}}? {{unit_suffix}}? )\b
574
+ |
575
+ # 10.l 10.lGB 10.GB
576
+ ( \d+ (\.) )
577
+ ( {{dec_suffix}} {{unit_suffix}}? | {{unit_suffix}} )\b
578
+ scope: meta.number.float.decimal.powershell
579
+ captures:
580
+ 1: constant.numeric.value.powershell
583
581
2: punctuation.separator.decimal.powershell
584
- 3: storage.type.numeric.powershell
585
- 4: storage.type.numeric.powershell
586
- 5: punctuation.separator.decimal.powershell
587
- 6: keyword.other.unit.powershell
588
- - match : \b((?:0|[1-9]{{dec_digits}}?)({{integer_suffix}})?)({{bytes_unit}})?\b
589
- captures :
590
- 1 : constant.numeric.integer.decimal.powershell
591
- 2 : storage.type.numeric.powershell
592
- 3 : keyword.other.unit.powershell
582
+ 3: punctuation.separator.decimal.powershell
583
+ 4: punctuation.separator.decimal.powershell
584
+ 5: constant.numeric.suffix.powershell
585
+ 6: constant.numeric.value.powershell
586
+ 7: punctuation.separator.decimal.powershell
587
+ 8: constant.numeric.suffix.powershell
588
+ push: members
589
+ - match : \b(\d+)({{double_suffix}}{{unit_suffix}}?)\b
590
+ scope : meta.number.float.decimal.powershell
591
+ captures :
592
+ 1 : constant.numeric.value.powershell
593
+ 2 : constant.numeric.suffix.powershell
594
+ push : members
595
+ - match : \b(\d+)({{long_suffix}}?{{unit_suffix}}?)\b
596
+ scope : meta.number.integer.decimal.powershell
597
+ captures :
598
+ 1 : constant.numeric.value.powershell
599
+ 2 : constant.numeric.suffix.powershell
600
+ push : members
593
601
594
602
script-block :
595
603
- match : (%)?(\{)
0 commit comments