diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5171c54 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +npm-debug.log \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..19e2395 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "powershell.scriptAnalysis.enable": false, + "powershell.startAutomatically": false +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..5c196e1 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,23 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "build", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "type": "npm", + "script": "test", + "group": { + "kind": "test", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/PowerShellSyntax.YAML-tmLanguage b/PowerShellSyntax.YAML-tmLanguage new file mode 100644 index 0000000..3b1b6e3 --- /dev/null +++ b/PowerShellSyntax.YAML-tmLanguage @@ -0,0 +1,704 @@ +filetypes: + - ps1 + - psm1 + - psd1 +name: PowerShell +patterns: +- + comment: 'Stop parsing' + begin: (--%) + beginCaptures: + '1': + name: keyword.operator + end: $ + patterns: + - include: '#lineComment' + - + match: (.) + name: source.powershell +- + match: (\$)(\$) + captures: + '1': {name: punctuation.definition.variable} + '2': {name: variable.language} +- include: '#requires' +- include: '#lineComment' +- include: '#blockComment' +- include: '#numericConstant' +- include: '#stringSingleQuoted' +- include: '#stringDoubleQuoted' +- include: '#stringSingleQuotedHeredoc' +- include: '#stringDoubleQuotedHeredoc' +- include: '#illegalBacktick' +- include: '#illegalVariable' +- include: '#redirection' +- include: '#type' +- include: '#function' +- include: '#commands' +- include: '#class' +- include: '#enum' +- include: '#switch' +- include: '#arrayDeclaration' +- include: '#hashTable' +- include: '#scriptBlock' +- include: '#subExpression' +- include: '#operators' +- include: '#controlWords' +- include: '#executableFiles' +- include: '#variable' +repository: + requires: + comment: '#Requires statements' + patterns: + - match: '(?i:^(#requires))\s(?i:(-version))\s(\d)(?:(\.\d))?$' + captures: + '0': {name: meta.requires} + '1': {name: keyword.other.requires} + '2': {name: variable.parameter} + '3': {name: variable.parameter} + '4': {name: variable.parameter} + - match: '(?i:^(#requires))\s(?i:(-pssnapin))\s(\w+)(?:\s(?i:(-version))(?:\s(\d))(\.\d)?)?$' + captures: + '0': {name: meta.requires} + '1': {name: keyword.other.requires} + '2': {name: variable.parameter} + '3': {name: variable.parameter} + '4': {name: variable.parameter} + '5': {name: variable.parameter} + '6': {name: variable.parameter} + lineComment: + comment: 'Line comment - must start with new line or at least one whitespace character before the ''#''.' + begin: '(^#|\s#)' + beginCaptures: + '1': + name: punctuation.definition.comment + end: $ + name: comment.line + patterns: + - include: '#commentEmbeddedDocs' + blockComment: + begin: '(<#)' + beginCaptures: + '1': + name: punctuation.definition.comment + end: '(#>)' + endCaptures: + '1': + name: punctuation.definition.comment + name: comment.block + patterns: + - include: '#commentEmbeddedDocs' + stringEscapeChars: + patterns: + - match: '(")(?:")' + captures: + '1': {name: constant.character.escape} + - match: '(`)(:?["''$`])' + captures: + '1': {name: constant.character.escape} + - name: constant.character.escape + match: '(`[0abfnrtv])' + stringSingleQuoted: + begin: '((?)' + match: '\b(?i:(switch))\b\s+(?i:(-regex|-wildcard|-exact){0,1})\s*(?i:(-casesensitive){0,1})\s*' + defaultKeyword: + captures: + '0': + name: keyword.other + comment: 'Default is a reserved word when used in Switch statements. This is kind of a work-around - it will highlight only inside scriptblocks.' + match: '(?i:(default))\s*(?=\{)' + redirection: + patterns: + - + comment: 'Merging redirection' + match: '(?<=\s|^)([2-6\*]?>&1)' + name: keyword.operator.redirection + - + comment: 'File redirection' + match: '(?<=\s|^)(([1-6\*]?>{1,2})|(<))' + name: keyword.operator.redirection + function: + begin: '(? - - - - fileTypes - - ps1 - psm1 - psd1 - - name - 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 - (?<!\w|-)(?i:(class))\s+(\w+)(?:\s*(:)\s*(\w+))?\s*\{ - beginCaptures - - 1 - - name - storage.type.powershell - - 2 - - name - entity.name.function.powershell - - 3 - - name - keyword.operator.powershell - - 4 - - name - entity.other.inherited-class.powershell - - - comment - Class - end - \} - name - meta.class.powershell - patterns - - - include - #classReservedWords - - - include - #classBaseKeyword - - - include - $self - - - - classBaseKeyword - - captures - - 1 - - name - keyword.operator.powershell - - 2 - - name - keyword.control.class.powershell - - - comment - The base keyword used in classes. - match - (:)\s*(?i:(base))\s*(?=\() - - classReservedWords - - comment - Reserved words for classes. - match - \b(?i:(hidden|static))\b - name - keyword.other.powershell - - commandParameter - - patterns - - - comment - -Parameter value - match - \s(-\w+)(:)? - name - variable.parameter.powershell - - - - commands - - patterns - - - begin - (?<!\\)\b((?i:(Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write))-(\w+))\b(?!\.|\\) - beginCaptures - - 1 - - name - support.function.powershell - - - comment - Generic function match based on Verb-Noun pair using list of approved verbs. - end - ((?=\))|(?=\})|(?<!`)\n|(?<!`)\r|(\|)) - endCaptures - - 2 - - name - keyword.operator.powershell - - - name - meta.command.powershell - patterns - - - include - #scriptblock - - - include - #commandParameter - - - include - #lineComment - - - include - #redirection - - - include - #numericConstant - - - include - #operators - - - include - #variable - - - include - #stringDoubleQuoted - - - include - #stringSingleQuoted - - - include - #arrayDeclaration - - - include - #illegalBacktick - - - include - #illegalVariable - - - - - begin - (?<!\\)\b(?i:foreach-object|tee-object|where-object|sort-object)\b(?!\.|\\) - beginCaptures - - 0 - - name - support.function.powershell - - - comment - Built-in commands that don't adhere to the approved verbs standard. - end - ((?=\))|(?=\})|(?<!`)\n|(?<!`)\r|(\|)) - endCaptures - - 2 - - name - keyword.operator.powershell - - - name - meta.command.powershell - patterns - - - include - #scriptblock - - - include - #commandParameter - - - include - #lineComment - - - include - #redirection - - - include - #numericConstant - - - include - #operators - - - include - #variable - - - include - #stringDoubleQuoted - - - include - #stringSingleQuoted - - - include - #arrayDeclaration - - - include - #illegalBacktick - - - include - #illegalVariable - - - - - begin - (?<!\\|\[)\b(?i:ac|asnp|cat|cd|cfs|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|curl|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fhx|fl|ft|fw|gal|gbp|gc|gcb|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|gpv|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|scb|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|wget|wjb|write)\b(?!\.|\\|\]) - beginCaptures - - 0 - - name - support.function.powershell - - - comment - Built-in aliases - end - ((?=\))|(?=\})|(?<!`)\n|(?<!`)\r|(\|)) - endCaptures - - 2 - - name - keyword.operator.powershell - - - name - meta.command.powershell - patterns - - - include - #scriptblock - - - include - #commandParameter - - - include - #lineComment - - - include - #redirection - - - include - #numericConstant - - - include - #operators - - - include - #variable - - - include - #stringDoubleQuoted - - - include - #stringSingleQuoted - - - include - #arrayDeclaration - - - include - #illegalBacktick - - - include - #illegalVariable - - - - - begin - (\b(([A-Za-z0-9\-_\.]+).(?i:ps1))\b) - beginCaptures - - 0 - - name - support.function.powershell - - - comment - External script - end - ((?=\))|(?=\})|(?<!`)\n|(?<!`)\r|(\|)) - endCaptures - - 2 - - name - keyword.operator.powershell - - - name - meta.command.powershell - patterns - - - include - #scriptblock - - - include - #commandParameter - - - include - #lineComment - - - include - #redirection - - - include - #numericConstant - - - include - #operators - - - include - #variable - - - include - #stringDoubleQuoted - - - include - #stringSingleQuoted - - - include - #arrayDeclaration - - - include - #illegalBacktick - - - include - #illegalVariable - - - - - - commentEmbeddedDocs - - patterns - - - captures - - 1 - - name - keyword.operator.documentation.powershell - - 2 - - name - keyword.operator.documentation.powershell - - - match - (?i:(\.)(SYNOPSIS|DESCRIPTION|EXAMPLE|INPUTS|OUTPUTS|NOTES|LINK|COMPONENT|FUNCTIONALITY|ROLE)\b) - name - comment.documentation.embedded.powershell - - - captures - - 1 - - name - keyword.operator.documentation.powershell - - 2 - - name - keyword.operator.documentation.powershell - - 3 - - name - constant.string.documentation.powershell - - - match - (?i:(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+(.+)) - name - comment.documentation.embedded.powershell - - - captures - - 1 - - name - keyword.operator.documentation.powershell - - 2 - - name - constant.string.documentation.powershell - - - comment - Requires -Version - match - (?i:(requires))\s(-(?i:version)\s\d+(\.\d+)?) - name - comment.documentation.embedded.powershell - - - captures - - 1 - - name - keyword.operator.documentation.powershell - - 2 - - name - constant.string.documentation.powershell - - - comment - Requires -PSSnapin - match - (?i:(requires))\s(-(?i:pssnapin)\s\w+(\s*-(?i:version)\s\d+(\.\d+)?)?) - name - comment.documentation.embedded.powershell - - - captures - - 1 - - name - keyword.operator.documentation.powershell - - 2 - - name - constant.string.documentation.powershell - - - comment - Requires -Modules - match - (?i:(requires))\s(-(?i:modules)\s.*) - name - comment.documentation.embedded.powershell - - - captures - - 1 - - name - keyword.operator.documentation.powershell - - 2 - - name - constant.string.documentation.powershell - - - comment - Requires -ShellId - match - (?i:(requires))\s(-(?i:shellid)\s.*) - name - comment.documentation.embedded.powershell - - - captures - - 1 - - name - keyword.operator.documentation.powershell - - 2 - - name - constant.string.documentation.powershell - - - comment - Requires -RunAsAdministrator - match - (?i:(requires))\s(-(?i:runasadministrator)) - name - comment.documentation.embedded.powershell - - - - controlWords - - match - (\b(?<!-|\$)(?i:begin|process|exit|break|return|catch|finally|for|continue|foreach|throw|from|trap|try|do|if|until|in|using|else|elseif|while|end|where)\b(?!-|\.)) - name - keyword.control.powershell - - defaultKeyword - - captures - - 0 - - name - keyword.other.powershell - - - comment - Default is a reserved word when used in Switch statements. This is kind of a work-around - it will highlight only inside scriptblocks. - match - (?i:(default))\s*(?=\{) - - enum - - captures - - 1 - - name - storage.type.powershell - - 2 - - name - entity.name.function - - - comment - capture should be entity.name.type, but it doesn't provide a good color in the default schema. - match - (?<!\w|-)(?i:(enum))\s+(\w+)\s+ - - executableFiles - - comment - Executable files, like exe, com, cmd and bat - match - (\b(([A-Za-z0-9\-_\.]+).(?i:exe|com|cmd|bat))\b) - name - support.function.powershell - - function - - begin - (?<!\S)(?i)(function|filter|workflow|configuration)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+) - beginCaptures - - 0 - - name - meta.function - - 1 - - name - storage.type - - 2 - - name - storage.modifier.scope.powershell - - 3 - - name - entity.name.function.powershell - - - end - \{|\( - patterns - - - include - #lineComment - - - - hashTable - - begin - (@\{) - end - (\}) - name - meta.hashtable.powershell - patterns - - - include - $self - - - - illegalBacktick - - comment - Any characters (other than new line) after a back-tick, is illegal in PowerShell. - match - (`(?!$)) - name - invalid.illegal.powershell - - illegalVariable - - match - \$\w+:\s - name - invalid.illegal.powershell - - lineComment - - begin - (^#|\s#) - comment - Line comment - must start with new line or at least one whitespace character before the '#'. - end - $ - name - comment.line.number-sign.powershell - patterns - - - include - #commentEmbeddedDocs - - - - numericConstant - - patterns - - - comment - Real [(+|-)] digits . digits [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)] - match - (?<!\w)([-+]?)\d+\.\d+(?i:e(\+|-){0,1}\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d) - name - constant.numeric.real.powershell - - - comment - Real [(+|-)] . digits [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)] - match - (?<!\.|\d|\w)([-+]?)\.\d+(?i:e(\+|-){0,1}\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d) - name - constant.numeric.real.powershell - - - comment - Real [(+|-)] digits . [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)] - match - (?<!\w)([-+]?)(?<!\d)\d+\.(?i:e(\+|-){0,1}\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d|\.) - name - constant.numeric.real.powershell - - - comment - Integer [(+|-)] digits [(d|l)] [(kb|mb|gb|tb|pb)] - match - (?<!\w|\w\.)([-+]?)\d+(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d) - name - constant.numeric.integer.powershell - - - comment - Real [(+|-)] digits [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)] - match - (?<!\w|\.)([-+]?)(?<!\d)\d+(?i:e(\+|-){0,1}\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d|\.) - name - constant.numeric.real.powershell - - - comment - Hexadecimal 0x 0-f [l] [kb|mb|gb|tb|pb] - match - (?<!\w|\d)([-+]?)(?i:0x)(?i:[0-9a-f])+(?i:l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d) - name - constant.numeric.hexadecimal.powershell - - - - operators - - patterns - - - comment - Comparison - match - (?<=\d|\s|^)-(?i:as|is|isnot|in|notin|join|((c|i)?(eq|ne|gt|lt|ge|le|like|notlike|split|replace|contains|notcontains|match|notmatch))|shl|shr)\b(?!\.|\\) - name - keyword.operator.comparison.powershell - - - comment - Bitwise - match - (?<=\d|\s|^)-(?i:band|bor|bxor|bnot|shr|shl)\b - name - keyword.operator.bitwise.powershell - - - comment - Logical - match - (?<=\d|\s|^)-(?i:and|or|xor)\b - name - keyword.operator.logical.powershell - - - comment - Format - match - (?<=\d|\s|^)-(?i:f)\b - name - keyword.operator.format.powershell - - - comment - Assignment - match - (=|-=|\+=|\*=|/=|%=) - name - keyword.operator.assignment.powershell - - - comment - Logical NOT - match - (?<=\d|\s|^)((?i:-not)|!) - name - keyword.operator.unary.logical-not.powershell - - - comment - Multiplicative - match - ([*/%])(?!\.) - name - keyword.operator.multiplicative.powershell - - - comment - Unary Plus - match - ([+](?=\$|\(|")) - name - keyword.operator.unary-plus.powershell - - - comment - Unary Minus - match - ([-](?=\$|\(|")) - name - keyword.operator.unary-minus.powershell - - - comment - Additive - match - ([+-])(?!\{|\p{L}|@) - name - keyword.operator.additive.powershell - - - comment - Range - match - (\.\.) - name - keyword.operator.range.powershell - - - comment - Command invocation (Call) - match - (&|\|) - name - keyword.operator.other.powershell - - - - redirection - - patterns - - - comment - Merging redirection - match - (?<=\s|^)([2-6\*]?>&1) - name - keyword.operator.redirection.powershell - - - comment - File redirection - match - (?<=\s|^)(([1-6\*]?>{1,2})|(<)) - name - keyword.operator.redirection.powershell - - - - reservedWords - - match - (\b(?<!-|\$)(?i:configuration|node|enum|filter|sequence|class|data|define|function|dynamicparam|inlinescript|var|parallel|param|workflow)\b(?!-|\.)) - name - keyword.other.powershell - - scriptBlock - - begin - (\{) - end - (\}) - name - meta.scriptblock.powershell - patterns - - - include - $self - - - include - #defaultKeyword - - - - stringDoubleQuoted - - begin - ((?<!\")\") - end - (\"(?!\")) - name - string.quoted.double.powershell - patterns - - - include - #illegalVariable - - - include - #stringEscapeChars - - - include - #variableWithoutPropertyHighlighting - - - include - #subExpression - - - - stringDoubleQuotedHeredoc - - begin - (\@"\s*$) - end - ^"\@ - name - string.quoted.double.heredoc.powershell - patterns - - - include - #illegalVariable - - - include - #stringEscapeChars - - - include - #variableWithoutPropertyHighlighting - - - include - #subExpression - - - include - #scriptBlock - - - - stringEscapeChars - - patterns - - - match - (`[0abfnrtv"'$`]) - name - constant.character.escape.powershell - - - match - ("") - name - constant.character.escape.powershell - - - - stringSingleQuoted - - begin - ((?<!')') - end - ('(?!')) - name - string.quoted.single.powershell - patterns - - - include - #stringSingleQuotedDouble - - - - stringSingleQuotedDouble - - match - ('') - name - constant.character.escape.powershell - - stringSingleQuotedHeredoc - - begin - (\@'\s*$) - end - ^'\@ - name - string.quoted.single.heredoc.powershell - patterns - - - include - #stringSingleQuotedDouble - - - - subExpression - - begin - (\$\() - captures - - 0 - - name - keyword.other.powershell - - - end - (\)) - name - meta.subexpression.powershell - patterns - - - include - $self - - - match - (.) - name - source.powershell - - - - switch - - patterns - - - captures - - 1 - - name - keyword.control.powershell - - 2 - - name - variable.parameter.powershell - - 4 - - name - variable.parameter.powershell - - 5 - - name - variable.parameter.powershell - - - comment - switch [-regex|-wildcard|-exact][-casesensitive] -file filename - match - \b(?i:(switch))\b\s+(?i:(-regex|-wildcard|-exact){0,1})\s*(?i:(-casesensitive){0,1})\s*(?i:(-file))\s+ - - - captures - - 1 - - name - keyword.control.powershell - - 2 - - name - variable.parameter.powershell - - 3 - - name - variable.parameter.powershell - - - comment - switch [-regex|-wildcard|-exact][-casesensitive] (<value>) - 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+) - - - - - scopeName - source.powershell - uuid - f8f5ffb0-503e-11df-9879-0800200c9a66 - - \ No newline at end of file diff --git a/README.md b/README.md index ba8a1dd..a6acdd7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ -[![Join the chat at https://gitter.im/PowerShell/EditorSyntax](https://badges.gitter.im/PowerShell/EditorSyntax.svg)](https://gitter.im/PowerShell/EditorSyntax?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - # PowerShell Syntax Definition for Editors +[![Build status](https://ci.appveyor.com/api/projects/status/yhplne0es74doruv/branch/master?svg=true)](https://ci.appveyor.com/project/PowerShell/editorsyntax/branch/master) +[![Join the chat at https://gitter.im/PowerShell/EditorSyntax](https://badges.gitter.im/PowerShell/EditorSyntax.svg)](https://gitter.im/PowerShell/EditorSyntax?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + This project establishes the central development and maintenance of syntax definition files for the PowerShell language used by editors that leverage the XML version of the [TextMate language grammar format](http://manual.macromates.com/en/language_grammars). @@ -22,12 +23,38 @@ both VS Code and Sublime Text. There are a number of existing issues with the g that we need to track down and fix. Please see [issue #1](https://github.com/PowerShell/EditorSyntax/issues/1) for more details. +Ultimately we are looking at doing a total refactoring of the grammar file. + ## Contributing We would love to have community contributions to this project to make PowerShell syntax highlighting great in as many editors as we can. Please feel free to file issues or send pull requests if you'd like to contribute. +### Workflow + +Build and test scripts are provided that requires node and tasks are included for Visual Studio Code. + +To get started contributing: + +- Install node (if not installed already) +- Clone this repository locally +- run ``npm install`` to install the node dependencies + +After you have made changes to ``PowerShellSyntax.YAML-tmLanguage``, press Ctrl + Shift + b to start the build task. This will convert the file to _plist_, _JSON_ and _CSON_ as well as run the tests to make sure that nothing breaks. + +The converted files are saved to the **grammars** folder. + +If you want to preview the changes locally, and are running Windows (with PowerShell), you can use the included helper scripts ``useThisGrammar.ps1`` and ``useOriginalGrammar.ps1`` to change between the original and the grammar file from this repository. + +Note that you need to run these scripts as Administrator, and you also need to reload Visual Studio Code to read the new grammar file. + +### Tests + +The test script are using the file ``referenceFile.yaml`` to test the tokens and their assigned scopes. + +If you make any changes to the grammar file, remember to also update the reference file and/or ``test.ps1`` if needed; or the tests will fail. + ## Maintainers - [David Wilson](https://github.com/daviwil) - [@daviwil](http://twitter.com/daviwil) @@ -38,4 +65,4 @@ send pull requests if you'd like to contribute. This extension is [licensed under the MIT License](LICENSE). Please see the [third-party notices](Third%20Party%20Notices.txt) file for details on the original -source of the TextMate definition that we use. +source of the TextMate definition that we use. \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..717659c --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,19 @@ +version: 2.0.0-{build} +image: Visual Studio 2017 +clone_depth: 10 +skip_tags: true + +branches: + only: + - master + - v2 + +install: + - ps: Install-Product node '6.9.2' + - ps: npm install + +build_script: + - ps: npm build + +test_script: + - ps: npm test diff --git a/build.js b/build.js new file mode 100644 index 0000000..a561534 --- /dev/null +++ b/build.js @@ -0,0 +1,21 @@ +var fs = require('fs'); +var yaml = require('js-yaml'); +var plist = require('plist'); +var cson = require('cson'); +var source = './PowerShellSyntax.YAML-tmLanguage' +var destinationPlist = './grammars/PowerShellSyntax.tmLanguage' +var destinationJson = './grammars/PowerShellSyntax-JSON-tmLanguage' +var destinationCson = './grammars/PowerShellSyntax.cson' + + +var grammarObj = yaml.safeLoad(fs.readFileSync(source,'utf-8')); +var grammarJson = JSON.stringify(grammarObj,null,2); +var grammarPlist = plist.build(grammarObj); +var grammarCson = cson.stringify(grammarObj,null,2); + +fs.writeFileSync(destinationPlist,grammarPlist); +fs.writeFileSync(destinationJson,grammarJson); +fs.writeFileSync(destinationCson,grammarCson); +console.log('YAML > Plist conversion done. File saved as ' + destinationPlist); +console.log('YAML > JSON conversion done. File saved as ' + destinationJson); +console.log('YAML > CSON conversion done. File saved as ' + destinationCson); \ No newline at end of file diff --git a/examples/TheBigTestFile.ps1 b/examples/TheBigTestFile.ps1 index 35ea16d..4a93291 100644 --- a/examples/TheBigTestFile.ps1 +++ b/examples/TheBigTestFile.ps1 @@ -194,7 +194,7 @@ switch -Regex ("fourteen") {} switch -Wildcard ($a) {} switch -regex -file .\somefile.txt {} switch (3) {} -switch (4, 2) {} +switch (4, 2) {} switch -Regex -File $filePath { '.' {} @@ -213,7 +213,7 @@ switch ('this') { # Illegal backtick Invoke-Command -arg1 $val1 ` - -arg2 $val2 ` + -arg2 $val2 ` # Functions and filters functioN MyFunction{} @@ -234,14 +234,14 @@ filter myfilter($param) {} Filter my-Filter ($param){} function foo -#comment +#comment { - + } # This one will not highlight the function name, # because of the comments after 'function'. TODO? -function +function <# another comment #> test ( @@ -254,22 +254,22 @@ test "test $s" } -# Note that the # in the path should highlight as a comment! +# Note that the # in the path should NOT highlight as a comment! function Test-Drive([string]$roman) { $roman | c:\users\Me\Documents\Programming\F#\test.exe $roman } function Get-EscapedPath { - param( + param( [Parameter( - Position=0, - Mandatory=$true + Position=0, + Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true) ] [string]$path - ) + ) process { if ($path.Contains(' ')) @@ -326,7 +326,7 @@ class Car: Vehicle { SetLength([int]$Length) { $this.Length = $Length - } + } } # Illegal class name @@ -373,7 +373,7 @@ $a -match $b $a -notmatch $b $x -like $c 100 -and 0 -$a -ceq 4 -and $a -ine $d -or +$a -ceq 4 -and $a -ine $d -or $c -is [Type] $c -isnot [Type] $c -as [Type] @@ -441,7 +441,7 @@ Foo-match # Should also be able to use with line comments # .DESCRIPTION # .EXAMPLE sdkl - # + # # .EXTERNALHELP some # .REMOTEHELPRUNSPACE some # .ExternalHelp some diff --git a/examples/issues.ps1 b/examples/issues.ps1 new file mode 100644 index 0000000..1e66d60 --- /dev/null +++ b/examples/issues.ps1 @@ -0,0 +1,324 @@ +# incorrect syntax highlight in parameter type +# https://github.com/PowerShell/EditorSyntax/issues/56 +function Issue56 { + param( + # Credentials to use to connect to JIRA. + [Parameter( + Position = 0, + Mandatory = $true + )] + [System.Management.Automation.PSCredential] $Credential, + + [String] $CertificateThumbprint, + + [X509Certificate] $Certificate + ) +} + +# Incorrect coloring of PowerShell call operator line with "#" character in arguments +# https://github.com/PowerShell/EditorSyntax/issues/55 +& $oscdimg -m -o -u2 -udfver102 -bootdata:2#p0,e,b$isoPath\boot\etfsboot.com#pEF,e,b$isoPath\efi\microsoft\boot\efisys.bin $isoPath $outputPath + +# Operator vs. Parameter Color Coding Issue +# https://github.com/PowerShell/EditorSyntax/issues/54 +$x = 100000 +$EmailList = For ($i=0;$i -lt $x;$i++) { +"$(Get-RandomString -length 10)@$(Get-RandomString -length 10).com" +} +$EmailList | Set-Content -Path .\file1.txt + +# Inconsistency for coloring between splatting and functions +# https://github.com/PowerShell/EditorSyntax/issues/52 +$SelectParams = @{ + Property = 'ProcessName' + Verbose = $true +} + +$SelectParams.ErrorAction = 'Stop' + +Get-Process | Select-Object -Property ProcessName +Get-Process | Select-Object @SelectParams + +# Coloring error in ValidateSet() +# https://github.com/PowerShell/EditorSyntax/issues/51 +function Issue51 { + param ( + [Parameter(Mandatory = $true)] + [ValidateSet('Production','Test','Dev, or Edu')] + [System.String] + $SupportLevel + ) +} + +# Syntax highlighting for variables incorrect where ? is treated as token separator +# https://github.com/PowerShell/EditorSyntax/issues/49 +# https://github.com/PowerShell/EditorSyntax/issues/40 +$foo?bar = 1 +"$foo?bar" +${foo?bar} +"${foo?bar}" +"https://www.googleapis.com/drive/v3/teamdrives/$TeamDriveID?fields=capabilities%2Cid%2Ckind%2Cname" + +# "Process" keyword is incorrectly highlighted in New-Object -TypeName System.Diagnostics.Process +# https://github.com/PowerShell/EditorSyntax/issues/47 +New-Object -TypeName System.Diagnostics.Process -Property @{ } + +# .bat & .exe Syntax Highlighting Error +# https://github.com/PowerShell/EditorSyntax/issues/46 +ipconfig.exe +Import-Module AzureRM.Backup +Import-Module AzureRm.Batch +Import-Module AzureRm.Exefake +Import-Module AzureRM.Cdn + +# Where-Object command is not properly highlighted +# https://github.com/PowerShell/EditorSyntax/issues/45 +# https://github.com/PowerShell/EditorSyntax/issues/39 +Get-Process | + Where-Object -FilterScript { $PSItem.Name -eq 'System' } | + ForEach-Object -Process { $PSItem.WorkingSet } + +Get-AzureVMImage ` +| where ImageFamily -eq $imageFamily ` +| sort PublishedDate -Descending ` +| select -ExpandProperty ImageName -First 1 + +Get-AzureVMImage ` +| Where-Object ImageFamily -eq $imageFamily ` +| Sort-Object PublishedDate -Descending ` +| Select-Object -ExpandProperty ImageName -First 1 + +# Class keyword is incorrectly colored when used as a parameter +# https://github.com/PowerShell/EditorSyntax/issues/43 +function Test-Function { + [CmdletBinding()] + param ( + [string] $Class + ) + } + +### Notice the blue color of "Class", indicating that it is a reserved language keyword. +Test-Function -Class asdf + +### Notice how the "-Name" parameter is colored differently than "-Class" above +Get-Process -Name asdf + +# Discrepancy in Syntax coloring of some cmdlets in VSCode +# https://github.com/PowerShell/EditorSyntax/issues/42 +# https://github.com/PowerShell/EditorSyntax/issues/39 +Register-WmiEvent -Class Win32_DeviceChangeEvent +Wait-Event -OutVariable Event | Out-Null +$Event.SourceArgs.newevent | ` +Sort-Object TIME_CREATED -Descending | ` +Select-Object EventType -ExpandProperty EventType -First 1 + +# variable naming syntax coloration +# https://github.com/PowerShell/EditorSyntax/issues/38 +function MainBillingExcel($clients) { + $clientws2 = $WB2.worksheets | where {$_.cells.item(2,1).value2 -like "*$clients*"} +} + +# Syntax coloring issue with regex +# https://github.com/PowerShell/EditorSyntax/issues/37 +function Get-ServerDomain { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true, + ValueFromPipelineByPropertyName = $true, + Position = 0)] + [ValidateScript({$_ -match '^([\d\w]+\.){2,3}[\d\w]+$'})] + [string]$Name + ) + try { + Write-Verbose "Splitting $Name" + $domain = $Name.Split('.')[1] + Write-Verbose $domain + Return $domain + } + catch {} +} + +# ValidatePattern breaking Syntax Highlighting +# https://github.com/PowerShell/EditorSyntax/issues/34 +# https://github.com/PowerShell/EditorSyntax/issues/33 +# https://github.com/PowerShell/EditorSyntax/issues/32 +# https://github.com/PowerShell/EditorSyntax/issues/26 +# https://github.com/PowerShell/EditorSyntax/issues/17 +[ValidatePattern("^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$")] +[Parameter(ParameterSetName='mac')][ValidatePattern("([a-zA-Z0-9]{2}:){5}[a-zA-Z0-9]{2}")] +[ValidatePattern('^[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}$')] + +# Comments on same line as Function not styled when opening brace is on next line +# https://github.com/PowerShell/EditorSyntax/issues/30 +Function New-Function { #comment here +} +Function New-Function #comment here +{ +} + +# Enumeration support +# https://github.com/PowerShell/EditorSyntax/issues/29 +enum test +{ + listItem1 + listItem2 + listItem3 +} + +# Incorrect syntax highlighting for numeric digits in type names +# https://github.com/PowerShell/EditorSyntax/issues/28 +[Microsoft.Win32.RegistryKey]::Equals() + +# Syntax coloring doesn't recognize quoted strings in parameter validation attribute +# https://github.com/PowerShell/EditorSyntax/issues/27 +function Publish-DscResource +{ + [OutputType([void])] + [CmdletBinding()] + param ( + [Parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [ValidateScript({ + if (-not (Get-DscResource -Name $_ -ErrorAction Ignore)) { + throw "The DSC resource [$($_)] was not found" + } else { + $true + } + })] + [string]$Name + ) +} + +# Where/Foreach-object breaks syntax hightlighting +# https://github.com/PowerShell/EditorSyntax/issues/24 +$SomeComputer = 'localhost' +$RemoteServicePS = @{ + 'VMware' = @{ + 'Service' = $(get-service -verbose:$false -computername $SomeComputer -displayName 'VMware Tools'); + 'EndpointContracts' = @('ISimService','IServiceBroker'); + 'Identity' = ''; #comment + }; + } +$ServicesToSkip = @() + +$RemoteServiceCIM = @{}; $HasServicePrincipalNames = @{} +$RemoteServicePS.GetEnumerator() | % { #comment + $thisServiceKey = $_.Key # test + if ($_.Value.Service -ne $null){ + + $thisCIMService = $(get-ciminstance win32_service -verbose:$false -computername $_.Value.Service.MachineName -filter "name='$($_.Value.Service.ServiceName)'") + $thisCIMServiceUser = $thisCIMService.StartName + write-host $thisCIMServiceUser + # etc. + } +} + +# After updating language-powershell to the most recent release the following from the code above breaks code highlighting for me: +$thisCIMService = $(get-ciminstance win32_service -verbose:$false -computername $_.Value.Service.MachineName -filter "name='$($_.Value.Service.ServiceName)'") + +# The same also appears to be the case for the following little snippet (code hightlighting continues as before if commented out): +$thisBitVersionMatches = $FilesPresent | where {$_.FullName -match "^(?=.*$thisVersion)((?=.*$thisBitness)|(?=.*$thisSupportBit))(?=.*redist).*$"} + +foreach ($Tool in $Tools){ + $ToolFromWhere.Keys | % { + if (($_ -match $Tool) -and -not ($ToolsToDownload -contains $ToolFromWhere."$($_)")){ + write-verbose ('Fetching {0} from {1}' -f $_, $ToolFromWhere."$($_)") + $ToolsToDownload += $ToolFromWhere."$($_)" + [URI]$thisURI = $ToolFromWhere."$($_)" + $thisFileName = $thisURI.Segments[-1] + $thisTempFile = join-path -path $env:TEMP -childpath $thisFileName + start-bitstransfer -source $thisURI -destination $thisTempFile + } + } +} + +Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | +Get-ItemProperty -name Version,Release -EA 0 | + Where { $_.PSChildName -match '^(?!S)\p{L}'} | + Select PSChildName, Version, Release, @{ + name="Product" + expression={ + switch($_.Release) { + DEFAULT {} + } + } + } + +# Where-Object is not highlighted correctly +# https://github.com/PowerShell/EditorSyntax/issues/22 +function Clear-JunctionLinks { + [CmdletBinding()] + param ( + ) + + Get-ChildItem -Path $env:TEMP -Directory | Where-Object -FilterScript { } +} + +# Syntax highlighting doesn't recognize '#text' property +# https://github.com/PowerShell/EditorSyntax/issues/21 +$_.'#text'.Trim() +Get-SomeXml | +Select-Object -ExpandProperty Node | + % { if ($_.'#text') { $_.'#text'.Trim() -split ',\s*' } + else { @() } + } + +# Improper syntax highlighting for #requires statement +# https://github.com/PowerShell/EditorSyntax/issues/20 +#requires -runasadministrator +#requires -modules servermanager +#Requires -Modules PSWorkflow, @{ModuleName="PSScheduledJob";ModuleVersion="1.0.0.0"} +#requires -version 5.0 + +# Are there Powershell flag highlighting inconsistencies? +# https://github.com/PowerShell/EditorSyntax/issues/18 +Install-ConfigFiles -from "$here\tests\process" -to "$here" + +# Syntax highlighting getting worse? +# https://github.com/PowerShell/EditorSyntax/issues/16 +$Whatever.Name -match "Id" +$Whatever.Name -match ".*Id" + +# Dot notation broken inside parens. +# https://github.com/PowerShell/EditorSyntax/issues/15 +if ($Host.name -eq 'ConsoleHost') +{ + if (! (Get-Item ENV:VSCODE_PID -ErrorAction SilentlyContinue)) + { + ## Set Location + Set-Location -Path Repo: + } +} + +# Comma and Periods break Highlighting inside of Quotes. +# https://github.com/PowerShell/EditorSyntax/issues/14 +if ($ModuleResults) +{ + if ($ModuleResults.Installed -ne $null) + { + Write-Host "[INFO] " -ForegroundColor DarkMagenta -NoNewline + Write-Host "Installed Modules: " -NoNewLine -ForegroundColor Gray + Write-Host "$($ModuleResults.Installed -join ', ')" -ForegroundColor DarkGray + } + + if ($ModuleResults.Updated -ne $null) + { + Write-Host "[INFO] " -ForegroundColor DarkMagenta -NoNewline + Write-Host "Updated Modules: " -NoNewLine -ForegroundColor Gray + Write-Host "$($ModuleResults.Updated -join ', ')" -ForegroundColor DarkGray + } + + if ($ModuleResults.FailedUpdate -ne $null) + { + Write-Host "[Error] " -ForegroundColor Red -NoNewline + Write-Host "Module Update Failed: " -NoNewLine -ForegroundColor Gray + Write-Host "$($ModuleResults.FailedUpdate -join ', ')" -ForegroundColor DarkGray + } + + if ($ModuleResults.FailedInstall -ne $null) + { + Write-Host "[ERROR] " -ForegroundColor Red -NoNewline + Write-Host "Module Install Failed: " -NoNewLine -ForegroundColor Gray + Write-Host "$($ModuleResults.FailedInstall -join ', ')" -ForegroundColor DarkGray + } +} \ No newline at end of file diff --git a/generateReference.js b/generateReference.js new file mode 100644 index 0000000..19b14be --- /dev/null +++ b/generateReference.js @@ -0,0 +1,42 @@ +var fs = require('fs'); +var Registry = require('vscode-textmate').Registry; +var yaml = require('js-yaml'); +var registry = new Registry(); +var ruleStack = null; +var lastElementId = 0; +var grammarPath = './grammars/PowerShellSyntax.tmLanguage' +var referencePath = './referenceFile.yaml' +var testFilePath = './test.ps1'; + +// read grammar file +var registry = new Registry(); +var grammar = registry.loadGrammarFromPathSync(grammarPath); + +// read test script +var fileContents = require('fs').readFileSync(testFilePath).toString(); +var lines = fileContents.split(/\r\n|\r|\n/); + +var ref = {"lines":[]}; + +// iterate through each line in the test script +for (var i = 0; i < lines.length; i++) { + var line = lines[i]; + + // skip empty lines + if (line != '') { + var tokens = []; + var lineTokens = grammar.tokenizeLine(line, ruleStack); + for (var y = 0; y < lineTokens.tokens.length; y++) { + var token = lineTokens.tokens[y]; + var tokenString = line.substring(token.startIndex,token.endIndex); + var scopes = token.scopes; + tokens.push({"token":tokenString,"scopes":scopes}); + } + ref.lines.push({"line":line,"tokens":tokens}); + ruleStack = lineTokens.ruleStack; + } +} + +var refYaml = yaml.dump(ref); +fs.writeFileSync(referencePath,refYaml); +console.log("Reference file created!"); \ No newline at end of file diff --git a/grammars/PowerShellSyntax-JSON-tmLanguage b/grammars/PowerShellSyntax-JSON-tmLanguage new file mode 100644 index 0000000..fdebdff --- /dev/null +++ b/grammars/PowerShellSyntax-JSON-tmLanguage @@ -0,0 +1,1357 @@ +{ + "filetypes": [ + "ps1", + "psm1", + "psd1" + ], + "name": "PowerShell", + "patterns": [ + { + "comment": "Stop parsing", + "begin": "(--%)", + "beginCaptures": { + "1": { + "name": "keyword.operator" + } + }, + "end": "$", + "patterns": [ + { + "include": "#lineComment" + }, + { + "match": "(.)", + "name": "source.powershell" + } + ] + }, + { + "match": "(\\$)(\\$)", + "captures": { + "1": { + "name": "punctuation.definition.variable" + }, + "2": { + "name": "variable.language" + } + } + }, + { + "include": "#requires" + }, + { + "include": "#lineComment" + }, + { + "include": "#blockComment" + }, + { + "include": "#numericConstant" + }, + { + "include": "#stringSingleQuoted" + }, + { + "include": "#stringDoubleQuoted" + }, + { + "include": "#stringSingleQuotedHeredoc" + }, + { + "include": "#stringDoubleQuotedHeredoc" + }, + { + "include": "#illegalBacktick" + }, + { + "include": "#illegalVariable" + }, + { + "include": "#redirection" + }, + { + "include": "#type" + }, + { + "include": "#function" + }, + { + "include": "#commands" + }, + { + "include": "#class" + }, + { + "include": "#enum" + }, + { + "include": "#switch" + }, + { + "include": "#arrayDeclaration" + }, + { + "include": "#hashTable" + }, + { + "include": "#scriptBlock" + }, + { + "include": "#subExpression" + }, + { + "include": "#operators" + }, + { + "include": "#controlWords" + }, + { + "include": "#executableFiles" + }, + { + "include": "#variable" + } + ], + "repository": { + "requires": { + "comment": "#Requires statements", + "patterns": [ + { + "match": "(?i:^(#requires))\\s(?i:(-version))\\s(\\d)(?:(\\.\\d))?$", + "captures": { + "0": { + "name": "meta.requires" + }, + "1": { + "name": "keyword.other.requires" + }, + "2": { + "name": "variable.parameter" + }, + "3": { + "name": "variable.parameter" + }, + "4": { + "name": "variable.parameter" + } + } + }, + { + "match": "(?i:^(#requires))\\s(?i:(-pssnapin))\\s(\\w+)(?:\\s(?i:(-version))(?:\\s(\\d))(\\.\\d)?)?$", + "captures": { + "0": { + "name": "meta.requires" + }, + "1": { + "name": "keyword.other.requires" + }, + "2": { + "name": "variable.parameter" + }, + "3": { + "name": "variable.parameter" + }, + "4": { + "name": "variable.parameter" + }, + "5": { + "name": "variable.parameter" + }, + "6": { + "name": "variable.parameter" + } + } + } + ] + }, + "lineComment": { + "comment": "Line comment - must start with new line or at least one whitespace character before the '#'.", + "begin": "(^#|\\s#)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment" + } + }, + "end": "$", + "name": "comment.line", + "patterns": [ + { + "include": "#commentEmbeddedDocs" + } + ] + }, + "blockComment": { + "begin": "(<#)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.comment" + } + }, + "end": "(#>)", + "endCaptures": { + "1": { + "name": "punctuation.definition.comment" + } + }, + "name": "comment.block", + "patterns": [ + { + "include": "#commentEmbeddedDocs" + } + ] + }, + "stringEscapeChars": { + "patterns": [ + { + "match": "(\")(?:\")", + "captures": { + "1": { + "name": "constant.character.escape" + } + } + }, + { + "match": "(`)(:?[\"'$`])", + "captures": { + "1": { + "name": "constant.character.escape" + } + } + }, + { + "name": "constant.character.escape", + "match": "(`[0abfnrtv])" + } + ] + }, + "stringSingleQuoted": { + "begin": "((?)", + "match": "\\b(?i:(switch))\\b\\s+(?i:(-regex|-wildcard|-exact){0,1})\\s*(?i:(-casesensitive){0,1})\\s*" + } + ] + }, + "defaultKeyword": { + "captures": { + "0": { + "name": "keyword.other" + } + }, + "comment": "Default is a reserved word when used in Switch statements. This is kind of a work-around - it will highlight only inside scriptblocks.", + "match": "(?i:(default))\\s*(?=\\{)" + }, + "redirection": { + "patterns": [ + { + "comment": "Merging redirection", + "match": "(?<=\\s|^)([2-6\\*]?>&1)", + "name": "keyword.operator.redirection" + }, + { + "comment": "File redirection", + "match": "(?<=\\s|^)(([1-6\\*]?>{1,2})|(<))", + "name": "keyword.operator.redirection" + } + ] + }, + "function": { + "begin": "(?)" + endCaptures: + "1": + name: "punctuation.definition.comment" + name: "comment.block" + patterns: [ + { + include: "#commentEmbeddedDocs" + } + ] + stringEscapeChars: + patterns: [ + { + match: "(\")(?:\")" + captures: + "1": + name: "constant.character.escape" + } + { + match: "(`)(:?[\"'$`])" + captures: + "1": + name: "constant.character.escape" + } + { + name: "constant.character.escape" + match: "(`[0abfnrtv])" + } + ] + stringSingleQuoted: + begin: "((?)" + match: "\\b(?i:(switch))\\b\\s+(?i:(-regex|-wildcard|-exact){0,1})\\s*(?i:(-casesensitive){0,1})\\s*" + } + ] + defaultKeyword: + captures: + "0": + name: "keyword.other" + comment: "Default is a reserved word when used in Switch statements. This is kind of a work-around - it will highlight only inside scriptblocks." + match: "(?i:(default))\\s*(?=\\{)" + redirection: + patterns: [ + { + comment: "Merging redirection" + match: "(?<=\\s|^)([2-6\\*]?>&1)" + name: "keyword.operator.redirection" + } + { + comment: "File redirection" + match: "(?<=\\s|^)(([1-6\\*]?>{1,2})|(<))" + name: "keyword.operator.redirection" + } + ] + function: + begin: "(? + + + + filetypes + + ps1 + psm1 + psd1 + + name + PowerShell + patterns + + + comment + Stop parsing + begin + (--%) + beginCaptures + + 1 + + name + keyword.operator + + + end + $ + patterns + + + include + #lineComment + + + match + (.) + name + source.powershell + + + + + match + (\$)(\$) + captures + + 1 + + name + punctuation.definition.variable + + 2 + + name + variable.language + + + + + include + #requires + + + include + #lineComment + + + include + #blockComment + + + include + #numericConstant + + + include + #stringSingleQuoted + + + include + #stringDoubleQuoted + + + include + #stringSingleQuotedHeredoc + + + include + #stringDoubleQuotedHeredoc + + + include + #illegalBacktick + + + include + #illegalVariable + + + include + #redirection + + + include + #type + + + include + #function + + + include + #commands + + + include + #class + + + include + #enum + + + include + #switch + + + include + #arrayDeclaration + + + include + #hashTable + + + include + #scriptBlock + + + include + #subExpression + + + include + #operators + + + include + #controlWords + + + include + #executableFiles + + + include + #variable + + + repository + + requires + + comment + #Requires statements + patterns + + + match + (?i:^(#requires))\s(?i:(-version))\s(\d)(?:(\.\d))?$ + captures + + 0 + + name + meta.requires + + 1 + + name + keyword.other.requires + + 2 + + name + variable.parameter + + 3 + + name + variable.parameter + + 4 + + name + variable.parameter + + + + + match + (?i:^(#requires))\s(?i:(-pssnapin))\s(\w+)(?:\s(?i:(-version))(?:\s(\d))(\.\d)?)?$ + captures + + 0 + + name + meta.requires + + 1 + + name + keyword.other.requires + + 2 + + name + variable.parameter + + 3 + + name + variable.parameter + + 4 + + name + variable.parameter + + 5 + + name + variable.parameter + + 6 + + name + variable.parameter + + + + + + lineComment + + comment + Line comment - must start with new line or at least one whitespace character before the '#'. + begin + (^#|\s#) + beginCaptures + + 1 + + name + punctuation.definition.comment + + + end + $ + name + comment.line + patterns + + + include + #commentEmbeddedDocs + + + + blockComment + + begin + (<#) + beginCaptures + + 1 + + name + punctuation.definition.comment + + + end + (#>) + endCaptures + + 1 + + name + punctuation.definition.comment + + + name + comment.block + patterns + + + include + #commentEmbeddedDocs + + + + stringEscapeChars + + patterns + + + match + (")(?:") + captures + + 1 + + name + constant.character.escape + + + + + match + (`)(:?["'$`]) + captures + + 1 + + name + constant.character.escape + + + + + name + constant.character.escape + match + (`[0abfnrtv]) + + + + stringSingleQuoted + + begin + ((?<!')') + beginCaptures + + 1 + + name + punctuation.definition.string.begin + + + end + ('(?!')) + endCaptures + + 1 + + name + punctuation.definition.string.end + + + name + string.quoted.single + patterns + + + include + #stringSingleQuotedEscape + + + + stringSingleQuotedEscape + + match + (')(?:') + captures + + 1 + + name + constant.character.escape + + + + stringDoubleQuoted + + begin + ((?<!\")\") + beginCaptures + + 1 + + name + punctuation.definition.string.begin + + + end + (\"(?!\")) + endCaptures + + 1 + + name + punctuation.definition.string.end + + + name + string.quoted.double + patterns + + + include + #stringEscapeChars + + + include + #variableWithoutMemberHighlighting + + + include + #subExpression + + + + stringSingleQuotedHeredoc + + begin + (\@'\s*$) + end + ^'\@ + name + string.quoted.single.heredoc + patterns + + + include + #stringSingleQuotedEscape + + + + stringDoubleQuotedHeredoc + + begin + (\@"\s*$) + end + ^"\@ + name + string.quoted.double.heredoc + patterns + + + include + #illegalVariable + + + include + #stringEscapeChars + + + include + #variableWithoutMemberHighlighting + + + include + #subExpression + + + include + #scriptBlock + + + + controlWords + + match + (\b(?<!-|\$)(?i:begin|process|exit|break|return|catch|finally|for|continue|foreach|throw|from|trap|try|do|if|until|in|using|else|elseif|while|end|where)\b(?!-|\.)) + name + keyword.control + + executableFiles + + comment + Executable files, like exe, com, cmd and bat + match + (\b(([\p{L}A-Za-z0-9\-_\.]+).(?i:exe|com|cmd|bat))\b) + name + support.executable + + enum + + captures + + 1 + + name + storage.type + + 2 + + name + entity.name.enum + + + comment + capture should be entity.name.type, but it doesn't provide a good color in the default schema. + match + (?<!\w|-)(?i:(enum))\s+(\w+)\s+ + + switch + + patterns + + + captures + + 1 + + name + keyword.control + + 2 + + name + variable.parameter + + 4 + + name + variable.parameter + + 5 + + name + variable.parameter + + + comment + switch [-regex|-wildcard|-exact][-casesensitive] -file filename + match + \b(?i:(switch))\b\s+(?i:(-regex|-wildcard|-exact){0,1})\s*(?i:(-casesensitive){0,1})\s*(?i:(-file))\s+ + + + captures + + 1 + + name + keyword.control + + 2 + + name + variable.parameter + + 3 + + name + variable.parameter + + + comment + switch [-regex|-wildcard|-exact][-casesensitive] (<value>) + match + \b(?i:(switch))\b\s+(?i:(-regex|-wildcard|-exact){0,1})\s*(?i:(-casesensitive){0,1})\s* + + + + defaultKeyword + + captures + + 0 + + name + keyword.other + + + comment + Default is a reserved word when used in Switch statements. This is kind of a work-around - it will highlight only inside scriptblocks. + match + (?i:(default))\s*(?=\{) + + redirection + + patterns + + + comment + Merging redirection + match + (?<=\s|^)([2-6\*]?>&1) + name + keyword.operator.redirection + + + comment + File redirection + match + (?<=\s|^)(([1-6\*]?>{1,2})|(<)) + name + keyword.operator.redirection + + + + function + + begin + (?<!\S)(?i)(function|filter|workflow|configuration)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+) + beginCaptures + + 0 + + name + meta.function + + 1 + + name + keyword.other + + 2 + + name + storage.modifier.scope + + 3 + + name + entity.name.function + + + end + \{|\( + patterns + + + include + #lineComment + + + + arrayDeclaration + + begin + (\@?\() + beginCaptures + + 0 + + name + punctuation.section.parens.begin + + + end + (\))(\.)*(([\w"']+)*) + endCaptures + + 1 + + name + punctuation.section.parens.end + + 2 + + name + punctuation.accessor + + 3 + + name + variable.other.member + + + patterns + + + include + $self + + + + hashTable + + begin + (@\{) + beginCaptures + + 1 + + name + punctuation.section.braces.begin + + + end + (\}) + endCaptures + + 1 + + name + punctuation.section.braces.end + + + name + meta.hashtable + patterns + + + include + $self + + + + scriptBlock + + begin + (\{) + beginCaptures + + 1 + + name + punctuation.section.braces.begin + + + end + (\}) + endCaptures + + 1 + + name + punctuation.section.braces.end + + + name + meta.scriptblock + patterns + + + include + $self + + + include + #defaultKeyword + + + + subExpression + + begin + (\$\() + beginCaptures + + 1 + + name + punctuation.section.parens.begin + + + end + (\)) + endCaptures + + 1 + + name + punctuation.section.parens.end + + + name + meta.subexpression + patterns + + + include + $self + + + + splatting + + match + (@)(\w+) + captures + + 1 + + name + punctuation.definition.variable + + 2 + + name + variable.other.readwrite + + + + illegalBacktick + + comment + Any characters (other than new line) after a back-tick, is illegal in PowerShell. + match + (`(?!$)) + name + invalid.illegal + + illegalVariable + + match + \$\w+:\s + name + invalid.illegal + + commandParameter + + patterns + + + comment + -Parameter value + match + \s(-\w+)(:)? + name + variable.parameter + + + + commands + + patterns + + + begin + (?<!\\)\b((?i:(Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write))-(\w+))\b(?!\.|\\) + beginCaptures + + 1 + + name + support.function + + + comment + Generic function match based on Verb-Noun pair using list of approved verbs. + end + ((?=\))|(?=\})|(?<!`)\n|(?<!`)\r|(\|)) + endCaptures + + 2 + + name + keyword.operator + + + name + meta.command + patterns + + + include + #scriptblock + + + include + #commandParameter + + + include + #lineComment + + + include + #redirection + + + include + #numericConstant + + + include + #operators + + + include + #variable + + + include + #stringDoubleQuoted + + + include + #stringSingleQuoted + + + include + #arrayDeclaration + + + include + #illegalBacktick + + + include + #illegalVariable + + + include + #splatting + + + + + begin + (?<!\\)\b(?i:foreach-object|tee-object|where-object|sort-object)\b(?!\.|\\) + beginCaptures + + 0 + + name + support.function + + + comment + Built-in commands that don't adhere to the approved verbs standard. + end + ((?=\))|(?=\})|(?<!`)\n|(?<!`)\r|(\|)) + endCaptures + + 2 + + name + keyword.operator + + + name + meta.command + patterns + + + include + #scriptblock + + + include + #commandParameter + + + include + #lineComment + + + include + #redirection + + + include + #numericConstant + + + include + #operators + + + include + #variable + + + include + #stringDoubleQuoted + + + include + #stringSingleQuoted + + + include + #arrayDeclaration + + + include + #illegalBacktick + + + include + #illegalVariable + + + + + begin + (?<!\\|\[)\b(?i:ac|asnp|cat|cd|cfs|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|curl|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fhx|fl|ft|fw|gal|gbp|gc|gcb|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|gpv|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|scb|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|wget|wjb|write|where)\b(?!\.|\\|\]) + beginCaptures + + 0 + + name + support.function + + + comment + Built-in aliases + end + ((?=\))|(?=\})|(?<!`)\n|(?<!`)\r|(\|)) + endCaptures + + 2 + + name + keyword.operator + + + name + meta.command + patterns + + + include + #scriptblock + + + include + #commandParameter + + + include + #lineComment + + + include + #redirection + + + include + #numericConstant + + + include + #operators + + + include + #variable + + + include + #stringDoubleQuoted + + + include + #stringSingleQuoted + + + include + #arrayDeclaration + + + include + #illegalBacktick + + + include + #illegalVariable + + + + + begin + (\b(([A-Za-z0-9\-_\.]+).(?i:ps1))\b) + beginCaptures + + 0 + + name + support.function + + + comment + External script + end + ((?=\))|(?=\})|(?<!`)\n|(?<!`)\r|(\|)) + endCaptures + + 2 + + name + keyword.operator + + + name + meta.command + patterns + + + include + #scriptblock + + + include + #commandParameter + + + include + #lineComment + + + include + #redirection + + + include + #numericConstant + + + include + #operators + + + include + #variable + + + include + #stringDoubleQuoted + + + include + #stringSingleQuoted + + + include + #arrayDeclaration + + + include + #illegalBacktick + + + include + #illegalVariable + + + + + + class + + begin + (?i)(?=\bclass\b) + end + (?<=\}) + patterns + + + begin + (?i)\b(class)\b\s+\n*((?:\p{L}|\d|_|-|\.)+)(?:\s*(:)\s*((?:\p{L}|\d|_|-|\.)+))? + beginCaptures + + 1 + + name + keyword.other + + 2 + + name + entity.name.class + + 3 + + name + punctuation.accessor + + 4 + + name + storage.type + + + end + (?=\{) + patterns + + + include + #lineComment + + + include + #blockComment + + + + + begin + \{ + beginCaptures + + 0 + + name + punctuation.section.braces.open + + + end + \} + endCaptures + + 0 + + name + punctuation.section.braces.close + + + patterns + + + include + $self + + + include + #classBaseKeyword + + + include + #classReservedWords + + + + + + classBaseKeyword + + captures + + 1 + + name + keyword.operator + + 2 + + name + keyword.control.class + + + comment + The base keyword used in classes. + match + (:)\s*(?i:(base))\s*(?=\() + + classReservedWords + + comment + Reserved words for classes. + match + \b(?i:(hidden|static))\b + name + keyword.other + + commentEmbeddedDocs + + patterns + + + captures + + 1 + + name + keyword.operator.documentation + + 2 + + name + keyword.operator.documentation + + + match + (?i:(\.)(SYNOPSIS|DESCRIPTION|EXAMPLE|INPUTS|OUTPUTS|NOTES|LINK|COMPONENT|FUNCTIONALITY|ROLE)\b) + name + comment.block.documentation + + + captures + + 1 + + name + keyword.operator.documentation + + 2 + + name + keyword.operator.documentation + + 3 + + name + constant.string.documentation + + + match + (?i:(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+(.+)) + name + comment.block.documentation + + + captures + + 1 + + name + keyword.operator.documentation + + 2 + + name + constant.string.documentation + + + comment + Requires -Version + match + (?i:(requires))\s(-(?i:version)\s\d+(\.\d+)?) + name + comment.block.documentation + + + captures + + 1 + + name + keyword.operator.documentation + + 2 + + name + constant.string.documentation + + + comment + Requires -PSSnapin + match + (?i:(requires))\s(-(?i:pssnapin)\s\w+(\s*-(?i:version)\s\d+(\.\d+)?)?) + name + comment.block.documentation + + + captures + + 1 + + name + keyword.operator.documentation + + 2 + + name + constant.string.documentation + + + comment + Requires -Modules + match + (?i:(requires))\s(-(?i:modules)\s.*) + name + comment.block.documentation + + + captures + + 1 + + name + keyword.operator.documentation + + 2 + + name + constant.string.documentation + + + comment + Requires -ShellId + match + (?i:(requires))\s(-(?i:shellid)\s.*) + name + comment.block.documentation + + + captures + + 1 + + name + keyword.operator.documentation + + 2 + + name + constant.string.documentation + + + comment + Requires -RunAsAdministrator + match + (?i:(requires))\s(-(?i:runasadministrator)) + name + comment.block.documentation + + + + numericConstant + + patterns + + + comment + Real [(+|-)] digits . digits [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)] + match + (?<!\w)([-+]?)\d+\.\d+(?i:e(\+|-){0,1}\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d) + name + constant.numeric.real + + + comment + Real [(+|-)] . digits [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)] + match + (?<!\.|\d|\w)([-+]?)\.\d+(?i:e(\+|-){0,1}\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d) + name + constant.numeric.real + + + comment + Real [(+|-)] digits . [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)] + match + (?<!\w)([-+]?)(?<!\d)\d+\.(?i:e(\+|-){0,1}\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d|\.) + name + constant.numeric.real + + + comment + Integer [(+|-)] digits [(d|l)] [(kb|mb|gb|tb|pb)] + match + (?<!\w|\w\.)([-+]?)\d+(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d) + name + constant.numeric.integer + + + comment + Real [(+|-)] digits [e [(+|-)] digits] [(d|l)] [(kb|mb|gb|tb|pb)] + match + (?<!\w|\.)([-+]?)(?<!\d)\d+(?i:e(\+|-){0,1}\d+){0,1}(?i:d|l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d|\.) + name + constant.numeric.real + + + comment + Hexadecimal 0x 0-f [l] [kb|mb|gb|tb|pb] + match + (?<!\w|\d)([-+]?)(?i:0x)(?i:[0-9a-f])+(?i:l){0,1}(?i:kb|mb|gb|tb|pb){0,1}(?!\w|\d) + name + constant.numeric.hex + + + + operators + + patterns + + + comment + Comparison + match + (?<=\d|\s|^)-(?i:as|is|isnot|in|notin|join|((c|i)?(eq|ne|gt|lt|ge|le|like|notlike|split|replace|contains|notcontains|match|notmatch))|shl|shr)\b(?!\.|\\) + name + keyword.operator.comparison + + + comment + Bitwise + match + (?<=\d|\s|^)-(?i:band|bor|bxor|bnot|shr|shl)\b + name + keyword.operator.bitwise + + + comment + Logical + match + (?<=\d|\s|^)-(?i:and|or|xor)\b + name + keyword.operator.logical + + + comment + Format + match + (?<=\d|\s|^)-(?i:f)\b + name + keyword.operator.format + + + comment + Assignment + match + (=|-=|\+=|\*=|/=|%=) + name + keyword.operator.assignment + + + comment + Logical NOT + match + (?<=\d|\s|^|\()((?i:-not)|!) + name + keyword.operator.unary.logical-not + + + comment + Multiplicative + match + ([*/%])(?!\.) + name + keyword.operator.multiplicative + + + comment + Increment Operator + match + (\+\+) + name + keyword.operator.increment + + + comment + Decrement Operator + match + (--) + name + keyword.operator.decrement + + + comment + Unary Plus + match + ([+](?=\$|\(|")) + name + keyword.operator.unary-plus + + + comment + Unary Minus + match + ([-](?=\$|\(|")) + name + keyword.operator.unary-minus + + + comment + Additive + match + ([+-])(?!\{|\p{L}|@) + name + keyword.operator.additive + + + comment + Range + match + (\.\.) + name + keyword.operator.range + + + comment + Command invocation (Call) + match + (&|\|) + name + keyword.operator.other + + + + type + + begin + \[ + beginCaptures + + 0 + + name + punctuation.section.brackets.begin + + + comment + Type [] + end + (\])(?:(::)([\w]+))*(?:(?:(\.)([\w"']+))*) + endCaptures + + 1 + + name + punctuation.section.brackets.end + + 2 + + name + punctuation.accessor + + 3 + + name + meta.method + + 4 + + name + punctuation.accessor + + 5 + + name + entity.other.attribute-name + + + patterns + + + include + #variableWithoutMemberHighlighting + + + include + $self + + + comment + Reserved words + match + (?i)\b(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength)\b + name + entity.other.attribute-name + + + begin + \( + beginCaptures + + 0 + + name + punctuation.section.parens.begin + + + comment + Parenthesis () + end + \) + endCaptures + + 0 + + name + punctuation.section.parens.end + + + patterns + + + include + $self + + + comment + Reserved words within [( )] + match + (?i)\b(mandatory|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|position|parametersetname|defaultparametersetname|supportsshouldprocess|positionalbinding|helpuri|confirmimpact|helpmessage)\b + name + variable.other.member + + + + + match + (?:([\w]+)((`){0,2}(\d){0,2})?) + name + entity.name.type + + + + variable + + begin + (?=\$) + beginCaptures + + 1 + + name + punctuation.definition.variable + + + end + (?=\s|\)) + patterns + + + include + #type + + + include + #operators + + + comment + Invalid variable name + match + (\$)(\w+-\w+)\b + name + invalid.illegal + + + comment + built-in variables; $args + 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 + punctuation.definition.variable + + 2 + + name + variable.language + + + + + comment + built-in variables; ${args} + 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 + punctuation.definition.variable + + 2 + + name + punctuation.definition.variable + + 3 + + name + variable.language + + 4 + + name + punctuation.definition.variable + + + + + comment + variable method + begin + (\.)([\w\-@#]+)(\() + beginCaptures + + 1 + + name + punctuation.accessor + + 2 + + name + variable.other.member + + 3 + + name + punctuation.block.parens.start + + + end + (\)) + endCaptures + + 1 + + name + punctuation.block.parens.end + + + patterns + + + include + $self + + + + + comment + variable member with double quotes + begin + (\.)(?=") + beginCaptures + + 1 + + name + punctuation.accessor + + 2 + + name + punctuation.definition.string.begin + + + end + (?<=") + endCaptures + + 1 + + name + punctuation.definition.string.end + + + patterns + + + include + #stringDoubleQuoted + + + + + comment + variable member with single quotes + begin + (\.)(?=') + beginCaptures + + 1 + + name + punctuation.accessor + + 2 + + name + punctuation.definition.string.begin + + + end + (?<=') + endCaptures + + 1 + + name + punctuation.definition.string.end + + + patterns + + + include + #stringSingleQuoted + + + + + comment + variable member + match + (\.)([\w\-@#]+) + captures + + 1 + + name + punctuation.accessor + + 2 + + name + variable.other.member + + + + + comment + $var, $local:var + match + (\$)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?([\w?]+)(:\w+)? + captures + + 1 + + name + punctuation.definition.variable + + 2 + + name + storage.modifier.scope + + 3 + + name + variable.other.readwrite + + 4 + + name + variable.other.readwrite + + + + + comment + ${var}, ${local:var} + match + (\$)(\{)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?([\w?`{}-]+)(:\w+)?(\}) + captures + + 1 + + name + punctuation.definition.variable + + 2 + + name + punctuation.definition.variable + + 3 + + name + storage.modifier.scope + + 4 + + name + variable.other.readwrite + + 5 + + name + variable.other.readwrite + + 6 + + name + punctuation.definition.variable + + + + + + variableWithoutMemberHighlighting + + patterns + + + comment + Invalid variable name + match + (\$)(\w+-\w+)\b + name + invalid.illegal + + + captures + + 1 + + name + punctuation.definition.variable + + 2 + + name + variable.language + + + 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 + punctuation.definition.variable + + 2 + + name + storage.modifier.scope + + 3 + + name + variable.other.readwrite + + 4 + + name + variable.other.readwrite + + + comment + $var, $local:var + match + (\$)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?([\w?]+)(:\w+)? + + + captures + + 1 + + name + punctuation.definition.variable + + 2 + + name + punctuation.definition.variable + + 3 + + name + storage.modifier.scope + + 4 + + name + variable.other.readwrite + + 5 + + name + punctuation.definition.variable + + + comment + ${var}, ${script:var} + match + (\$)(\{)((?i:global|local|script|private|using|env|function|alias|cert|variable|hkcu|hklm|wsman):)?(.+?)(\}) + + + captures + + 1 + + name + punctuation.definition.variable + + 2 + + name + variable.other.readwrite + + + comment + Splatting + match + (@)(\w+) + + + + + scopeName + source.powershell + uuid + 3af8c7dd-6c15-40d4-a28b-c6a3105a39c7 + + \ No newline at end of file diff --git a/installDevTheme.ps1 b/installDevTheme.ps1 new file mode 100644 index 0000000..a2cda3d --- /dev/null +++ b/installDevTheme.ps1 @@ -0,0 +1,4 @@ +$sourcePath = '.\themes\theme-psise\theme.json' +$destinationPath = Join-Path -Path $env:USERPROFILE -ChildPath .vscode\extensions\ms-vscode.powershell-*\themes\theme-psise +Copy-Item -Path $sourcePath -Destination (Resolve-Path -Path $destinationPath) -Force +Write-Host 'Installed ISE Dev Theme' \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8963d07 --- /dev/null +++ b/package.json @@ -0,0 +1,53 @@ +{ + "name": "powershelleditorsyntax", + "version": "2.0.0", + "description": "PowerShell Editor Syntax", + "private": true, + "keywords": [ + "grammar", + "syntax", + "powershell", + "vscode", + "Visual Studio Code", + "Atom", + "Sublime", + "Sublime Text", + "SublimeText", + "tmLanguage", + "TextMate" + ], + "homepage": "https://github.com/PowerShell/EditorSyntax", + "repository": { + "type": "git", + "url": "https://github.com/PowerShell/EditorSyntax" + }, + "bugs": { + "url": "https://github.com/PowerShell/EditorSyntax/issues" + }, + "scripts": { + "test": "node test.js", + "build": "node build.js", + "postbuild": "node test.js" + }, + "contributors": [ + { + "name": "David Wilson", + "url": "http://twitter.com/daviwil" + }, + { + "name": "Sergei Vorobev", + "url": "https://twitter.com/xvorsx" + }, + { + "name": "Øyvind Kallstad", + "url": "https://twitter.com/okallstad" + } + ], + "license": "MIT", + "dependencies": { + "cson": "^4.1.0", + "js-yaml": "^3.9.1", + "plist": "^2.1.0", + "vscode-textmate": "^3.1.5" + } +} diff --git a/refTest.yaml b/refTest.yaml new file mode 100644 index 0000000..e9fa18b --- /dev/null +++ b/refTest.yaml @@ -0,0 +1,4256 @@ +lines: + - line: '# Line comment' + tokens: + - token: '#' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: ' Line comment' + scopes: + - source.powershell + - comment.line + - line: '<#' + tokens: + - token: '<#' + scopes: + - source.powershell + - comment.block + - punctuation.definition.comment + - line: ' Block comment' + tokens: + - token: ' Block comment' + scopes: + - source.powershell + - comment.block + - line: '#>' + tokens: + - token: '#>' + scopes: + - source.powershell + - comment.block + - punctuation.definition.comment + - line: '''Single Quoted string''' + tokens: + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Single Quoted string + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: '"Double Quoted string"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: Double Quoted string + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '7' + tokens: + - token: '7' + scopes: + - source.powershell + - constant.numeric.integer + - line: '-10lkb' + tokens: + - token: '-10lkb' + scopes: + - source.powershell + - constant.numeric.integer + - line: '0x9' + tokens: + - token: '0x9' + scopes: + - source.powershell + - constant.numeric.hex + - line: 0x25l + tokens: + - token: 0x25l + scopes: + - source.powershell + - constant.numeric.hex + - line: '-999e-10dmb' + tokens: + - token: '-999e-10dmb' + scopes: + - source.powershell + - constant.numeric.real + - line: +6.e-6lkb + tokens: + - token: +6.e-6lkb + scopes: + - source.powershell + - constant.numeric.real + - line: +.6 + tokens: + - token: +.6 + scopes: + - source.powershell + - constant.numeric.real + - line: '-.9e+5dmb' + tokens: + - token: '-.9e+5dmb' + scopes: + - source.powershell + - constant.numeric.real + - line: .6tb + tokens: + - token: .6tb + scopes: + - source.powershell + - constant.numeric.real + - line: +4.9e+5dmb + tokens: + - token: +4.9e+5dmb + scopes: + - source.powershell + - constant.numeric.real + - line: '4.5' + tokens: + - token: '4.5' + scopes: + - source.powershell + - constant.numeric.real + - line: '-9.9' + tokens: + - token: '-9.9' + scopes: + - source.powershell + - constant.numeric.real + - line: '+7.4' + tokens: + - token: '+7.4' + scopes: + - source.powershell + - constant.numeric.real + - line: $myVariable + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: $my-Variable + tokens: + - token: $my-Variable + scopes: + - source.powershell + - invalid.illegal + - line: '$local:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'local:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$global:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'global:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$script:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'script:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$private:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'private:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$using:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'using:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$env:COMPUTERNAME' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'env:' + scopes: + - source.powershell + - storage.modifier.scope + - token: COMPUTERNAME + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Function:help' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Function:' + scopes: + - source.powershell + - storage.modifier.scope + - token: help + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Alias:cat' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Alias:' + scopes: + - source.powershell + - storage.modifier.scope + - token: cat + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Cert:myCert' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Cert:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myCert + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Variable:ast' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Variable:' + scopes: + - source.powershell + - storage.modifier.scope + - token: ast + scopes: + - source.powershell + - variable.other.readwrite + - line: '$HKCU:System' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKCU:' + scopes: + - source.powershell + - storage.modifier.scope + - token: System + scopes: + - source.powershell + - variable.other.readwrite + - line: '$HKLM:System' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKLM:' + scopes: + - source.powershell + - storage.modifier.scope + - token: System + scopes: + - source.powershell + - variable.other.readwrite + - line: '$WSMan:localhost' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'WSMan:' + scopes: + - source.powershell + - storage.modifier.scope + - token: localhost + scopes: + - source.powershell + - variable.other.readwrite + - line: '${myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${my-Variable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: my-Variable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${local:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'local:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${global:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'global:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${script:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'script:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${private:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'private:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${using:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'using:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${env:COMPUTERNAME}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'env:' + scopes: + - source.powershell + - storage.modifier.scope + - token: COMPUTERNAME + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Function:help}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Function:' + scopes: + - source.powershell + - storage.modifier.scope + - token: help + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Alias:cat}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Alias:' + scopes: + - source.powershell + - storage.modifier.scope + - token: cat + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Cert:myCert}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Cert:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myCert + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Variable:ast}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Variable:' + scopes: + - source.powershell + - storage.modifier.scope + - token: ast + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${HKCU:System}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKCU:' + scopes: + - source.powershell + - storage.modifier.scope + - token: System + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${HKLM:System}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKLM:' + scopes: + - source.powershell + - storage.modifier.scope + - token: System + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${WSMan:localhost}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'WSMan:' + scopes: + - source.powershell + - storage.modifier.scope + - token: localhost + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: 'command.exe $par1 --% $par2 #comment' + tokens: + - token: command.exe + scopes: + - source.powershell + - support.executable + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: par1 + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '--%' + scopes: + - source.powershell + - keyword.operator + - token: ' ' + scopes: + - source.powershell + - source.powershell + - token: $ + scopes: + - source.powershell + - source.powershell + - token: p + scopes: + - source.powershell + - source.powershell + - token: a + scopes: + - source.powershell + - source.powershell + - token: r + scopes: + - source.powershell + - source.powershell + - token: '2' + scopes: + - source.powershell + - source.powershell + - token: ' #' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: comment + scopes: + - source.powershell + - comment.line + - line: command.execute + tokens: + - token: command.execute + scopes: + - source.powershell + - line: $$ + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: $ + scopes: + - source.powershell + - variable.language + - line: '''''''str''''ing''' + tokens: + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - constant.character.escape + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - token: str + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - constant.character.escape + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - token: ing + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: 'enum myEnum {}' + tokens: + - token: enum + scopes: + - source.powershell + - storage.type + - token: ' ' + scopes: + - source.powershell + - token: myEnum + scopes: + - source.powershell + - entity.name.enum + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.begin + - token: '}' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.end + - line: '@(1,2,3)' + tokens: + - token: '@(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '(1,2,3)' + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '(1,2,3).Count' + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: Count + scopes: + - source.powershell + - variable.other.member + - line: '@{1 = 1}' + tokens: + - token: '@{' + scopes: + - source.powershell + - meta.hashtable + - punctuation.section.braces.begin + - token: '1' + scopes: + - source.powershell + - meta.hashtable + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - meta.hashtable + - token: = + scopes: + - source.powershell + - meta.hashtable + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - meta.hashtable + - token: '1' + scopes: + - source.powershell + - meta.hashtable + - constant.numeric.integer + - token: '}' + scopes: + - source.powershell + - meta.hashtable + - punctuation.section.braces.end + - line: '{}' + tokens: + - token: '{' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.begin + - token: '}' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.end + - line: '"$($subExpression)"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: $( + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.begin + - token: $ + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.definition.variable + - token: subExpression + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - variable.other.readwrite + - token: ) + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.end + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: Get-Service @par + tokens: + - token: Get-Service + scopes: + - source.powershell + - meta.command + - support.function + - token: ' ' + scopes: + - source.powershell + - meta.command + - token: '@' + scopes: + - source.powershell + - meta.command + - punctuation.definition.variable + - token: par + scopes: + - source.powershell + - meta.command + - variable.other.readwrite + - line: '$var:' + tokens: + - token: '$var:' + scopes: + - source.powershell + - invalid.illegal + - line: Write-Warning -Message "Warning" + tokens: + - token: Write-Warning + scopes: + - source.powershell + - meta.command + - support.function + - token: ' -Message' + scopes: + - source.powershell + - meta.command + - variable.parameter + - token: ' ' + scopes: + - source.powershell + - meta.command + - token: '"' + scopes: + - source.powershell + - meta.command + - string.quoted.double + - punctuation.definition.string.begin + - token: Warning + scopes: + - source.powershell + - meta.command + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - meta.command + - string.quoted.double + - punctuation.definition.string.end + - line: 'class myClass {}' + tokens: + - token: class + scopes: + - source.powershell + - keyword.other + - token: ' ' + scopes: + - source.powershell + - token: myClass + scopes: + - source.powershell + - entity.name.class + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - punctuation.section.braces.open + - token: '}' + scopes: + - source.powershell + - punctuation.section.braces.close + - line: '1 -is [int]' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-is' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: int + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '1 -as [string]' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-as' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '1 -isnot [int]' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-isnot' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: int + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '"c" -in [char[]]"abc"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: c + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-in' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: char + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: abc + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '"c" -notin [char[]]"abc"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: c + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-notin' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: char + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: abc + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '1,2 -join ";"' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-join' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: ; + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '1,2 -split ","' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-split' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: ',' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: 1 -eq 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -ne 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-ne' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -gt 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -lt 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-lt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -ge 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-ge' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -le 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-le' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -like 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-like' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -notlike 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-notlike' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '"abc" -replace("b","c")' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: abc + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-replace' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: b + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: c + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '1,2,3 -contains(2)' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-contains' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '1,2,3 -notcontains(2)' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-notcontains' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"a" -match("\w")' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: a + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-match' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: \w + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"a" -notmatch("\w")' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: a + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-notmatch' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: \w + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: 102 -shl 2 + tokens: + - token: '102' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-shl' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 102 -shr 2 + tokens: + - token: '102' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-shr' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 5 -band 3 + tokens: + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-band' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - line: '-bnot 5' + tokens: + - token: '-bnot' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - line: 5 -bor 0x03 + tokens: + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-bor' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '0x03' + scopes: + - source.powershell + - constant.numeric.hex + - line: 5 -bxor 3 + tokens: + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-bxor' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - line: (1 -gt 2) -and (2 -gt 1) + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ' ' + scopes: + - source.powershell + - token: '-and' + scopes: + - source.powershell + - keyword.operator.logical + - token: ' ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: (1 -gt 2) -or (2 -gt 1) + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ' ' + scopes: + - source.powershell + - token: '-or' + scopes: + - source.powershell + - keyword.operator.logical + - token: ' ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: (1 -eq 1) -xor (2 -eq 2) + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ' ' + scopes: + - source.powershell + - token: '-xor' + scopes: + - source.powershell + - keyword.operator.logical + - token: ' ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '-not (1 -eq 1)' + tokens: + - token: '-not' + scopes: + - source.powershell + - keyword.operator.unary.logical-not + - token: ' ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '!(1 -eq 1)' + tokens: + - token: '!' + scopes: + - source.powershell + - keyword.operator.unary.logical-not + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '{0} {1,-10} {2:N}' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-f' + scopes: + - source.powershell + - keyword.operator.format + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: hello + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: math + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '::' + scopes: + - source.powershell + - punctuation.accessor + - token: pi + scopes: + - source.powershell + - meta.method + - line: $a = 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a += 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: += + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a -= 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '-=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a *= 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '*=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a /= 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: /= + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a %= 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '%=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a++ + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ++ + scopes: + - source.powershell + - keyword.operator.increment + - line: ++$a + tokens: + - token: ++ + scopes: + - source.powershell + - keyword.operator.increment + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: $a-- + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: '--' + scopes: + - source.powershell + - keyword.operator.decrement + - line: '--$a' + tokens: + - token: '--' + scopes: + - source.powershell + - keyword.operator.decrement + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: 2*2 + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: '*' + scopes: + - source.powershell + - keyword.operator.multiplicative + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 2/2 + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: / + scopes: + - source.powershell + - keyword.operator.multiplicative + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 2+2 + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: + + scopes: + - source.powershell + - keyword.operator.additive + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 2-2 + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: '-' + scopes: + - source.powershell + - keyword.operator.additive + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: +$a + tokens: + - token: + + scopes: + - source.powershell + - keyword.operator.unary-plus + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: '-$a' + tokens: + - token: '-' + scopes: + - source.powershell + - keyword.operator.unary-minus + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: 1..4 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: .. + scopes: + - source.powershell + - keyword.operator.range + - token: '4' + scopes: + - source.powershell + - constant.numeric.integer + - line: '& $a' + tokens: + - token: '&' + scopes: + - source.powershell + - keyword.operator.other + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: '"$(Get-RandomString -length 10)@$(Get-RandomString -length 10).com"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: $( + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.begin + - token: Get-RandomString + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - support.function + - token: ' -length' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - variable.parameter + - token: ' ' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - token: '10' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.end + - token: '@' + scopes: + - source.powershell + - string.quoted.double + - token: $( + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.begin + - token: Get-RandomString + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - support.function + - token: ' -length' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - variable.parameter + - token: ' ' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - token: '10' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.end + - token: .com + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: $foo?bar + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: foo?bar + scopes: + - source.powershell + - variable.other.readwrite + - line: '${foo?bar}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: foo?bar + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '"$foo?bar"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: $ + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: foo?bar + scopes: + - source.powershell + - string.quoted.double + - variable.other.readwrite + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '"${foo?bar}"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: $ + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: foo?bar + scopes: + - source.powershell + - string.quoted.double + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: myScript.ps1 + tokens: + - token: myScript.ps1 + scopes: + - source.powershell + - meta.command + - support.function + - line: myScript.ps1notafile + tokens: + - token: myScript.ps1notafile + scopes: + - source.powershell + - line: file.exe + tokens: + - token: file.exe + scopes: + - source.powershell + - support.executable + - line: file.exenotafile + tokens: + - token: file.exenotafile + scopes: + - source.powershell + - line: file.com + tokens: + - token: file.com + scopes: + - source.powershell + - support.executable + - line: file.bat + tokens: + - token: file.bat + scopes: + - source.powershell + - support.executable + - line: file.batnotafile + tokens: + - token: file.batnotafile + scopes: + - source.powershell + - line: file.cmd + tokens: + - token: file.cmd + scopes: + - source.powershell + - support.executable + - line: file.cmdnotafile + tokens: + - token: file.cmdnotafile + scopes: + - source.powershell + - line: 'Function New-Function { #comment here' + tokens: + - token: Function + scopes: + - source.powershell + - meta.function + - keyword.other + - token: ' ' + scopes: + - source.powershell + - meta.function + - token: New-Function + scopes: + - source.powershell + - meta.function + - entity.name.function + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - token: ' #' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: comment here + scopes: + - source.powershell + - comment.line + - line: '}' + tokens: + - token: '}' + scopes: + - source.powershell + - line: 'Function New-Function #comment here' + tokens: + - token: Function + scopes: + - source.powershell + - meta.function + - keyword.other + - token: ' ' + scopes: + - source.powershell + - meta.function + - token: New-Function + scopes: + - source.powershell + - meta.function + - entity.name.function + - token: ' #' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: comment here + scopes: + - source.powershell + - comment.line + - line: '{' + tokens: + - token: '{' + scopes: + - source.powershell + - line: '}' + tokens: + - token: '}' + scopes: + - source.powershell + - line: '[Microsoft.Win32.RegistryKey]' + tokens: + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Microsoft + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Win32 + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: RegistryKey + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '$_.''#text''' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: _ + scopes: + - source.powershell + - variable.language + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: '#text' + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: $Whatever.Name -match "Id" + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Whatever + scopes: + - source.powershell + - variable.other.readwrite + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: Name + scopes: + - source.powershell + - variable.other.member + - token: ' ' + scopes: + - source.powershell + - token: '-match' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: Id + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: $Whatever.Name -match ".*Id" + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Whatever + scopes: + - source.powershell + - variable.other.readwrite + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: Name + scopes: + - source.powershell + - variable.other.member + - token: ' ' + scopes: + - source.powershell + - token: '-match' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: .*Id + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: Add-Something + tokens: + - token: Add-Something + scopes: + - source.powershell + - meta.command + - support.function + - line: 'Add-Something {}' + tokens: + - token: Add-Something + scopes: + - source.powershell + - meta.command + - support.function + - token: ' {' + scopes: + - source.powershell + - meta.command + - token: '}' + scopes: + - source.powershell + - line: (Add-Something).method() + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: Add-Something + scopes: + - source.powershell + - meta.command + - support.function + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: method + scopes: + - source.powershell + - variable.other.member + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: Add-Something -Parameter1 value -Parameter2 value | Add-SomethingElse + tokens: + - token: Add-Something + scopes: + - source.powershell + - meta.command + - support.function + - token: ' -Parameter1' + scopes: + - source.powershell + - meta.command + - variable.parameter + - token: ' value' + scopes: + - source.powershell + - meta.command + - token: ' -Parameter2' + scopes: + - source.powershell + - meta.command + - variable.parameter + - token: ' value ' + scopes: + - source.powershell + - meta.command + - token: '|' + scopes: + - source.powershell + - meta.command + - keyword.operator + - token: ' ' + scopes: + - source.powershell + - token: Add-SomethingElse + scopes: + - source.powershell + - meta.command + - support.function + - line: 'function Invoke-Test {' + tokens: + - token: function + scopes: + - source.powershell + - meta.function + - keyword.other + - token: ' ' + scopes: + - source.powershell + - meta.function + - token: Invoke-Test + scopes: + - source.powershell + - meta.function + - entity.name.function + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - line: ' [CmdletBinding(ConfirmImpact="High", DefaultParameterSetName = "Name", HelpUri = "https://my.help.io", SupportsShouldProcess = $true, SupportsPaging = $true, PositionalBinding = $true)]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: CmdletBinding + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ConfirmImpact + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: High + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', DefaultParameterSetName ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: Name + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', HelpUri ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'https://my.help.io' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', SupportsShouldProcess ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ',' + scopes: + - source.powershell + - token: ' SupportsPaging ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ',' + scopes: + - source.powershell + - token: ' PositionalBinding ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [OutputType("System.Int32", ParameterSetName="ID")]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: OutputType + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: System.Int32 + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', ParameterSetName' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: ID + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [OutputType([String], ParameterSetName="Name")]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: OutputType + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: String + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ', ParameterSetName' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: Name + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' param (' + tokens: + - token: ' param ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - line: ' [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName, ParameterSetName = ''Name'')]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Parameter + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: 'ValueFromPipeline ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ',' + scopes: + - source.powershell + - token: ' ValueFromPipelineByPropertyName, ParameterSetName ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Name + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateLength(1,25)]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateLength + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '25' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string] $Name,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Name + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [ValidatePattern("[0-9][0-9][0-9][0-9]")]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidatePattern + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '[0-9][0-9][0-9][0-9]' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateNotNull()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateNotNull + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string] $ComputerId,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: ComputerId + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [Parameter(Position = 0, ValueFromRemainingArguments, HelpMessage = ''User ID'')]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Parameter + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: 'Position ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '0' + scopes: + - source.powershell + - constant.numeric.integer + - token: ', ValueFromRemainingArguments, HelpMessage ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: User ID + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [Alias(''UserId'',''UID'')]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Alias + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: UserId + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: UID + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateRange(1,999)]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateRange + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '999' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [int32] $Id,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: int32 + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Id + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [AllowNull()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: AllowNull + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [int] $State,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: int + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: State + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [AllowEmptyString()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: AllowEmptyString + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string] $Message,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Message + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [ValidateCount(1,9)]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateCount + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '9' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateNotNullOrEmpty()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateNotNullOrEmpty + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string[]] $NewCollection,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: NewCollection + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [AllowEmptyCollection()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: AllowEmptyCollection + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateSet(''Basic'',''Pro'',''Gold'')]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateSet + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Basic + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Pro + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Gold + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string[]] $OldCollection,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: OldCollection + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [Parameter()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Parameter + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateScript({$_ -ge (get-date)})]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateScript + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '{' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.begin + - token: $ + scopes: + - source.powershell + - meta.scriptblock + - punctuation.definition.variable + - token: _ + scopes: + - source.powershell + - meta.scriptblock + - variable.language + - token: ' ' + scopes: + - source.powershell + - meta.scriptblock + - token: '-ge' + scopes: + - source.powershell + - meta.scriptblock + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - meta.scriptblock + - token: ( + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.parens.begin + - token: get-date + scopes: + - source.powershell + - meta.scriptblock + - meta.command + - support.function + - token: ) + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.parens.end + - token: '}' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [DateTime] $Date,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: DateTime + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Date + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [switch] $Force' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: switch + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Force + scopes: + - source.powershell + - variable.other.readwrite + - line: ' )' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '}' + tokens: + - token: '}' + scopes: + - source.powershell diff --git a/referenceFile-old.yaml b/referenceFile-old.yaml new file mode 100644 index 0000000..702afb7 --- /dev/null +++ b/referenceFile-old.yaml @@ -0,0 +1,3183 @@ +lines: + - line: '# Line comment' + tokens: + - token: '#' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: ' Line comment' + scopes: + - source.powershell + - comment.line + - line: '<#' + tokens: + - token: '<#' + scopes: + - source.powershell + - comment.block + - punctuation.definition.comment + - line: ' Block comment' + tokens: + - token: ' Block comment' + scopes: + - source.powershell + - comment.block + - line: '#>' + tokens: + - token: '#>' + scopes: + - source.powershell + - comment.block + - punctuation.definition.comment + - line: "'Single Quoted string'" + tokens: + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: 'Single Quoted string' + scopes: + - source.powershell + - string.quoted.single + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: '"Double Quoted string"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'Double Quoted string' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '7' + tokens: + - token: '7' + scopes: + - source.powershell + - constant.numeric.integer + - line: '-10lkb' + tokens: + - token: '-10lkb' + scopes: + - source.powershell + - constant.numeric.integer + - line: '0x9' + tokens: + - token: '0x9' + scopes: + - source.powershell + - constant.numeric.hex + - line: '0x25l' + tokens: + - token: '0x25l' + scopes: + - source.powershell + - constant.numeric.hex + - line: '-999e-10dmb' + tokens: + - token: '-999e-10dmb' + scopes: + - source.powershell + - constant.numeric.real + - line: '+6.e-6lkb' + tokens: + - token: '+6.e-6lkb' + scopes: + - source.powershell + - constant.numeric.real + - line: '+.6' + tokens: + - token: '+.6' + scopes: + - source.powershell + - constant.numeric.real + - line: '-.9e+5dmb' + tokens: + - token: '-.9e+5dmb' + scopes: + - source.powershell + - constant.numeric.real + - line: '.6tb' + tokens: + - token: '.6tb' + scopes: + - source.powershell + - constant.numeric.real + - line: '+4.9e+5dmb' + tokens: + - token: '+4.9e+5dmb' + scopes: + - source.powershell + - constant.numeric.real + - line: '4.5' + tokens: + - token: '4.5' + scopes: + - source.powershell + - constant.numeric.real + - line: '-9.9' + tokens: + - token: '-9.9' + scopes: + - source.powershell + - constant.numeric.real + - line: '+7.4' + tokens: + - token: '+7.4' + scopes: + - source.powershell + - constant.numeric.real + - line: '$myVariable' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$my-Variable' + tokens: + - token: '$my-Variable' + scopes: + - source.powershell + - invalid.illegal + - line: '$local:myVariable' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'local:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$global:myVariable' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'global:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$script:myVariable' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'script:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$private:myVariable' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'private:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$using:myVariable' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'using:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$env:COMPUTERNAME' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'env:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'COMPUTERNAME' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Function:help' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Function:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'help' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Alias:cat' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Alias:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'cat' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Cert:myCert' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Cert:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myCert' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Variable:ast' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Variable:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'ast' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$HKCU:System' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKCU:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'System' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$HKLM:System' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKLM:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'System' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$WSMan:localhost' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'WSMan:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'localhost' + scopes: + - source.powershell + - variable.other.readwrite + - line: '${myVariable}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${my-Variable}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'my-Variable' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${local:myVariable}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'local:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${global:myVariable}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'global:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${script:myVariable}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'script:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${private:myVariable}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'private:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${using:myVariable}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'using:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myVariable' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${env:COMPUTERNAME}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'env:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'COMPUTERNAME' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Function:help}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Function:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'help' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Alias:cat}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Alias:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'cat' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Cert:myCert}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Cert:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'myCert' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Variable:ast}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Variable:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'ast' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${HKCU:System}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKCU:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'System' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${HKLM:System}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKLM:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'System' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${WSMan:localhost}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'WSMan:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'localhost' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: 'command.exe $par1 --% $par2 #comment' + tokens: + - token: 'command.exe' + scopes: + - source.powershell + - support.executable + - token: ' ' + scopes: + - source.powershell + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'par1' + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '--%' + scopes: + - source.powershell + - keyword.operator + - token: ' ' + scopes: + - source.powershell + - source.powershell + - token: '$' + scopes: + - source.powershell + - source.powershell + - token: 'p' + scopes: + - source.powershell + - source.powershell + - token: 'a' + scopes: + - source.powershell + - source.powershell + - token: 'r' + scopes: + - source.powershell + - source.powershell + - token: '2' + scopes: + - source.powershell + - source.powershell + - token: ' #' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: 'comment' + scopes: + - source.powershell + - comment.line + - line: '$$' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '$' + scopes: + - source.powershell + - variable.language + - line: "'''str''ing'" + tokens: + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - constant.character.escape + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - token: 'str' + scopes: + - source.powershell + - string.quoted.single + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - constant.character.escape + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - token: 'ing' + scopes: + - source.powershell + - string.quoted.single + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: 'command.execute' + tokens: + - token: 'command.execute' + scopes: + - source.powershell + - line: 'enum myEnum {}' + tokens: + - token: 'enum' + scopes: + - source.powershell + - storage.type + - token: ' ' + scopes: + - source.powershell + - token: 'myEnum' + scopes: + - source.powershell + - entity.name.enum + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.begin + - token: '}' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.end + - line: '@(1,2,3)' + tokens: + - token: '@(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '(1,2,3)' + tokens: + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '(1,2,3).Count' + tokens: + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - token: '.' + scopes: + - source.powershell + - punctuation.accessor + - token: 'Count' + scopes: + - source.powershell + - variable.other.member + - line: '@{1 = 1}' + tokens: + - token: '@{' + scopes: + - source.powershell + - meta.hashtable + - punctuation.section.braces.begin + - token: '1' + scopes: + - source.powershell + - meta.hashtable + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - meta.hashtable + - token: '=' + scopes: + - source.powershell + - meta.hashtable + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - meta.hashtable + - token: '1' + scopes: + - source.powershell + - meta.hashtable + - constant.numeric.integer + - token: '}' + scopes: + - source.powershell + - meta.hashtable + - punctuation.section.braces.end + - line: '{}' + tokens: + - token: '{' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.begin + - token: '}' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.end + - line: '"$($subExpression)"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '$(' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.begin + - token: '$' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.definition.variable + - token: 'subExpression' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - variable.other.readwrite + - token: ')' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.end + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: 'Get-Service @par' + tokens: + - token: 'Get-Service' + scopes: + - source.powershell + - meta.command + - support.function + - token: ' ' + scopes: + - source.powershell + - meta.command + - token: '@' + scopes: + - source.powershell + - meta.command + - punctuation.definition.variable + - token: 'par' + scopes: + - source.powershell + - meta.command + - variable.other.readwrite + - line: '$var:' + tokens: + - token: '$var:' + scopes: + - source.powershell + - invalid.illegal + - line: 'Write-Warning -Message "Warning"' + tokens: + - token: 'Write-Warning' + scopes: + - source.powershell + - meta.command + - support.function + - token: ' -Message' + scopes: + - source.powershell + - meta.command + - variable.parameter + - token: ' ' + scopes: + - source.powershell + - meta.command + - token: '"' + scopes: + - source.powershell + - meta.command + - string.quoted.double + - punctuation.definition.string.begin + - token: 'Warning' + scopes: + - source.powershell + - meta.command + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - meta.command + - string.quoted.double + - punctuation.definition.string.end + - line: 'class myClass {}' + tokens: + - token: 'class' + scopes: + - source.powershell + - keyword.other + - token: ' ' + scopes: + - source.powershell + - token: 'myClass' + scopes: + - source.powershell + - entity.name.class + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - punctuation.section.braces.open + - token: '}' + scopes: + - source.powershell + - punctuation.section.braces.close + - line: '1 -is [int]' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-is' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: 'int' + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '1 -as [string]' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-as' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: 'string' + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '1 -isnot [int]' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-isnot' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: 'int' + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '"c" -in [char[]]"abc"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'c' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-in' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: 'char' + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'abc' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '"c" -notin [char[]]"abc"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'c' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-notin' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: 'char' + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'abc' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '1,2 -join ";"' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-join' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: ';' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '1,2 -split ","' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-split' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: ',' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '1 -eq 2' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '1 -ne 2' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-ne' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '1 -gt 2' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '1 -lt 2' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-lt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '1 -ge 2' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-ge' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '1 -le 2' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-le' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '1 -like 2' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-like' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '1 -notlike 2' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-notlike' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '"abc" -replace("b","c")' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'abc' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-replace' + scopes: + - source.powershell + - keyword.operator.comparison + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'b' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'c' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '1,2,3 -contains(2)' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-contains' + scopes: + - source.powershell + - keyword.operator.comparison + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '1,2,3 -notcontains(2)' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-notcontains' + scopes: + - source.powershell + - keyword.operator.comparison + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"a" -match("\w")' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'a' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-match' + scopes: + - source.powershell + - keyword.operator.comparison + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '\w' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"a" -notmatch("\w")' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'a' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-notmatch' + scopes: + - source.powershell + - keyword.operator.comparison + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '\w' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '102 -shl 2' + tokens: + - token: '102' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-shl' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '102 -shr 2' + tokens: + - token: '102' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-shr' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '5 -band 3' + tokens: + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-band' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - line: '-bnot 5' + tokens: + - token: '-bnot' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - line: '5 -bor 0x03' + tokens: + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-bor' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '0x03' + scopes: + - source.powershell + - constant.numeric.hex + - line: '5 -bxor 3' + tokens: + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-bxor' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - line: '(1 -gt 2) -and (2 -gt 1)' + tokens: + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ' ' + scopes: + - source.powershell + - token: '-and' + scopes: + - source.powershell + - keyword.operator.logical + - token: ' ' + scopes: + - source.powershell + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '(1 -gt 2) -or (2 -gt 1)' + tokens: + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ' ' + scopes: + - source.powershell + - token: '-or' + scopes: + - source.powershell + - keyword.operator.logical + - token: ' ' + scopes: + - source.powershell + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '(1 -eq 1) -xor (2 -eq 2)' + tokens: + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ' ' + scopes: + - source.powershell + - token: '-xor' + scopes: + - source.powershell + - keyword.operator.logical + - token: ' ' + scopes: + - source.powershell + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '-not (1 -eq 1)' + tokens: + - token: '-not' + scopes: + - source.powershell + - keyword.operator.unary.logical-not + - token: ' ' + scopes: + - source.powershell + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '!(1 -eq 1)' + tokens: + - token: '!' + scopes: + - source.powershell + - keyword.operator.unary.logical-not + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '{0} {1,-10} {2:N}' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-f' + scopes: + - source.powershell + - keyword.operator.format + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'hello' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: 'math' + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '::' + scopes: + - source.powershell + - punctuation.accessor + - token: 'pi' + scopes: + - source.powershell + - meta.method + - line: '$a = 1' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: '$a += 1' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '+=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: '$a -= 1' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '-=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: '$a *= 1' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '*=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: '$a /= 1' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '/=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: '$a %= 1' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '%=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: '2*2' + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: '*' + scopes: + - source.powershell + - keyword.operator.multiplicative + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '2/2' + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: '/' + scopes: + - source.powershell + - keyword.operator.multiplicative + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '2+2' + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: '+' + scopes: + - source.powershell + - keyword.operator.additive + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '2-2' + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: '-' + scopes: + - source.powershell + - keyword.operator.additive + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '+$a' + tokens: + - token: '+' + scopes: + - source.powershell + - keyword.operator.unary-plus + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - line: '-$a' + tokens: + - token: '-' + scopes: + - source.powershell + - keyword.operator.unary-minus + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - line: '1..4' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: '..' + scopes: + - source.powershell + - keyword.operator.range + - token: '4' + scopes: + - source.powershell + - constant.numeric.integer + - line: '& $a' + tokens: + - token: '&' + scopes: + - source.powershell + - keyword.operator.other + - token: + scopes: + - source.powershell + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$a++' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - token: '++' + scopes: + - source.powershell + - keyword.operator.increment + - line: '++$a' + tokens: + - token: '++' + scopes: + - source.powershell + - keyword.operator.increment + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - line: '$a--' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - token: '--' + scopes: + - source.powershell + - keyword.operator.decrement + - line: '--$a' + tokens: + - token: '--' + scopes: + - source.powershell + - keyword.operator.decrement + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'a' + scopes: + - source.powershell + - variable.other.readwrite + - line: '"$(Get-RandomString -length 10)@$(Get-RandomString -length 10).com"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '$(' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.begin + - token: 'Get-RandomString' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - support.function + - token: ' -length' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - variable.parameter + - token: ' ' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - token: '10' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.end + - token: '@' + scopes: + - source.powershell + - string.quoted.double + - token: '$(' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.begin + - token: 'Get-RandomString' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - support.function + - token: ' -length' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - variable.parameter + - token: ' ' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - token: '10' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - constant.numeric.integer + - token: ')' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.end + - token: '.com' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '$foo?bar' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'foo?bar' + scopes: + - source.powershell + - variable.other.readwrite + - line: '${foo?bar}' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'foo?bar' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '"$foo?bar"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '$' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: 'foo?bar' + scopes: + - source.powershell + - string.quoted.double + - variable.other.readwrite + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '"${foo?bar}"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '$' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: 'foo?bar' + scopes: + - source.powershell + - string.quoted.double + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: 'myScript.ps1' + tokens: + - token: 'myScript.ps1' + scopes: + - source.powershell + - meta.command + - support.function + - line: 'myScript.ps1notafile' + tokens: + - token: 'myScript.ps1notafile' + scopes: + - source.powershell + - line: 'file.exe' + tokens: + - token: 'file.exe' + scopes: + - source.powershell + - support.executable + - line: 'file.exenotafile' + tokens: + - token: 'file.exenotafile' + scopes: + - source.powershell + - line: 'file.com' + tokens: + - token: 'file.com' + scopes: + - source.powershell + - support.executable + - line: 'file.comnotafile' + tokens: + - token: 'file.comnotafile' + scopes: + - source.powershell + - line: 'file.bat' + tokens: + - token: 'file.bat' + scopes: + - source.powershell + - support.executable + - line: 'file.batnotafile' + tokens: + - token: 'file.batnotafile' + scopes: + - source.powershell + - line: 'file.cmd' + tokens: + - token: 'file.cmd' + scopes: + - source.powershell + - support.executable + - line: 'file.cmdnotafile' + tokens: + - token: 'file.cmdnotafile' + scopes: + - source.powershell + - line: 'Function New-Function { #comment here' + tokens: + - token: 'Function' + scopes: + - source.powershell + - meta.function + - keyword.other + - token: ' ' + scopes: + - source.powershell + - meta.function + - token: 'New-Function' + scopes: + - source.powershell + - meta.function + - entity.name.function + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - token: ' #' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: 'comment here' + scopes: + - source.powershell + - comment.line + - line: '}' + tokens: + - token: '}' + scopes: + - source.powershell + - line: 'Function New-Function #comment here' + tokens: + - token: 'Function' + scopes: + - source.powershell + - meta.function + - keyword.other + - token: ' ' + scopes: + - source.powershell + - meta.function + - token: 'New-Function' + scopes: + - source.powershell + - meta.function + - entity.name.function + - token: ' #' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: 'comment here' + scopes: + - source.powershell + - comment.line + - line: '{' + tokens: + - token: '{' + scopes: + - source.powershell + - line: '[Microsoft.Win32.RegistryKey]' + tokens: + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: 'Microsoft' + scopes: + - source.powershell + - entity.name.type + - token: '.' + scopes: + - source.powershell + - token: 'Win32' + scopes: + - source.powershell + - entity.name.type + - token: '.' + scopes: + - source.powershell + - token: 'RegistryKey' + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: "$_.'#text'" + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: '_' + scopes: + - source.powershell + - variable.language + - token: '.' + scopes: + - source.powershell + - punctuation.accessor + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: '#text' + scopes: + - source.powershell + - string.quoted.single + - token: "'" + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: '$Whatever.Name -match "Id"' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Whatever' + scopes: + - source.powershell + - variable.other.readwrite + - token: '.' + scopes: + - source.powershell + - punctuation.accessor + - token: 'Name' + scopes: + - source.powershell + - variable.other.member + - token: ' ' + scopes: + - source.powershell + - token: '-match' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'Id' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '$Whatever.Name -match ".*Id"' + tokens: + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Whatever' + scopes: + - source.powershell + - variable.other.readwrite + - token: '.' + scopes: + - source.powershell + - punctuation.accessor + - token: 'Name' + scopes: + - source.powershell + - variable.other.member + - token: ' ' + scopes: + - source.powershell + - token: '-match' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '.*Id' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: 'Add-Something' + tokens: + - token: 'Add-Something' + scopes: + - source.powershell + - meta.command + - support.function + - line: 'Add-Something {}' + tokens: + - token: 'Add-Something' + scopes: + - source.powershell + - meta.command + - support.function + - token: ' {' + scopes: + - source.powershell + - meta.command + - token: '}' + scopes: + - source.powershell + - line: '(Add-Something).method()' + tokens: + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: 'Add-Something' + scopes: + - source.powershell + - meta.command + - support.function + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - token: '.' + scopes: + - source.powershell + - punctuation.accessor + - token: 'method' + scopes: + - source.powershell + - variable.other.member + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - line: 'Add-Something -Parameter1 value -Parameter2 value | Add-SomethingElse' + tokens: + - token: 'Add-Something' + scopes: + - source.powershell + - meta.command + - support.function + - token: ' -Parameter1' + scopes: + - source.powershell + - meta.command + - variable.parameter + - token: ' value' + scopes: + - source.powershell + - meta.command + - token: ' -Parameter2' + scopes: + - source.powershell + - meta.command + - variable.parameter + - token: ' value ' + scopes: + - source.powershell + - meta.command + - token: '|' + scopes: + - source.powershell + - meta.command + - keyword.operator + - token: ' ' + scopes: + - source.powershell + - token: 'Add-SomethingElse' + scopes: + - source.powershell + - meta.command + - support.function + - line: 'function Invoke-Test {' + tokens: + - token: 'function' + scopes: + - source.powershell + - meta.function + - keyword.other + - token: ' ' + scopes: + - source.powershell + - meta.function + - token: 'Invoke-Test' + scopes: + - source.powershell + - meta.function + - entity.name.function + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - line: ' [CmdletBinding(ConfirmImpact="High", DefaultParameterSetName = "Name", HelpUri = "https://my.help.io", SupportsShouldProcess = $true, SupportsPaging = $true, PositionalBinding = $true)]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: 'CmdletBinding' + scopes: + - source.powershell + - entity.other.attribute-name + - token: '(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: 'ConfirmImpact' + scopes: + - source.powershell + - token: '=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'High' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', DefaultParameterSetName ' + scopes: + - source.powershell + - token: '=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'Name' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', HelpUri ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'https://my.help.io' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', SupportsShouldProcess ' + scopes: + - source.powershell + - token: '=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ',' + scopes: + - source.powershell + - token: ' SupportsPaging ' + scopes: + - source.powershell + - token: '=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ',' + scopes: + - source.powershell + - token: ' PositionalBinding ' + scopes: + - source.powershell + - token: '=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '$' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ')' + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end \ No newline at end of file diff --git a/referenceFile.yaml b/referenceFile.yaml new file mode 100644 index 0000000..660a5aa --- /dev/null +++ b/referenceFile.yaml @@ -0,0 +1,4789 @@ +lines: + - line: '# Line comment' + tokens: + - token: '#' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: ' Line comment' + scopes: + - source.powershell + - comment.line + - line: '<#' + tokens: + - token: '<#' + scopes: + - source.powershell + - comment.block + - punctuation.definition.comment + - line: ' Block comment' + tokens: + - token: ' Block comment' + scopes: + - source.powershell + - comment.block + - line: '#>' + tokens: + - token: '#>' + scopes: + - source.powershell + - comment.block + - punctuation.definition.comment + - line: '''Single Quoted string''' + tokens: + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Single Quoted string + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: '"Double Quoted string"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: Double Quoted string + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '7' + tokens: + - token: '7' + scopes: + - source.powershell + - constant.numeric.integer + - line: '-10lkb' + tokens: + - token: '-10lkb' + scopes: + - source.powershell + - constant.numeric.integer + - line: '0x9' + tokens: + - token: '0x9' + scopes: + - source.powershell + - constant.numeric.hex + - line: 0x25l + tokens: + - token: 0x25l + scopes: + - source.powershell + - constant.numeric.hex + - line: '-999e-10dmb' + tokens: + - token: '-999e-10dmb' + scopes: + - source.powershell + - constant.numeric.real + - line: +6.e-6lkb + tokens: + - token: +6.e-6lkb + scopes: + - source.powershell + - constant.numeric.real + - line: +.6 + tokens: + - token: +.6 + scopes: + - source.powershell + - constant.numeric.real + - line: '-.9e+5dmb' + tokens: + - token: '-.9e+5dmb' + scopes: + - source.powershell + - constant.numeric.real + - line: .6tb + tokens: + - token: .6tb + scopes: + - source.powershell + - constant.numeric.real + - line: +4.9e+5dmb + tokens: + - token: +4.9e+5dmb + scopes: + - source.powershell + - constant.numeric.real + - line: '4.5' + tokens: + - token: '4.5' + scopes: + - source.powershell + - constant.numeric.real + - line: '-9.9' + tokens: + - token: '-9.9' + scopes: + - source.powershell + - constant.numeric.real + - line: '+7.4' + tokens: + - token: '+7.4' + scopes: + - source.powershell + - constant.numeric.real + - line: $myVariable + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: $my-Variable + tokens: + - token: $my-Variable + scopes: + - source.powershell + - invalid.illegal + - line: '$local:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'local:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$global:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'global:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$script:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'script:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$private:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'private:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$using:myVariable' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'using:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - line: '$env:COMPUTERNAME' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'env:' + scopes: + - source.powershell + - storage.modifier.scope + - token: COMPUTERNAME + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Function:help' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Function:' + scopes: + - source.powershell + - storage.modifier.scope + - token: help + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Alias:cat' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Alias:' + scopes: + - source.powershell + - storage.modifier.scope + - token: cat + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Cert:myCert' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Cert:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myCert + scopes: + - source.powershell + - variable.other.readwrite + - line: '$Variable:ast' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Variable:' + scopes: + - source.powershell + - storage.modifier.scope + - token: ast + scopes: + - source.powershell + - variable.other.readwrite + - line: '$HKCU:System' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKCU:' + scopes: + - source.powershell + - storage.modifier.scope + - token: System + scopes: + - source.powershell + - variable.other.readwrite + - line: '$HKLM:System' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKLM:' + scopes: + - source.powershell + - storage.modifier.scope + - token: System + scopes: + - source.powershell + - variable.other.readwrite + - line: '$WSMan:localhost' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'WSMan:' + scopes: + - source.powershell + - storage.modifier.scope + - token: localhost + scopes: + - source.powershell + - variable.other.readwrite + - line: '${myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${my-Variable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: my-Variable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${local:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'local:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${global:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'global:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${script:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'script:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${private:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'private:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${using:myVariable}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'using:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myVariable + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${env:COMPUTERNAME}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'env:' + scopes: + - source.powershell + - storage.modifier.scope + - token: COMPUTERNAME + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Function:help}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Function:' + scopes: + - source.powershell + - storage.modifier.scope + - token: help + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Alias:cat}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Alias:' + scopes: + - source.powershell + - storage.modifier.scope + - token: cat + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Cert:myCert}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Cert:' + scopes: + - source.powershell + - storage.modifier.scope + - token: myCert + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${Variable:ast}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'Variable:' + scopes: + - source.powershell + - storage.modifier.scope + - token: ast + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${HKCU:System}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKCU:' + scopes: + - source.powershell + - storage.modifier.scope + - token: System + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${HKLM:System}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'HKLM:' + scopes: + - source.powershell + - storage.modifier.scope + - token: System + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '${WSMan:localhost}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'WSMan:' + scopes: + - source.powershell + - storage.modifier.scope + - token: localhost + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: 'command.exe $par1 --% $par2 #comment' + tokens: + - token: command.exe + scopes: + - source.powershell + - support.executable + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: par1 + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '--%' + scopes: + - source.powershell + - keyword.operator + - token: ' ' + scopes: + - source.powershell + - source.powershell + - token: $ + scopes: + - source.powershell + - source.powershell + - token: p + scopes: + - source.powershell + - source.powershell + - token: a + scopes: + - source.powershell + - source.powershell + - token: r + scopes: + - source.powershell + - source.powershell + - token: '2' + scopes: + - source.powershell + - source.powershell + - token: ' #' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: comment + scopes: + - source.powershell + - comment.line + - line: command.execute + tokens: + - token: command.execute + scopes: + - source.powershell + - line: $$ + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: $ + scopes: + - source.powershell + - variable.language + - line: '''''''str''''ing''' + tokens: + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - constant.character.escape + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - token: str + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - constant.character.escape + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - token: ing + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: 'enum myEnum {}' + tokens: + - token: enum + scopes: + - source.powershell + - storage.type + - token: ' ' + scopes: + - source.powershell + - token: myEnum + scopes: + - source.powershell + - entity.name.enum + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.begin + - token: '}' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.end + - line: '@(1,2,3)' + tokens: + - token: '@(' + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '(1,2,3)' + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '(1,2,3).Count' + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: Count + scopes: + - source.powershell + - variable.other.member + - line: '@{1 = 1}' + tokens: + - token: '@{' + scopes: + - source.powershell + - meta.hashtable + - punctuation.section.braces.begin + - token: '1' + scopes: + - source.powershell + - meta.hashtable + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - meta.hashtable + - token: = + scopes: + - source.powershell + - meta.hashtable + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - meta.hashtable + - token: '1' + scopes: + - source.powershell + - meta.hashtable + - constant.numeric.integer + - token: '}' + scopes: + - source.powershell + - meta.hashtable + - punctuation.section.braces.end + - line: '{}' + tokens: + - token: '{' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.begin + - token: '}' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.end + - line: '"$($subExpression)"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: $( + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.begin + - token: $ + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.definition.variable + - token: subExpression + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - variable.other.readwrite + - token: ) + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.end + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: Get-Service @par + tokens: + - token: Get-Service + scopes: + - source.powershell + - meta.command + - support.function + - token: ' ' + scopes: + - source.powershell + - meta.command + - token: '@' + scopes: + - source.powershell + - meta.command + - punctuation.definition.variable + - token: par + scopes: + - source.powershell + - meta.command + - variable.other.readwrite + - line: '$var:' + tokens: + - token: '$var:' + scopes: + - source.powershell + - invalid.illegal + - line: Write-Warning -Message "Warning" + tokens: + - token: Write-Warning + scopes: + - source.powershell + - meta.command + - support.function + - token: ' -Message' + scopes: + - source.powershell + - meta.command + - variable.parameter + - token: ' ' + scopes: + - source.powershell + - meta.command + - token: '"' + scopes: + - source.powershell + - meta.command + - string.quoted.double + - punctuation.definition.string.begin + - token: Warning + scopes: + - source.powershell + - meta.command + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - meta.command + - string.quoted.double + - punctuation.definition.string.end + - line: 'class myClass {}' + tokens: + - token: class + scopes: + - source.powershell + - keyword.other + - token: ' ' + scopes: + - source.powershell + - token: myClass + scopes: + - source.powershell + - entity.name.class + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - punctuation.section.braces.open + - token: '}' + scopes: + - source.powershell + - punctuation.section.braces.close + - line: '1 -is [int]' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-is' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: int + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '1 -as [string]' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-as' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '1 -isnot [int]' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-isnot' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: int + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '"c" -in [char[]]"abc"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: c + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-in' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: char + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: abc + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '"c" -notin [char[]]"abc"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: c + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-notin' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: char + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: abc + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '1,2 -join ";"' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-join' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: ; + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '1,2 -split ","' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-split' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: ',' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: 1 -eq 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -ne 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-ne' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -gt 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -lt 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-lt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -ge 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-ge' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -le 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-le' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -like 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-like' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 1 -notlike 2 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-notlike' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: '"abc" -replace("b","c")' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: abc + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-replace' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: b + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: c + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '1,2,3 -contains(2)' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-contains' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '1,2,3 -notcontains(2)' + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-notcontains' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"a" -match("\w")' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: a + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-match' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: \w + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"a" -notmatch("\w")' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: a + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-notmatch' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: \w + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: 102 -shl 2 + tokens: + - token: '102' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-shl' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 102 -shr 2 + tokens: + - token: '102' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-shr' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 5 -band 3 + tokens: + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-band' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - line: '-bnot 5' + tokens: + - token: '-bnot' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - line: 5 -bor 0x03 + tokens: + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-bor' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '0x03' + scopes: + - source.powershell + - constant.numeric.hex + - line: 5 -bxor 3 + tokens: + - token: '5' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-bxor' + scopes: + - source.powershell + - keyword.operator.bitwise + - token: ' ' + scopes: + - source.powershell + - token: '3' + scopes: + - source.powershell + - constant.numeric.integer + - line: (1 -gt 2) -and (2 -gt 1) + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ' ' + scopes: + - source.powershell + - token: '-and' + scopes: + - source.powershell + - keyword.operator.logical + - token: ' ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: (1 -gt 2) -or (2 -gt 1) + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ' ' + scopes: + - source.powershell + - token: '-or' + scopes: + - source.powershell + - keyword.operator.logical + - token: ' ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-gt' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: (1 -eq 1) -xor (2 -eq 2) + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ' ' + scopes: + - source.powershell + - token: '-xor' + scopes: + - source.powershell + - keyword.operator.logical + - token: ' ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '-not (1 -eq 1)' + tokens: + - token: '-not' + scopes: + - source.powershell + - keyword.operator.unary.logical-not + - token: ' ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '!(1 -eq 1)' + tokens: + - token: '!' + scopes: + - source.powershell + - keyword.operator.unary.logical-not + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ' ' + scopes: + - source.powershell + - token: '-eq' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '{0} {1,-10} {2:N}' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ' ' + scopes: + - source.powershell + - token: '-f' + scopes: + - source.powershell + - keyword.operator.format + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: hello + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: math + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '::' + scopes: + - source.powershell + - punctuation.accessor + - token: pi + scopes: + - source.powershell + - meta.method + - line: $a = 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a += 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: += + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a -= 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '-=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a *= 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '*=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a /= 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: /= + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a %= 1 + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ' ' + scopes: + - source.powershell + - token: '%=' + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - line: $a++ + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: ++ + scopes: + - source.powershell + - keyword.operator.increment + - line: ++$a + tokens: + - token: ++ + scopes: + - source.powershell + - keyword.operator.increment + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: $a-- + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - token: '--' + scopes: + - source.powershell + - keyword.operator.decrement + - line: '--$a' + tokens: + - token: '--' + scopes: + - source.powershell + - keyword.operator.decrement + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: 2*2 + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: '*' + scopes: + - source.powershell + - keyword.operator.multiplicative + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 2/2 + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: / + scopes: + - source.powershell + - keyword.operator.multiplicative + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 2+2 + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: + + scopes: + - source.powershell + - keyword.operator.additive + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: 2-2 + tokens: + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - token: '-' + scopes: + - source.powershell + - keyword.operator.additive + - token: '2' + scopes: + - source.powershell + - constant.numeric.integer + - line: +$a + tokens: + - token: + + scopes: + - source.powershell + - keyword.operator.unary-plus + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: '-$a' + tokens: + - token: '-' + scopes: + - source.powershell + - keyword.operator.unary-minus + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: 1..4 + tokens: + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: .. + scopes: + - source.powershell + - keyword.operator.range + - token: '4' + scopes: + - source.powershell + - constant.numeric.integer + - line: '& $a' + tokens: + - token: '&' + scopes: + - source.powershell + - keyword.operator.other + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: a + scopes: + - source.powershell + - variable.other.readwrite + - line: '"$(Get-RandomString -length 10)@$(Get-RandomString -length 10).com"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: $( + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.begin + - token: Get-RandomString + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - support.function + - token: ' -length' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - variable.parameter + - token: ' ' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - token: '10' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.end + - token: '@' + scopes: + - source.powershell + - string.quoted.double + - token: $( + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.begin + - token: Get-RandomString + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - support.function + - token: ' -length' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - variable.parameter + - token: ' ' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - token: '10' + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - meta.command + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - string.quoted.double + - meta.subexpression + - punctuation.section.parens.end + - token: .com + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: $foo?bar + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: foo?bar + scopes: + - source.powershell + - variable.other.readwrite + - line: '${foo?bar}' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: foo?bar + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - line: '"$foo?bar"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: $ + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: foo?bar + scopes: + - source.powershell + - string.quoted.double + - variable.other.readwrite + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '"${foo?bar}"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: $ + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: foo?bar + scopes: + - source.powershell + - string.quoted.double + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.variable + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: myScript.ps1 + tokens: + - token: myScript.ps1 + scopes: + - source.powershell + - meta.command + - support.function + - line: myScript.ps1notafile + tokens: + - token: myScript.ps1notafile + scopes: + - source.powershell + - line: file.exe + tokens: + - token: file.exe + scopes: + - source.powershell + - support.executable + - line: file.exenotafile + tokens: + - token: file.exenotafile + scopes: + - source.powershell + - line: file.com + tokens: + - token: file.com + scopes: + - source.powershell + - support.executable + - line: file.bat + tokens: + - token: file.bat + scopes: + - source.powershell + - support.executable + - line: file.batnotafile + tokens: + - token: file.batnotafile + scopes: + - source.powershell + - line: file.cmd + tokens: + - token: file.cmd + scopes: + - source.powershell + - support.executable + - line: file.cmdnotafile + tokens: + - token: file.cmdnotafile + scopes: + - source.powershell + - line: 'Function New-Function { #comment here' + tokens: + - token: Function + scopes: + - source.powershell + - meta.function + - keyword.other + - token: ' ' + scopes: + - source.powershell + - meta.function + - token: New-Function + scopes: + - source.powershell + - meta.function + - entity.name.function + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - token: ' #' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: comment here + scopes: + - source.powershell + - comment.line + - line: '}' + tokens: + - token: '}' + scopes: + - source.powershell + - line: 'Function New-Function #comment here' + tokens: + - token: Function + scopes: + - source.powershell + - meta.function + - keyword.other + - token: ' ' + scopes: + - source.powershell + - meta.function + - token: New-Function + scopes: + - source.powershell + - meta.function + - entity.name.function + - token: ' #' + scopes: + - source.powershell + - comment.line + - punctuation.definition.comment + - token: comment here + scopes: + - source.powershell + - comment.line + - line: '{' + tokens: + - token: '{' + scopes: + - source.powershell + - line: '}' + tokens: + - token: '}' + scopes: + - source.powershell + - line: '[Microsoft.Win32.RegistryKey]' + tokens: + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Microsoft + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Win32 + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: RegistryKey + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '$_.''#text''' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: _ + scopes: + - source.powershell + - variable.language + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: '#text' + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: $Whatever.Name -match "Id" + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Whatever + scopes: + - source.powershell + - variable.other.readwrite + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: Name + scopes: + - source.powershell + - variable.other.member + - token: ' ' + scopes: + - source.powershell + - token: '-match' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: Id + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: $Whatever.Name -match ".*Id" + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Whatever + scopes: + - source.powershell + - variable.other.readwrite + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: Name + scopes: + - source.powershell + - variable.other.member + - token: ' ' + scopes: + - source.powershell + - token: '-match' + scopes: + - source.powershell + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: .*Id + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: Add-Something + tokens: + - token: Add-Something + scopes: + - source.powershell + - meta.command + - support.function + - line: 'Add-Something {}' + tokens: + - token: Add-Something + scopes: + - source.powershell + - meta.command + - support.function + - token: ' {' + scopes: + - source.powershell + - meta.command + - token: '}' + scopes: + - source.powershell + - line: (Add-Something).method() + tokens: + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: Add-Something + scopes: + - source.powershell + - meta.command + - support.function + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: . + scopes: + - source.powershell + - punctuation.accessor + - token: method + scopes: + - source.powershell + - variable.other.member + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: Add-Something -Parameter1 value -Parameter2 value | Add-SomethingElse + tokens: + - token: Add-Something + scopes: + - source.powershell + - meta.command + - support.function + - token: ' -Parameter1' + scopes: + - source.powershell + - meta.command + - variable.parameter + - token: ' value' + scopes: + - source.powershell + - meta.command + - token: ' -Parameter2' + scopes: + - source.powershell + - meta.command + - variable.parameter + - token: ' value ' + scopes: + - source.powershell + - meta.command + - token: '|' + scopes: + - source.powershell + - meta.command + - keyword.operator + - token: ' ' + scopes: + - source.powershell + - token: Add-SomethingElse + scopes: + - source.powershell + - meta.command + - support.function + - line: 'function Invoke-Test {' + tokens: + - token: function + scopes: + - source.powershell + - meta.function + - keyword.other + - token: ' ' + scopes: + - source.powershell + - meta.function + - token: Invoke-Test + scopes: + - source.powershell + - meta.function + - entity.name.function + - token: ' ' + scopes: + - source.powershell + - token: '{' + scopes: + - source.powershell + - line: ' [CmdletBinding(ConfirmImpact="High", DefaultParameterSetName = "Name", HelpUri = "https://my.help.io", SupportsShouldProcess = $true, SupportsPaging = $true, PositionalBinding = $true)]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: CmdletBinding + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ConfirmImpact + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: High + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', DefaultParameterSetName ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: Name + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', HelpUri ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'https://my.help.io' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', SupportsShouldProcess ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ',' + scopes: + - source.powershell + - token: ' SupportsPaging ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ',' + scopes: + - source.powershell + - token: ' PositionalBinding ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [OutputType("System.Int32", ParameterSetName="ID")]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: OutputType + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: System.Int32 + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ', ParameterSetName' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: ID + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [OutputType([String], ParameterSetName="Name")]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: OutputType + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: String + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ', ParameterSetName' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: Name + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' param (' + tokens: + - token: ' param ' + scopes: + - source.powershell + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - line: ' [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName, ParameterSetName = ''Name'')]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Parameter + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: 'ValueFromPipeline ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'true' + scopes: + - source.powershell + - variable.language + - token: ',' + scopes: + - source.powershell + - token: ' ValueFromPipelineByPropertyName, ParameterSetName ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Name + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateLength(1,25)]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateLength + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '25' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string] $Name,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Name + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [ValidatePattern("[0-9][0-9][0-9][0-9]")]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidatePattern + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: '[0-9][0-9][0-9][0-9]' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateNotNull()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateNotNull + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string] $ComputerId,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: ComputerId + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [Parameter(Position = 0, ValueFromRemainingArguments, HelpMessage = ''User ID'')]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Parameter + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: 'Position ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '0' + scopes: + - source.powershell + - constant.numeric.integer + - token: ', ValueFromRemainingArguments, HelpMessage ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: User ID + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [Alias(''UserId'',''UID'')]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Alias + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: UserId + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: UID + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateRange(1,999)]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateRange + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '999' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [int32] $Id,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: int32 + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Id + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [AllowNull()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: AllowNull + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [int] $State,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: int + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: State + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [AllowEmptyString()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: AllowEmptyString + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string] $Message,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Message + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [ValidateCount(1,9)]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateCount + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '1' + scopes: + - source.powershell + - constant.numeric.integer + - token: ',' + scopes: + - source.powershell + - token: '9' + scopes: + - source.powershell + - constant.numeric.integer + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateNotNullOrEmpty()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateNotNullOrEmpty + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string[]] $NewCollection,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: NewCollection + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [AllowEmptyCollection()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: AllowEmptyCollection + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateSet(''Basic'',''Pro'',''Gold'')]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateSet + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Basic + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Pro + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ',' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: Gold + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [string[]] $OldCollection,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: string + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: OldCollection + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [Parameter()]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: Parameter + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [ValidateScript({$_ -ge (get-date)})]' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidateScript + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '{' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.begin + - token: $ + scopes: + - source.powershell + - meta.scriptblock + - punctuation.definition.variable + - token: _ + scopes: + - source.powershell + - meta.scriptblock + - variable.language + - token: ' ' + scopes: + - source.powershell + - meta.scriptblock + - token: '-ge' + scopes: + - source.powershell + - meta.scriptblock + - keyword.operator.comparison + - token: ' ' + scopes: + - source.powershell + - meta.scriptblock + - token: ( + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.parens.begin + - token: get-date + scopes: + - source.powershell + - meta.scriptblock + - meta.command + - support.function + - token: ) + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.parens.end + - token: '}' + scopes: + - source.powershell + - meta.scriptblock + - punctuation.section.braces.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: ' [DateTime] $Date,' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: DateTime + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Date + scopes: + - source.powershell + - variable.other.readwrite + - token: ',' + scopes: + - source.powershell + - line: ' [switch] $Force' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: switch + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ' ' + scopes: + - source.powershell + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: Force + scopes: + - source.powershell + - variable.other.readwrite + - line: ' )' + tokens: + - token: ' ' + scopes: + - source.powershell + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '}' + tokens: + - token: '}' + scopes: + - source.powershell + - line: >- + [System.Collections.Generic.Dictionary`2[[System.String, + mscorlib],[System.Management.Automation.ParameterMetadata,System.Management.Automation]]] + tokens: + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: System + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Collections + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Generic + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Dictionary`2 + scopes: + - source.powershell + - entity.name.type + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: System + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: String + scopes: + - source.powershell + - entity.name.type + - token: ', ' + scopes: + - source.powershell + - token: mscorlib + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ',' + scopes: + - source.powershell + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: System + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Management + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Automation + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: ParameterMetadata + scopes: + - source.powershell + - entity.name.type + - token: ',' + scopes: + - source.powershell + - token: System + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Management + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Automation + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '[System.Array+SZArrayEnumerator]' + tokens: + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: System + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: Array + scopes: + - source.powershell + - entity.name.type + - token: + + scopes: + - source.powershell + - token: SZArrayEnumerator + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '[int]::MinValue' + tokens: + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: int + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '::' + scopes: + - source.powershell + - punctuation.accessor + - token: MinValue + scopes: + - source.powershell + - meta.method + - line: '[System.DateTime]::Parse(''2016/09/21'')' + tokens: + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: System + scopes: + - source.powershell + - entity.name.type + - token: . + scopes: + - source.powershell + - token: DateTime + scopes: + - source.powershell + - entity.name.type + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - token: '::' + scopes: + - source.powershell + - punctuation.accessor + - token: Parse + scopes: + - source.powershell + - meta.method + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: 2016/09/21 + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - line: '"Name,""Id""`tPhone`n====`r`n"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: 'Name,' + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - token: Id + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - token: '`t' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: Phone + scopes: + - source.powershell + - string.quoted.double + - token: '`n' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: ==== + scopes: + - source.powershell + - string.quoted.double + - token: '`r' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: '`n' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '''Name,''''Id''''`tPhone`n====`r`n''' + tokens: + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: 'Name,' + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - constant.character.escape + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - token: Id + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - constant.character.escape + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - token: '`tPhone`n====`r`n' + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: '"text`0text`atext`ftext`vtext`"`$text`"text`btext"' + tokens: + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.begin + - token: text + scopes: + - source.powershell + - string.quoted.double + - token: '`0' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: text + scopes: + - source.powershell + - string.quoted.double + - token: '`a' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: text + scopes: + - source.powershell + - string.quoted.double + - token: '`f' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: text + scopes: + - source.powershell + - string.quoted.double + - token: '`v' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: text + scopes: + - source.powershell + - string.quoted.double + - token: '`' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - token: '`' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: $ + scopes: + - source.powershell + - string.quoted.double + - token: text + scopes: + - source.powershell + - string.quoted.double + - token: '`' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - token: text + scopes: + - source.powershell + - string.quoted.double + - token: '`b' + scopes: + - source.powershell + - string.quoted.double + - constant.character.escape + - token: text + scopes: + - source.powershell + - string.quoted.double + - token: '"' + scopes: + - source.powershell + - string.quoted.double + - punctuation.definition.string.end + - line: '''text`0text`atext`ftext`vtext`"`$text`"text`btext''' + tokens: + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: text`0text`atext`ftext`vtext`"`$text`"text`btext + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - line: >- + [ValidatePattern('^(?=^.{1,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)')] + tokens: + - token: '[' + scopes: + - source.powershell + - punctuation.section.brackets.begin + - token: ValidatePattern + scopes: + - source.powershell + - entity.other.attribute-name + - token: ( + scopes: + - source.powershell + - punctuation.section.parens.begin + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: >- + ^(?=^.{1,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$) + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end + - token: ) + scopes: + - source.powershell + - punctuation.section.parens.end + - token: ']' + scopes: + - source.powershell + - punctuation.section.brackets.end + - line: '${script:this`{value`}is} = ''valid''' + tokens: + - token: $ + scopes: + - source.powershell + - punctuation.definition.variable + - token: '{' + scopes: + - source.powershell + - punctuation.definition.variable + - token: 'script:' + scopes: + - source.powershell + - storage.modifier.scope + - token: 'this`{value`}is' + scopes: + - source.powershell + - variable.other.readwrite + - token: '}' + scopes: + - source.powershell + - punctuation.definition.variable + - token: ' ' + scopes: + - source.powershell + - token: = + scopes: + - source.powershell + - keyword.operator.assignment + - token: ' ' + scopes: + - source.powershell + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.begin + - token: valid + scopes: + - source.powershell + - string.quoted.single + - token: '''' + scopes: + - source.powershell + - string.quoted.single + - punctuation.definition.string.end diff --git a/test.js b/test.js new file mode 100644 index 0000000..871b3ff --- /dev/null +++ b/test.js @@ -0,0 +1,87 @@ +var fs = require('fs'); +var Registry = require('vscode-textmate').Registry; +var yaml = require('js-yaml'); +var referencePath = './referenceFile.yaml'; +var testFilePath = './test.ps1'; +var grammarPath = './grammars/PowerShellSyntax.tmLanguage' +var ruleStack = null; +var lastElementId = 0; +var passed = true; + +// read reference file +var referenceFile = yaml.safeLoad(fs.readFileSync(referencePath,'utf-8')); +var ref = referenceFile.lines; + +// read grammar file +var registry = new Registry(); +var grammar = registry.loadGrammarFromPathSync(grammarPath); + +// read test script +var fileContents = require('fs').readFileSync(testFilePath).toString(); +var lines = fileContents.split(/\r\n|\r|\n/); + +// iterate through each line in the test script +for (var i = 0; i < lines.length; i++) { + var line = lines[i]; + + // skip empty lines + if (line != '') { + + var refLine = ref.filter(function(objRef) { + return objRef.line == line; + }); + + if (refLine[0] != undefined) { + + // iterate through tokens found in this line + var lineTokens = grammar.tokenizeLine(line, ruleStack); + for (var y = 0; y < lineTokens.tokens.length; y++) { + var token = lineTokens.tokens[y]; + var tokenString = line.substring(token.startIndex,token.endIndex); + var refToken = refLine[0].tokens[y].token + + // check that a reference is returned for this token + if (refToken != undefined) { + + // check that the reference token mathes current token + if (tokenString == refToken) { + + var tokenScopes = token.scopes; + var refScopes = refLine[0].tokens[y].scopes; + + // check that token scopes match the reference scopes + if (Array.isArray(tokenScopes)) { + checkTokenScopes = tokenScopes.join(); + } + else { checkTokenScopes = tokenScopes } + if (Array.isArray(refScopes)) { + checkRefScopes = refScopes; + } + else { checkRefScopes = refScopes } + if (checkTokenScopes == checkRefScopes) { + //console.log('Everything is OK!'); + } + else { + passed = false; + console.warn('[' + (i+1) + '] Scope mismatch found: \t'); + console.warn(' test: \t' + checkTokenScopes); + console.warn(' ref:\t' + checkRefScopes); + } + } else { + passed = false; + console.warn('[' + (i+1) + '] Token mismatch found!\t"' + tokenString + '" should be "' + refToken + '"'); + } + } + } + ruleStack = lineTokens.ruleStack; + } else { + passed = false; + console.warn('[' + (i+1) + '] No reference found for: \t' + line); + } + } +} + +if (passed) { + console.log('All tests passed!'); + process.exit(0); +} \ No newline at end of file diff --git a/test.ps1 b/test.ps1 new file mode 100644 index 0000000..0baf32b --- /dev/null +++ b/test.ps1 @@ -0,0 +1,224 @@ +# Line comment +<# + Block comment +#> +# .ExternalHelp psake.psm1-help.xml +#requires -version 2.0 +#Requires -Version 5 +#Requires -PSSnapin DiskSnapin -Version 1.2 +# Requires -Version 3.1 +#Requires -Version 5 something +# Requires -Version 3.1 something +'Single Quoted string' +"Double Quoted string" +7 +-10lkb +0x9 +0x25l +-999e-10dmb ++6.e-6lkb ++.6 +-.9e+5dmb +.6tb ++4.9e+5dmb +4.5 +-9.9 ++7.4 +$myVariable +$my-Variable +$local:myVariable +$global:myVariable +$script:myVariable +$private:myVariable +$using:myVariable +$env:COMPUTERNAME +$Function:help +$Alias:cat +$Cert:myCert +$Variable:ast +$HKCU:System +$HKLM:System +$WSMan:localhost +${myVariable} +${my-Variable} +${local:myVariable} +${global:myVariable} +${script:myVariable} +${private:myVariable} +${using:myVariable} +${env:COMPUTERNAME} +${Function:help} +${Alias:cat} +${Cert:myCert} +${Variable:ast} +${HKCU:System} +${HKLM:System} +${WSMan:localhost} +command.exe $par1 --% $par2 #comment +command.execute +$$ +'''str''ing' +enum myEnum {} +@(1,2,3) +(1,2,3) +(1,2,3).Count +@{1 = 1} +{} +"$($subExpression)" +Get-Service @par +$var: +Write-Warning -Message "Warning" +class myClass {} +1 -is [int] +1 -as [string] +1 -isnot [int] +"c" -in [char[]]"abc" +"c" -notin [char[]]"abc" +1,2 -join ";" +1,2 -split "," +1 -eq 2 +1 -ne 2 +1 -gt 2 +1 -lt 2 +1 -ge 2 +1 -le 2 +1 -like 2 +1 -notlike 2 +"abc" -replace("b","c") +1,2,3 -contains(2) +1,2,3 -notcontains(2) +"a" -match("\w") +"a" -notmatch("\w") +102 -shl 2 +102 -shr 2 +5 -band 3 +-bnot 5 +5 -bor 0x03 +5 -bxor 3 +(1 -gt 2) -and (2 -gt 1) +(1 -gt 2) -or (2 -gt 1) +(1 -eq 1) -xor (2 -eq 2) +-not (1 -eq 1) +!(1 -eq 1) +"{0} {1,-10} {2:N}" -f 1,"hello",[math]::pi +$a = 1 +$a += 1 +$a -= 1 +$a *= 1 +$a /= 1 +$a %= 1 +$a++ +++$a +$a-- +--$a +2*2 +2/2 +2+2 +2-2 ++$a +-$a +1..4 +& $a +"$(Get-RandomString -length 10)@$(Get-RandomString -length 10).com" +$foo?bar +${foo?bar} +"$foo?bar" +"${foo?bar}" +myScript.ps1 +myScript.ps1notafile +file.exe +file.exenotafile +file.com +file.bat +file.batnotafile +file.cmd +file.cmdnotafile +Function New-Function { #comment here +} +Function New-Function #comment here +{ +} +[Microsoft.Win32.RegistryKey] +$_.'#text' +$Whatever.Name -match "Id" +$Whatever.Name -match ".*Id" +Add-Something +Add-Something {} +(Add-Something).method() +Add-Something -Parameter1 value -Parameter2 value | Add-SomethingElse +function Invoke-Test { + [CmdletBinding(ConfirmImpact="High", DefaultParameterSetName = "Name", HelpUri = "https://my.help.io", SupportsShouldProcess = $true, SupportsPaging = $true, PositionalBinding = $true)] + [OutputType("System.Int32", ParameterSetName="ID")] + [OutputType([String], ParameterSetName="Name")] + param ( + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName, ParameterSetName = 'Name')] + [ValidateLength(1,25)] + [string] $Name, + + [ValidatePattern("[0-9][0-9][0-9][0-9]")] + [ValidateNotNull()] + [string] $ComputerId, + + [Parameter(Position = 0, ValueFromRemainingArguments, HelpMessage = 'User ID')] + [Alias('UserId','UID')] + [ValidateRange(1,999)] + [int32] $Id, + + [AllowNull()] + [int] $State, + + [AllowEmptyString()] + [string] $Message, + + [ValidateCount(1,9)] + [ValidateNotNullOrEmpty()] + [string[]] $NewCollection, + + [AllowEmptyCollection()] + [ValidateSet('Basic','Pro','Gold')] + [string[]] $OldCollection, + + [Parameter()] + [ValidateScript({$_ -ge (get-date)})] + [DateTime] $Date, + + [switch] $Force + ) +} +[System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Management.Automation.ParameterMetadata,System.Management.Automation]]] +[System.Array+SZArrayEnumerator] +[int]::MinValue +[System.DateTime]::Parse('2016/09/21') +"Name,""Id""`tPhone`n====`r`n" +'Name,''Id''`tPhone`n====`r`n' +"text`0text`atext`ftext`vtext`"`$text`"text`btext" +'text`0text`atext`ftext`vtext`"`$text`"text`btext' +[ValidatePattern('^(?=^.{1,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)')] +${script:this`{value`}is} = 'valid' +$a[0] +$a[-3..-1] +$a[0,2+4..6] +,(1,2,3) +,$a +$t = $a[0,1 + 3..($a.length - 1)] +functioN MyFunction{} +function My-Function {} +Function My.Function{} +function My-Function.Other{} +function Some.other.function{} +FUNCTION MyFunction2 {} +function New-File { } +function New-File ($Name) { } +function NewFile($Name) { } +functionMyFunction{} +filter myfilter($param) {} +Filter my-Filter ($param){} +function global:Invoke-Something {} +switch ("fourteen") {} +switch -CaseSensitive ("fourteen") {} +switch -Illegal ("fourteen") {} +switch -Regex ("fourteen") {} +switch -Wildcard ($a) {} +switch -regex -file .\somefile.txt {} +switch (3) {} +switch (4, 2) {} \ No newline at end of file diff --git a/themes/theme-psise/theme.json b/themes/theme-psise/theme.json new file mode 100644 index 0000000..ae8299a --- /dev/null +++ b/themes/theme-psise/theme.json @@ -0,0 +1,226 @@ +{ + "name": "PowerShell ISE", + "tokenColors": [ + { + "settings": { + "background": "#FFFFFF", + "foreground": "#000000" + } + }, + { + "name": "Comments", + "scope": [ + "comment", + "punctuation.definition.comment", + "keyword.operator.documentation" + ], + "settings": { + "fontStyle": "", + "foreground": "#006400" + } + }, + { + "name": "Comments: Preprocessor", + "scope": "comment.block.preprocessor", + "settings": { + "fontStyle": "", + "foreground": "#006400" + } + }, + { + "name": "Comments: Documentation", + "scope": [ + "comment.documentation", + "comment.block.documentation" + ], + "settings": { + "foreground": "#006400" + } + }, + { + "name": "Invalid - Deprecated", + "scope": "invalid.deprecated", + "settings": { + "background": "#96000014" + } + }, + { + "name": "Invalid - Illegal", + "scope": "invalid.illegal", + "settings": { + "background": "#96000014", + "foreground": "#660000" + } + }, + { + "name": "Operators", + "scope": [ + "keyword.operator", + "punctuation.accessor" + ], + "settings": { + "foreground": "#A9A9A9" + } + }, + { + "name": "Attributes", + "scope": "entity.other.attribute-name", + "settings":{ + "foreground":"#00bfff" + } + }, + { + "name": "Keywords", + "scope": [ + "keyword", + "storage", + "variable.parameter" + ], + "settings": { + "foreground": "#00008B" + } + }, + { + "name": "Types", + "scope": [ + "storage.type", + "support.type" + ], + "settings": { + "foreground": "#00008B" + } + }, + { + "name": "Language Constants", + "scope": [ + "constant.language", + "support.constant" + ], + "settings": { + "foreground": "#008080" + } + }, + { + "name": "Variables", + "scope": [ + "variable", + "support.variable", + "punctuation.definition.variable", + "variable.language" + ], + "settings": { + "foreground": "#FF4500" + } + }, + { + "name": "Variable members", + "scope": "variable.other.member", + "settings":{ + "foreground":"#000000" + } + }, + { + "name": "Commands", + "scope": [ + "support.function" + ], + "settings": { + "foreground": "#0000FF" + } + }, + { + "name": "Functions", + "scope": [ + "entity.name.function" + ], + "settings": { + "foreground": "#8a2be2" + } + }, + { + "name": "Classes", + "scope": [ + "entity.name.type", + "entity.other.inherited-class", + "support.class" + ], + "settings": { + "foreground": "#008080" + } + }, + { + "name": "Exceptions", + "scope": "entity.name.exception", + "settings": { + "foreground": "#660000" + } + }, + { + "name": "Sections", + "scope": "entity.name.section", + "settings": { + } + }, + { + "name": "Numbers, Characters", + "scope": [ + "constant.numeric", + "constant.character", + "constant" + ], + "settings": { + "foreground": "#800080" + } + }, + { + "name": "Strings", + "scope": [ + "string", + "punctuation.definition.string" + ], + "settings": { + "foreground": "#8B0000" + } + }, + { + "name": "Strings: Escape Sequences", + "scope": "constant.character.escape", + "settings": { + "foreground": "#000000" + } + }, + { + "name": "Strings: Regular Expressions", + "scope": "string.regexp", + "settings": { + "foreground": "#8B0000" + } + }, + { + "name": "Strings: Symbols", + "scope": "constant.other.symbol", + "settings": { + "foreground": "#8B0000" + } + }, + { + "name": "Punctuation", + "scope": "punctuation", + "settings": { + "foreground": "#000000" + } + } + ], + "colors": { + "activityBar.background": "#E1ECF9", + "activityBar.foreground": "#A9A9A9", + "activityBarBadge.background": "#A9A9A9", + "editor.lineHighlightBackground": "#add8e6", + "editor.selectionBackground": "#94c6f7", + "statusBar.background": "#999999", + "statusBar.debuggingBackground": "#FF4500", + "statusBar.noFolderBackground": "#999999", + "terminal.background": "#012456", + "terminal.foreground": "#F5F5F5" + } +} \ No newline at end of file diff --git a/useOriginalGrammar.ps1 b/useOriginalGrammar.ps1 new file mode 100644 index 0000000..2d6f845 --- /dev/null +++ b/useOriginalGrammar.ps1 @@ -0,0 +1,43 @@ +$grammarPathx64 = 'C:\Program Files\Microsoft VS Code\resources\app\extensions\powershell\syntaxes\PowershellSyntax.tmLanguage' +$grammarPathx64Backup = 'C:\Program Files\Microsoft VS Code\resources\app\extensions\powershell\syntaxes\PowershellSyntax.tmLanguage.old' +$grammarPathx86 = 'C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\powershell\syntaxes\PowershellSyntax.tmLanguage' +$grammarPathx86Backup = 'C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\powershell\syntaxes\PowershellSyntax.tmLanguage.old' + +function Test-IsAdmin { + $windowsIdentity=[System.Security.Principal.WindowsIdentity]::GetCurrent() + $windowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($windowsIdentity) + $adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator + Write-Output ($windowsPrincipal.IsInRole($adm)) +} + +if (Test-IsAdmin) { + function Set-GrammarFile ($newFile,$oldFile) { + if (Test-Path -Path $oldFile) { + Remove-Item -Path $newFile -Force + Copy-Item -Path $oldFile -Destination $newFile -Force + Remove-Item -Path $oldFile -Force + } + else { + Write-Warning 'No backup found of the grammar file!' + break + } + } + + if (Test-Path -Path $grammarPathx64) { + Set-GrammarFile $grammarPathx64 $grammarPathx64Backup + Write-Host 'Original grammar file restored! Please reload vscode' + } + + elseif (Test-Path -Path $grammarPathx86) { + Set-GrammarFile $grammarPathx86 $grammarPathx86Backup + Write-Host 'Original grammar file restored! Please reload vscode' + } + + else { + Write-Warning 'PowershellSyntax.tmLanguage not found!' + } +} +else { + Write-Warning 'PowerShell needs to run elevated (Run as Administrator) for this script to work!' +} + diff --git a/useThisGrammar.ps1 b/useThisGrammar.ps1 new file mode 100644 index 0000000..74cb524 --- /dev/null +++ b/useThisGrammar.ps1 @@ -0,0 +1,39 @@ +$grammarPathx64 = 'C:\Program Files\Microsoft VS Code\resources\app\extensions\powershell\syntaxes\PowershellSyntax.tmLanguage' +$grammarPathx64Backup = 'C:\Program Files\Microsoft VS Code\resources\app\extensions\powershell\syntaxes\PowershellSyntax.tmLanguage.old' +$grammarPathx86 = 'C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\powershell\syntaxes\PowershellSyntax.tmLanguage' +$grammarPathx86Backup = 'C:\Program Files (x86)\Microsoft VS Code\resources\app\extensions\powershell\syntaxes\PowershellSyntax.tmLanguage.old' +$grammarPath = Resolve-Path -Path '.\grammars\PowerShellSyntax.tmLanguage' +function Test-IsAdmin { + $windowsIdentity=[System.Security.Principal.WindowsIdentity]::GetCurrent() + $windowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($windowsIdentity) + $adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator + Write-Output ($windowsPrincipal.IsInRole($adm)) +} + +if (Test-IsAdmin) { + function Set-GrammarFile ($new,$original,$backup) { + if (-not (Test-Path -Path $backup)) { + Copy-Item -Path $original -Destination $backup -Force + } + Copy-Item -Path $new -Destination $original -Force + } + + if (Test-Path -Path $grammarPathx64) { + Set-GrammarFile $grammarPath $grammarPathx64 $grammarPathx64Backup + Write-Host 'New grammar file set! Please reload vscode' + } + + elseif (Test-Path -Path $grammarPathx86) { + Set-GrammarFile $grammarPath $grammarPathx86 $grammarPathx86Backup + Write-Host 'New grammar file set! Please reload vscode' + } + + else { + Write-Warning 'PowershellSyntax.tmLanguage not found!' + } +} +else { + Write-Warning 'PowerShell needs to run elevated (Run as Administrator) for this script to work!' +} + +