Skip to content

Commit c5baa7a

Browse files
committed
Add null-aware operators and accessors
1 parent 881aae7 commit c5baa7a

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

PowerShell.sublime-syntax

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,22 +527,29 @@ contexts:
527527
members:
528528
- match: (?=\.\.)
529529
pop: 1
530-
- match: \.(?=\w)
530+
- match: \?\.(?={{identifier_simple}})
531+
scope: punctuation.accessor.null-coalescing.powershell
532+
- match: \??\.(?={{identifier_simple}})
531533
scope: punctuation.accessor.dot.powershell
532-
- match: ::(?=\w)
534+
- match: ::(?={{identifier_simple}})
533535
scope: punctuation.accessor.double-colon.powershell
534536
- match: (new)(\()
535537
captures:
536538
1: meta.function-call.powershell support.function.constructor.powershell
537539
2: meta.function-call.arguments.powershell punctuation.section.arguments.begin.powershell
538540
push: inside-function-call-arguments
539-
- match: (\w+)(\()
541+
- match: ({{identifier_simple}})(\()
540542
captures:
541543
1: meta.function-call.powershell variable.function.powershell
542544
2: meta.function-call.arguments.powershell punctuation.section.arguments.begin.powershell
543545
push: inside-function-call-arguments
544-
- match: \w+
546+
- match: '{{identifier_simple}}'
545547
scope: variable.other.member.powershell
548+
- match: (\?)(\[)
549+
captures:
550+
1: punctuation.accessor.null-coalescing.powershell
551+
2: punctuation.section.brackets.begin.powershell
552+
push: inside-indexer
546553
- match: \[
547554
scope: punctuation.section.brackets.begin.powershell
548555
push: inside-indexer
@@ -652,11 +659,14 @@ contexts:
652659
scope: keyword.operator.logical.powershell
653660
- match: \|
654661
scope: keyword.operator.logical.pipe.powershell
662+
- match: \?\?
663+
scope: keyword.operator.null-coalescing.powershell
655664
- match: ;
656665
scope: punctuation.terminator.statement.powershell
657666
- match: \`(?=\n|$)
658667
scope: punctuation.separator.continuation.line.powershell
659668
- include: comma-separators
669+
# TODO: Distinguish call operator from background operator
660670
- match: '&'
661671
scope: keyword.operator.background.powershell
662672
- match: \.\.(?=\-?\d|\(|\$)

0 commit comments

Comments
 (0)