Skip to content

Commit b1d22be

Browse files
committed
optimizations to numerics
1 parent 61bb5fa commit b1d22be

File tree

1 file changed

+15
-25
lines changed

1 file changed

+15
-25
lines changed

PowerShellSyntax.tmLanguage

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3816,18 +3816,18 @@
38163816
<key>unicodeEscape</key>
38173817
<dict>
38183818
<key>comment</key>
3819-
<string>`u{xxxx} added in PowerShell 6.0</string>
3819+
<string>`u{x} added in PowerShell 6.0 (x=1-6 hex digits, value ranging 0-10FFFF)</string>
38203820
<key>patterns</key>
38213821
<array>
38223822
<dict>
38233823
<key>match</key>
3824-
<string>`u\{(?:(?:10)?([0-9a-fA-F]){1,4}|0?\g&lt;1&gt;{1,5})}</string>
3824+
<string>`u\{(?:(?:10)\h{1,4}|0?\h{1,5})}</string>
38253825
<key>name</key>
38263826
<string>constant.character.escape.powershell</string>
38273827
</dict>
38283828
<dict>
38293829
<key>match</key>
3830-
<string>`u(?:\{[0-9a-fA-F]{,6}.)?</string>
3830+
<string>`u(?:\{\h{,6}.)?</string>
38313831
<key>name</key>
38323832
<string>invalid.character.escape.powershell</string>
38333833
</dict>
@@ -4441,24 +4441,19 @@
44414441
<key>name</key>
44424442
<string>constant.numeric.integer.powershell</string>
44434443
</dict>
4444-
<key>2</key>
4444+
<key>3</key>
44454445
<dict>
44464446
<key>name</key>
44474447
<string>storage.modifier.long.powershell</string>
44484448
</dict>
44494449
<key>4</key>
4450-
<dict>
4451-
<key>name</key>
4452-
<string>storage.modifier.long.powershell</string>
4453-
</dict>
4454-
<key>5</key>
44554450
<dict>
44564451
<key>name</key>
44574452
<string>constant.language.powershell</string>
44584453
</dict>
44594454
</dict>
44604455
<key>begin</key>
4461-
<string>(?&gt;([+\x{2013}-\x{2015}-]?(?:[0-9]+(?i:(?![ed]|\.(?!\.))(l)?|(?:\.[0-9]*)?((?:(?i:e)[+\x{2013}-\x{2015}-]?[0-9]+)?(l)))|(?:\.[0-9]+)\g&lt;3&gt;))((?i:[kmgtp]b)?))(?=[\s{(,;&amp;|)}#\]&lt;&gt;.!+%*/=\x{2013}-\x{2015}-])</string>
4456+
<string>([+\x{2013}-\x{2015}-]?(?:\d+(?i:(?:\.\d*)?((?:e[+\x{2013}-\x{2015}-]?\d+)?(l))|(?!\.(?!\.)))|(?:\.\d+)\g&lt;2&gt;))((?i:[kmgtp]b))?(?=[\s{(,;&amp;|)}#\]&lt;&gt;.!+%*/=\x{2013}-\x{2015}-])</string>
44624457
<key>end</key>
44634458
<string>(?=.|$)</string>
44644459
<key>applyEndPatternLast</key>
@@ -4491,7 +4486,7 @@
44914486
</dict>
44924487
</dict>
44934488
<key>begin</key>
4494-
<string>(?&gt;([+\x{2013}-\x{2015}-]?0(?i:x[0-9a-f_]+(l)?))((?i:[kmgtp]b)?))(?=[\s{(,;&amp;|)}#\]&lt;&gt;.!+%*/=\x{2013}-\x{2015}-])</string>
4489+
<string>([+\x{2013}-\x{2015}-]?0(?i:x\h+(l)?))((?i:[kmgtp]b))?(?=[\s{(,;&amp;|)}#\]&lt;&gt;.!+%*/=\x{2013}-\x{2015}-])</string>
44954490
<key>end</key>
44964491
<string>(?=.|$)</string>
44974492
<key>applyEndPatternLast</key>
@@ -4517,14 +4512,14 @@
45174512
<key>name</key>
45184513
<string>storage.modifier.decimal.powershell</string>
45194514
</dict>
4520-
<key>3</key>
4515+
<key>5</key>
45214516
<dict>
45224517
<key>name</key>
45234518
<string>constant.language.powershell</string>
45244519
</dict>
45254520
</dict>
45264521
<key>begin</key>
4527-
<string>(?&gt;([+\x{2013}-\x{2015}-]?(?:(?:[0-9]+)|(?=\.[0-9]))(?:\.[0-9]*)?(?i:(?:e[+\x{2013}-\x{2015}-]?[0-9]+)?(?!l)(d)?))((?i:[kmgtp]b)?))(?=[\s{(,;&amp;|)}#\]&lt;&gt;.!+%*/=\x{2013}-\x{2015}-])</string>
4522+
<string>([+\x{2013}-\x{2015}-]?(?i:\d+(?:(?:(d)|(?:(e[+\x{2013}-\x{2015}-]?\d+)\g&lt;2&gt;?))|\.\d*(\g&lt;3&gt;?\g&lt;2&gt;?))|\.\d+\g&lt;4&gt;))((?i:[kmgtp]b))?(?=[\s{(,;&amp;|)}#\]&lt;&gt;.!+%*/=\x{2013}-\x{2015}-])</string>
45284523
<key>end</key>
45294524
<string>(?=.|$)</string>
45304525
<key>applyEndPatternLast</key>
@@ -4552,7 +4547,7 @@
45524547
</dict>
45534548
</dict>
45544549
<key>comment</key>
4555-
<string>(?&gt;(?:(?&lt;!\w)|\G)([+\x{2013}-\x{2015}-]?0(?i:b[01_]+l?))((?i:[kmgtp]b)?))(?=[\s{(,;&amp;|)}#\]&lt;&gt;.!+%*/=\x{2013}-\x{2015}-])</string>
4550+
<string>([+\x{2013}-\x{2015}-]?0(?i:b[01_]+l?))((?i:[kmgtp]b))?(?=[\s{(,;&amp;|)}#\]&lt;&gt;.!+%*/=\x{2013}-\x{2015}-])</string>
45564551
</dict>
45574552
</array>
45584553
<key>repository</key>
@@ -4624,24 +4619,19 @@
46244619
<key>name</key>
46254620
<string>constant.numeric.integer.powershell</string>
46264621
</dict>
4627-
<key>2</key>
4622+
<key>3</key>
46284623
<dict>
46294624
<key>name</key>
46304625
<string>storage.modifier.long.powershell</string>
46314626
</dict>
46324627
<key>4</key>
4633-
<dict>
4634-
<key>name</key>
4635-
<string>storage.modifier.long.powershell</string>
4636-
</dict>
4637-
<key>5</key>
46384628
<dict>
46394629
<key>name</key>
46404630
<string>constant.language.powershell</string>
46414631
</dict>
46424632
</dict>
46434633
<key>match</key>
4644-
<string>(?&gt;((?:[0-9]+(?i:(?![ed]|\.(?!\.))(l)?|(?:\.[0-9]*)?((?:(?i:e)[+\x{2013}-\x{2015}-]?[0-9]+)?(l)))|(?:\.[0-9]+)\g&lt;2&gt;)))((?i:[kmgtp]b)?)(?=[\s{(,;&amp;|)}])</string>
4634+
<string>((?:\d+(?i:(?:\.\d*)?((?:e[+\x{2013}-\x{2015}-]?\d+)?(l))|(?!\.(?!\.)))|(?:\.\d+)\g&lt;2&gt;))((?i:[kmgtp]b))?(?=[\s{(,;&amp;|)}])</string>
46454635
</dict>
46464636
<dict>
46474637
<key>captures</key>
@@ -4663,7 +4653,7 @@
46634653
</dict>
46644654
</dict>
46654655
<key>match</key>
4666-
<string>(?&gt;(0(?i:x[0-9a-f_]+(l)?))((?i:[kmgtp]b)?))(?=[\s{(,;&amp;|)}])</string>
4656+
<string>(0(?i:x\h+(l)?))((?i:[kmgtp]b))?(?=[\s{(,;&amp;|)}])</string>
46674657
</dict>
46684658
<dict>
46694659
<key>captures</key>
@@ -4678,14 +4668,14 @@
46784668
<key>name</key>
46794669
<string>storage.modifier.decimal.powershell</string>
46804670
</dict>
4681-
<key>3</key>
4671+
<key>5</key>
46824672
<dict>
46834673
<key>name</key>
46844674
<string>constant.language.powershell</string>
46854675
</dict>
46864676
</dict>
46874677
<key>match</key>
4688-
<string>(?&gt;((?:(?:[0-9]+)|(?=\.[0-9]))(?:\.[0-9]*)?(?i:(?:e[+\x{2013}-\x{2015}-]?[0-9]+)?(?!l)(d)?))((?i:[kmgtp]b)?))(?=[\s{(,;&amp;|)}])</string>
4678+
<string>((?i:\d+(?:(?:(d)|(?:(e[+\x{2013}-\x{2015}-]?\d+)\g&lt;2&gt;?))|\.\d*(\g&lt;3&gt;?\g&lt;2&gt;?))|\.\d+\g&lt;4&gt;))((?i:[kmgtp]b))?(?=[\s{(,;&amp;|)}])</string>
46894679
</dict>
46904680
<dict>
46914681
<key>captures</key>
@@ -4702,7 +4692,7 @@
47024692
</dict>
47034693
</dict>
47044694
<key>comment</key>
4705-
<string>(?&gt;(?:(?&lt;!\w)|\G)([+\x{2013}-\x{2015}-]?0(?i:b[01_]+l?))((?i:[kmgtp]b)?))(?=[\s{(,;&amp;|)}])</string>
4695+
<string>(0(?i:b[01_]+l?))((?i:[kmgtp]b))?(?=[\s{(,;&amp;|)}])</string>
47064696
</dict>
47074697
</array>
47084698
</dict>

0 commit comments

Comments
 (0)