Skip to content

Commit decd4b1

Browse files
committed
capture numerics
1 parent 8d46342 commit decd4b1

File tree

1 file changed

+89
-15
lines changed

1 file changed

+89
-15
lines changed

PowerShellSyntax.tmLanguage

Lines changed: 89 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -647,57 +647,132 @@
647647
<key>1</key>
648648
<dict>
649649
<key>name</key>
650-
<string>keyword.operator.math.powershell</string>
650+
<string>constant.numeric.hexadecimal.powershell</string>
651651
</dict>
652652
<key>2</key>
653653
<dict>
654654
<key>name</key>
655-
<string>support.constant.powershell</string>
655+
<string>keyword.other.powershell</string>
656656
</dict>
657-
<key>3</key>
657+
</dict>
658+
<key>match</key>
659+
<string>\b(0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b</string>
660+
<key>name</key>
661+
<string>constant.numeric.hexadecimal.powershell</string>
662+
</dict>
663+
<dict>
664+
<key>captures</key>
665+
<dict>
666+
<key>1</key>
667+
<dict>
668+
<key>name</key>
669+
<string>constant.numeric.scientific.powershell</string>
670+
</dict>
671+
<key>2</key>
658672
<dict>
659673
<key>name</key>
660674
<string>keyword.other.powershell</string>
661675
</dict>
662676
</dict>
663677
<key>match</key>
664-
<string>(?&lt;!\w)(?i:(0x)([a-f0-9]+)((?i:L)?(?i:[kmgtp]b)?))(?!\w)</string>
678+
<string>\b((?:[0-9_]+)?\.[0-9_]+(?:(?:e|E)[0-9]+)?(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b</string>
665679
<key>name</key>
666-
<string>constant.numeric.hexadecimal.powershell</string>
680+
<string>constant.numeric.scientific.powershell</string>
667681
</dict>
668682
<dict>
669683
<key>captures</key>
670684
<dict>
671685
<key>1</key>
672686
<dict>
673687
<key>name</key>
674-
<string>support.constant.powershell</string>
688+
<string>constant.numeric.binary.powershell</string>
675689
</dict>
676690
<key>2</key>
677691
<dict>
678692
<key>name</key>
679-
<string>keyword.operator.math.powershell</string>
693+
<string>keyword.other.powershell</string>
680694
</dict>
681-
<key>3</key>
695+
</dict>
696+
<key>match</key>
697+
<string>\b(0(?:b|B)[01_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b</string>
698+
<key>name</key>
699+
<string>constant.numeric.binary.powershell</string>
700+
</dict>
701+
<dict>
702+
<key>captures</key>
703+
<dict>
704+
<key>1</key>
682705
<dict>
683706
<key>name</key>
684-
<string>support.constant.powershell</string>
707+
<string>constant.numeric.decimal.powershell</string>
685708
</dict>
686-
<key>4</key>
709+
<key>2</key>
687710
<dict>
688711
<key>name</key>
689712
<string>keyword.other.powershell</string>
690713
</dict>
691-
<key>5</key>
714+
</dict>
715+
<key>match</key>
716+
<string>\b([0-9_]+(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b</string>
717+
<key>name</key>
718+
<string>constant.numeric.decimal.powershell</string>
719+
</dict>
720+
<dict>
721+
<key>captures</key>
722+
<dict>
723+
<key>1</key>
724+
<dict>
725+
<key>name</key>
726+
<string>constant.numeric.decimal.powershell</string>
727+
</dict>
728+
<key>2</key>
692729
<dict>
693730
<key>name</key>
694731
<string>keyword.other.powershell</string>
695732
</dict>
696733
</dict>
697734
<key>match</key>
698-
<string>(?&lt;!\w)(?i:(\d*\.?\d+)(?:((?i:E)[+-]?)(\d+))?((?i:[DL])?)((?i:[kmgtp]b)?))(?!\w)</string>
735+
<string>\b([0-9_]+\.(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b</string>
699736
<key>name</key>
700-
<string>constant.numeric.scientific.powershell</string>
737+
<string>constant.numeric.decimal.powershell</string>
738+
</dict>
739+
<dict>
740+
<key>captures</key>
741+
<dict>
742+
<key>1</key>
743+
<dict>
744+
<key>name</key>
745+
<string>constant.numeric.decimal.powershell</string>
746+
</dict>
747+
<key>2</key>
748+
<dict>
749+
<key>name</key>
750+
<string>keyword.other.powershell</string>
751+
</dict>
752+
</dict>
753+
<key>match</key>
754+
<string>\b([0-9_]+[\.]?(?:F|f|D|d|M|m))((?i:[kmgtp]b)?)\b</string>
755+
<key>name</key>
756+
<string>constant.numeric.decimal.powershell</string>
757+
</dict>
758+
<dict>
759+
<key>captures</key>
760+
<dict>
761+
<key>1</key>
762+
<dict>
763+
<key>name</key>
764+
<string>constant.numeric.decimal.powershell</string>
765+
</dict>
766+
<key>2</key>
767+
<dict>
768+
<key>name</key>
769+
<string>keyword.other.powershell</string>
770+
</dict>
771+
</dict>
772+
<key>match</key>
773+
<string>\b([0-9_]+[\.]?(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b</string>
774+
<key>name</key>
775+
<string>constant.numeric.decimal.powershell</string>
701776
</dict>
702777
</array>
703778
</dict>
@@ -1191,5 +1266,4 @@
11911266
<key>uuid</key>
11921267
<string>f8f5ffb0-503e-11df-9879-0800200c9a66</string>
11931268
</dict>
1194-
</plist>
1195-
1269+
</plist>

0 commit comments

Comments
 (0)