@@ -461,66 +461,23 @@ contexts:
461461# ##[ VARIABLES ]###############################################################
462462
463463 variables :
464- - match : |-
465- (?xi:
466- (\$)
467- (?:
468- ExecutionContext | Host | Home | IsCoreCLR | IsLinux | IsWindows
469- | IsMacOS | PID | Profile | PsCommandPath | PsHome | PsScriptRoot
470- | PsUiCulture | PsVersionTable | ShellID
471- )
472- )
464+ - match : (\$){{var_constants}}
473465 scope : support.constant.variable.powershell
474466 captures :
475467 1 : punctuation.definition.variable.powershell
476468 push : members
477- - match : |-
478- (?xi:
479- (\$)
480- (?:
481- [$^?_]
482- | (?:
483- Args | ConsoleFileName | Error | Event | EventArgs
484- | EventSubscriber | ForEach | Input | LastExitCode | Matches
485- | MyInvocation | NestedPromptLevel | PsBoundParameters | PsCmdlet
486- | PsCulture | PsDebugContext | PsItem | Pwd | Sender | SourceArgs
487- | SourceEventArgs | StackTrace | Switch | This
488- )\b
489- )
490- )
469+ - match : (\$){{var_language}}
491470 scope : variable.language.powershell
492471 captures :
493472 1 : punctuation.definition.variable.powershell
494473 push : members
495- - match : |-
496- (?xi:
497- (\$)
498- (?:
499- (?:
500- Confirm | Debug | ErrorAction | Information | Progress | Verbose # *Preference
501- | Warning | WhatIf
502- )
503- Preference
504- | Maximum(?:Alias|Drive|Error|Function|History|Variable)Count # Maximum*Count
505- | Log(?:Command|Engine|Provider)(?:Health|Lifecycle)Event # Log*Event
506- | PsDebugContext | PsDefaultParameterValues | PsEmailServer
507- | PsModuleAutoloadingPreference | PsSenderInfo
508- | PsSessionApplicationName | PsSessionConfigurationName
509- | PsSessionOption | ErrorView | FormatEnumerationLimit | OFS
510- | OutputEncoding
511- )
512- )
513- scope: variable.language.powershell
514- captures:
515- 1: punctuation.definition.variable.powershell
516- push: members
517- - match : ((\$|@)(?i:(global|local|private|script|using|workflow):\w+))
474+ - match : ((\$|@)(?i:({{var_scope_mod}}):\w+))
518475 captures :
519476 1 : variable.other.readwrite.powershell
520477 2 : punctuation.definition.variable.powershell
521478 3 : storage.modifier.scope.powershell
522479 push : members
523- - match : ((\$)(\{)((?i:global|local|private|script|using|workflow) ):([^}]*[^}`])(\}))
480+ - match : ((\$)(\{)({{var_scope_mod}} ):([^}]*[^}`])(\}))
524481 captures :
525482 1 : variable.other.readwrite.powershell
526483 2 : punctuation.definition.variable.powershell
@@ -545,62 +502,20 @@ contexts:
545502 push : members
546503
547504 variables-without-property :
548- - match : |-
549- (?xi:
550- (\$)
551- (?:
552- ExecutionContext | Host | Home | IsCoreCLR | IsLinux | IsWindows
553- | IsMacOS | PID | Profile | PsCommandPath | PsHome | PsScriptRoot
554- | PsUiCulture | PsVersionTable | ShellID
555- )
556- )
505+ - match : (\$){{var_constants}}
557506 scope : support.constant.variable.powershell
558507 captures :
559508 1 : punctuation.definition.variable.powershell
560- - match : |-
561- (?xi:
562- (\$)
563- (?:
564- [$^?_]
565- | (?:
566- Args | ConsoleFileName | Error | Event | EventArgs
567- | EventSubscriber | ForEach | Input | LastExitCode | Matches
568- | MyInvocation | NestedPromptLevel | PsBoundParameters | PsCmdlet
569- | PsCulture | PsDebugContext | PsItem | Pwd | Sender | SourceArgs
570- | SourceEventArgs | StackTrace | Switch | This
571- )\b
572- )
573- )
574- scope: variable.language.powershell
575- captures:
576- 1: punctuation.definition.variable.powershell
577- - match : |-
578- (?xi:
579- (\$)
580- (?:
581- (?:
582- Confirm | Debug | ErrorAction | Information | Progress | Verbose # *Preference
583- | Warning | WhatIf
584- )
585- Preference
586- | Maximum(?:Alias|Drive|Error|Function|History|Variable)Count # Maximum*Count
587- | Log(?:Command|Engine|Provider)(?:Health|Lifecycle)Event # Log*Event
588- | PsDebugContext | PsDefaultParameterValues | PsEmailServer
589- | PsModuleAutoloadingPreference | PsSenderInfo
590- | PsSessionApplicationName | PsSessionConfigurationName
591- | PsSessionOption | ErrorView | FormatEnumerationLimit | OFS
592- | OutputEncoding
593- )
594- )
509+ - match : (\$){{var_language}}
595510 scope : variable.language.powershell
596511 captures :
597512 1 : punctuation.definition.variable.powershell
598- - match : (?i:(\$|@)(global|local|private|script|using|workflow ):(\w+))
513+ - match : (?i:(\$|@)({{var_scope_mod}} ):(\w+))
599514 captures :
600515 1 : punctuation.definition.variable.powershell
601516 2 : storage.modifier.scope.powershell
602517 3 : variable.other.readwrite.powershell
603- - match : (?i:(\$)(\{)(global|local|private|script|using|workflow ):([^}]*[^}`])(\}))
518+ - match : (?i:(\$)(\{)({{var_scope_mod}} ):([^}]*[^}`])(\}))
604519 captures :
605520 1 : punctuation.definition.variable.powershell
606521 2 : punctuation.section.braces.begin
@@ -924,15 +839,50 @@ contexts:
924839# ##############################################################################
925840
926841variables :
927- dec_exponent : (?:[eE][-+]?\d*)
928- dec_suffix : ' [dD]'
929- float_suffix : ' [dDlL]'
930- int_suffix : (?i:u[lsy]?|[lnsy])
931- unit_suffix : (?i:[kmgtp]b\b)
932842 kebab_break : (?![\w-])
933843 builtin_types : |-
934844 \b(?x:
935845 void | null | object | bool | char | string
936846 | int (?:32|64)? | long | byte | float | double | decimal
937847 | array | hashtable
938848 )\b
849+
850+ # Numbers
851+ dec_exponent : (?:[eE][-+]?\d*)
852+ dec_suffix : ' [dD]'
853+ float_suffix : ' [dDlL]'
854+ int_suffix : (?i:u[lsy]?|[lnsy])
855+ unit_suffix : (?i:[kmgtp]b\b)
856+
857+ # Variables
858+ var_constants : |-
859+ \b(?xi:
860+ (?:
861+ ExecutionContext | Host | Home | IsCoreCLR | IsLinux | IsWindows
862+ | IsMacOS | PID | Profile | PsCommandPath | PsHome | PsScriptRoot
863+ | PsUiCulture | PsVersionTable | ShellID
864+ )
865+ )\b
866+ var_language : |-
867+ (?xi:
868+ [$^?_]
869+ | \b(?:
870+ Args | ConsoleFileName | Error | Event | EventArgs
871+ | EventSubscriber | ForEach | Input | LastExitCode | Matches
872+ | MyInvocation | NestedPromptLevel | PsBoundParameters | PsCmdlet
873+ | PsCulture | PsDebugContext | PsItem | Pwd | Sender | SourceArgs
874+ | SourceEventArgs | StackTrace | Switch | This
875+ | (?:
876+ Confirm | Debug | ErrorAction | Information | Progress # *Preference
877+ | Verbose | Warning | WhatIf
878+ ) Preference
879+ | Maximum (?: Alias | Drive | Error | Function | History | Variable ) Count # Maximum*Count
880+ | Log (?: Command | Engine | Provider ) (?: Health | Lifecycle ) Event # Log*Event
881+ | PsDebugContext | PsDefaultParameterValues | PsEmailServer
882+ | PsModuleAutoloadingPreference | PsSenderInfo
883+ | PsSessionApplicationName | PsSessionConfigurationName
884+ | PsSessionOption | ErrorView | FormatEnumerationLimit | OFS
885+ | OutputEncoding
886+ )\b
887+ )
888+ var_scope_mod : (?i:global|local|private|script|using|workflow)
0 commit comments