{ "information_for_contributors": [ "This file has been converted from https://github.com/PowerShell/EditorSyntax/blob/master/PowerShellSyntax.tmLanguage", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], "version": "https://github.com/PowerShell/EditorSyntax/commit/d605150f48952ba4bd28d7b389e97adc1a5d9b76", "name": "PowerShell", "scopeName": "source.powershell", "patterns": [ { "begin": "(--%)", "beginCaptures": { "1": { "name": "keyword.operator.powershell" } }, "comment": "Stop Parsing", "end": "$", "patterns": [ { "include": "#lineComment" }, { "match": "(.)", "name": "support.other.powershell" } ] }, { "include": "#illegalBacktick" }, { "include": "#lineComment" }, { "include": "#blockComment" }, { "include": "#stringDoubleQuoted" }, { "include": "#stringSingleQuoted" }, { "include": "#stringDoubleQuotedHeredoc" }, { "include": "#stringSingleQuotedHeredoc" }, { "include": "#switch" }, { "include": "#scriptBlock" }, { "include": "#subExpression" }, { "include": "#arrayDeclaration" }, { "include": "#redirection" }, { "include": "#numericConstant" }, { "include": "#operators" }, { "include": "#type" }, { "include": "#function" }, { "include": "#enum" }, { "include": "#class" }, { "include": "#reservedWords" }, { "include": "#controlWords" }, { "include": "#commands" }, { "include": "#executableFiles" }, { "include": "#illegalVariable" }, { "include": "#variable" } ], "repository": { "arrayDeclaration": { "begin": "(\\@?\\()", "beginCaptures": { "0": { "name": "keyword.other.powershell" } }, "end": "(\\))((\\.[\\w\"']+)*)", "endCaptures": { "1": { "name": "keyword.other.powershell" }, "2": { "name": "entity.other.attribute-name.powershell" } }, "name": "meta.array.powershell", "patterns": [ { "include": "$self" } ] }, "blockComment": { "begin": "(<#)", "end": "(#>)", "name": "comment.block.powershell", "patterns": [ { "include": "#commentEmbeddedDocs" } ] }, "class": { "begin": "(?&1)", "name": "keyword.operator.redirection.powershell" }, { "comment": "File redirection", "match": "(?<=\\s|^)(([1-6\\*]?>{1,2})|(<))", "name": "keyword.operator.redirection.powershell" } ] }, "reservedWords": { "match": "(\\b(?)", "match": "\\b(?i:(switch))\\b\\s+(?i:(-regex|-wildcard|-exact){0,1})\\s*(?i:(-casesensitive){0,1})\\s*" } ] }, "type": { "begin": "\\[", "beginCaptures": { "0": { "name": "keyword.other.powershell" } }, "comment": "Type []", "end": "(\\])(::[\\w]+)*((\\.[\\w\"']+)*)", "endCaptures": { "1": { "name": "keyword.other.powershell" }, "2": { "name": "meta.method.powershell" }, "3": { "name": "entity.other.attribute-name.powershell" } }, "patterns": [ { "begin": "\\(", "beginCaptures": { "0": { "name": "keyword.other.powershell" } }, "comment": "Parenthesis ()", "end": "\\)", "endCaptures": { "0": { "name": "keyword.other.powershell" } }, "patterns": [ { "include": "$self" }, { "comment": "Reserved words within [( )]", "match": "\\b(?i)(mandatory|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|position|parametersetname|defaultparametersetname|supportsshouldprocess|positionalbinding|helpuri|confirmimpact|helpmessage)\\b", "name": "entity.other.attribute-name.powershell" } ] }, { "include": "$self" }, { "match": "(.(`){0,2}(\\d){0,2})", "name": "entity.name.type" } ] }, "variable": { "patterns": [ { "comment": "Invalid variable name", "match": "(\\$)(\\w+-\\w+)\\b", "name": "invalid.illegal.powershell" }, { "captures": { "1": { "name": "constant.language.powershell" }, "2": { "name": "constant.language.powershell" }, "3": { "name": "entity.other.attribute-name.powershell" } }, "comment": "Automatic variables - read-only.", "match": "(\\$)(?i:(_|args|consolefilename|error|event|eventsubscriber|executioncontext|false|foreach|home|host|input|lastexitcode|matches|myinvocation|nestedpromptlevel|null|pid|psboundparameters|pscmdlet|psculture|psdebugcontext|pshome|psitem|psscriptroot|psuiculture|psversiontable|pwd|sender|shellid|sourceargs|sourceeventargs|switch|this|true))\\b((\\.[\\w\"'\\- @#]+)*)" }, { "captures": { "1": { "name": "keyword.other.powershell" }, "2": { "name": "storage.modifier.scope.powershell" }, "3": { "name": "variable.other.readwrite.powershell" }, "4": { "name": "variable.other.readwrite.powershell" }, "5": { "name": "entity.other.attribute-name.powershell" } }, "comment": "$var, $local:var", "match": "(\\$)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(\\w+)(:\\w+)?((\\.[\\w\"'\\- @#]+)*)" }, { "captures": { "1": { "name": "keyword.other.powershell" }, "2": { "name": "keyword.other.powershell" }, "3": { "name": "storage.modifier.scope.powershell" }, "4": { "name": "variable.other.readwrite.powershell" }, "5": { "name": "keyword.other.powershell" }, "6": { "name": "entity.other.attribute-name.powershell" } }, "comment": "${var}, ${script:var}", "match": "(\\$)(\\{)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(.+?)(\\})((\\.[\\w\"'\\- @#]+)*)" }, { "captures": { "1": { "name": "keyword.other.powershell" }, "2": { "name": "variable.other.readwrite.powershell" } }, "comment": "Splatting", "match": "(@)(\\w+)" } ] }, "variableWithoutPropertyHighlighting": { "patterns": [ { "comment": "Invalid variable name", "match": "(\\$)(\\w+-\\w+)\\b", "name": "invalid.illegal.powershell" }, { "captures": { "1": { "name": "constant.language.powershell" }, "2": { "name": "constant.language.powershell" } }, "comment": "Automatic variables - read-only.", "match": "(\\$)(?i:(_|args|consolefilename|error|event|eventsubscriber|executioncontext|false|foreach|home|host|input|lastexitcode|matches|myinvocation|nestedpromptlevel|null|pid|psboundparameters|pscmdlet|psculture|psdebugcontext|pshome|psitem|psscriptroot|psuiculture|psversiontable|pwd|sender|shellid|sourceargs|sourceeventargs|switch|this|true))\\b" }, { "captures": { "1": { "name": "keyword.other.powershell" }, "2": { "name": "storage.modifier.scope.powershell" }, "3": { "name": "variable.other.readwrite.powershell" }, "4": { "name": "variable.other.readwrite.powershell" } }, "comment": "$var, $local:var", "match": "(\\$)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(\\w+)(:\\w+)?" }, { "captures": { "1": { "name": "keyword.other.powershell" }, "2": { "name": "keyword.other.powershell" }, "3": { "name": "storage.modifier.scope.powershell" }, "4": { "name": "variable.other.readwrite.powershell" }, "5": { "name": "keyword.other.powershell" } }, "comment": "${var}, ${script:var}", "match": "(\\$)(\\{)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(.+?)(\\})" }, { "captures": { "1": { "name": "keyword.other.powershell" }, "2": { "name": "variable.other.readwrite.powershell" } }, "comment": "Splatting", "match": "(@)(\\w+)" } ] } } }