diff --git a/.gitattributes b/.gitattributes
index 7e37a585..70df0c49 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2,8 +2,6 @@
/.github/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
-CONTRIBUTING.md export-ignore
# Project and Dev Assets
-/bin/ export-ignore
*.sublime-project export-ignore
diff --git a/.github/workflows/syntax.yml b/.github/workflows/syntax.yml
index 19da5411..3203f970 100644
--- a/.github/workflows/syntax.yml
+++ b/.github/workflows/syntax.yml
@@ -1,7 +1,7 @@
name: Syntax Tests
+# https://github.com/sublimetext/syntax-test-action
on:
-
push:
branches:
- '**'
@@ -10,33 +10,36 @@ on:
paths:
- '.github/workflows/syntax.yml'
- '**.sublime-syntax'
- - '**/syntax_test*'
+ - '**/syntax_test_*'
- '**.tmPreferences'
pull_request:
paths:
- '.github/workflows/syntax.yml'
- '**.sublime-syntax'
- - '**/syntax_test*'
+ - '**/syntax_test_*'
- '**.tmPreferences'
types:
- - "opened"
- - "reopened"
- - "synchronize"
+ - 'opened'
+ - 'reopened'
+ - 'synchronize'
workflow_dispatch:
jobs:
main:
name: Syntax Tests (${{ matrix.build }})
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
strategy:
matrix:
include:
- - build: 4107
- packages: v4107
- build: latest
packages: master
- runs-on: ubuntu-latest
+ # - build: stable
+ # packages: binary
+ - build: 4204
+ packages: binary
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- uses: SublimeText/syntax-test-action@v2
with:
build: ${{ matrix.build }}
diff --git a/.gitignore b/.gitignore
index 43cdf864..12dd925f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,5 @@
-*.pyc
-*.cache
-
-# Editor files
-*.sublime-workspace
-
-# Temporary/generated files
-dist/
-MANIFEST
-*.YAML-tmLanguage
-
-# Other
-.idea
+# Editor files
+*.sublime-workspace
+
+# Other
+.idea
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 1660549a..00000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,50 +0,0 @@
-## Contributing
-
-Thanks for taking an interest in contributing to the PowerShell package for
-Sublime Text 3!
-
-
-### Development
-
-Development happens on the **dev** branch. Please send your PRs against that
-branch only.
-
-
-### Building Development Versions
-
-To build development versions, first you need a configuration file in
-`~\sublime-package-dev.json`.
-
-This file must contain the following information:
-
-``` json
-{
- "pathToSublimeText": "...\\sublime_text.exe",
- "pathToSublimeTextData": "...\\"
-}
-```
-
-
-#### Using Sublime Text
-
-1. Press Ctrl+Shift+B to open the build systems menu.
-2. Select 'PowerShell: Build Dev Version'
-
-
-#### Using the Command Line
-
-From the project's root:
-
-``` pwsh
-.\bin\BuildFolder.ps1 -verbose
-```
-
-#### Running Tests
-
-If you are adding functionality or making substantial changes to existing
-code, please add tests and ensure that existing tests pass.
-
-Currently, we have very few tests and they aren't easy to run... :-(
-
-If you feel lazy about writing tests, this is the right time to contribute --
-we'll turn a blind eye more often now than later on! ;-)
diff --git a/Default.sublime-keymap b/Default.sublime-keymap
new file mode 100644
index 00000000..e79b3f30
--- /dev/null
+++ b/Default.sublime-keymap
@@ -0,0 +1,46 @@
+[
+ {
+ "keys": ["\""],
+ "command": "chain",
+ "args": {
+ "commands": [{
+ "command": "insert",
+ "args": {"characters": "\"\n" },
+ }, {
+ "command": "run_macro_file",
+ "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"},
+ }, {
+ "command": "insert_snippet",
+ "args": {"contents": "$0\n\"@" },
+ }],
+ },
+ "context": [
+ { "key": "selection_empty", "match_all": true },
+ { "key": "selector", "operand": "source.powershell - comment - string", "match_all": true },
+ { "key": "preceding_text", "operator": "regex_contains", "operand": "@$", "match_all": true },
+ { "key": "following_text", "operator": "not_regex_contains", "operand": "^[\"@]", "match_all": true },
+ ]
+ },
+ {
+ "keys": ["'"],
+ "command": "chain",
+ "args": {
+ "commands": [{
+ "command": "insert",
+ "args": {"characters": "'\n" },
+ }, {
+ "command": "run_macro_file",
+ "args": {"file": "res://Packages/Default/Delete to Hard BOL.sublime-macro"},
+ }, {
+ "command": "insert_snippet",
+ "args": {"contents": "$0\n'@" },
+ }],
+ },
+ "context": [
+ { "key": "selection_empty", "match_all": true },
+ { "key": "selector", "operand": "source.powershell - comment - string", "match_all": true },
+ { "key": "preceding_text", "operator": "regex_contains", "operand": "@$", "match_all": true },
+ { "key": "following_text", "operator": "not_regex_contains", "operand": "^['@]", "match_all": true },
+ ]
+ },
+]
diff --git a/ISE Nostalgia.sublime-color-scheme b/ISE Nostalgia.sublime-color-scheme
index c94b433a..871484f7 100644
--- a/ISE Nostalgia.sublime-color-scheme
+++ b/ISE Nostalgia.sublime-color-scheme
@@ -10,6 +10,7 @@
"blue5": "#0000ff",
"blue6": "#6d79de",
"blue7":"#21439C",
+ "teal": "#297a7a",
"green": "#006400",
"green2": "#06960e",
"grey": "#a9a9a9",
@@ -29,7 +30,7 @@
},
"globals":
{
- "foreground": "var(purple)",
+ "foreground": "var(grey3)",
"background": "var(white)",
"caret": "var(grey2)",
// "invisibles": "var(grey2)",
@@ -49,8 +50,8 @@
},
{
"name": "Keyword",
- "scope": "keyword, storage",
- "foreground": "var(grey3)",
+ "scope": "keyword",
+ "foreground": "var(blue7)",
},
{
"name": "Number",
@@ -58,35 +59,41 @@
"foreground": "var(purple2)",
},
{
+ // ISE uses variable colors for constants, but let's not.
"name": "Built-in constant",
"scope": "constant.language",
"foreground": "var(blue4)",
},
{
"name": "Variable",
- "scope": "variable.language, variable.other",
+ "scope": "variable.other.readwrite, variable.language",
"foreground": "var(red2)",
},
{
"name": "String",
- "scope": "string",
+ "scope": "string.quoted",
"foreground": "var(red)",
},
{
- "name": "String interpolation",
- "scope": "constant.character.escape, string source",
+ "name": "String escape",
+ "scope": "constant.character.escape",
"foreground": "var(purple3)",
},
- // {
- // "name": "Function name",
- // "scope": "entity.name.function, support.function.any-method",
- // "foreground": "var(blue5)",
- // },
- // {
- // "name": "Type name",
- // "scope": "entity.name.type",
- // "font_style": "underline",
- // },
+ {
+ "name": "Attribute",
+ "scope": "support.function.attribute",
+ "foreground": "var(blue3)",
+ },
+ {
+ "name": "Function name",
+ "scope": "entity.name",
+ "foreground": "var(purple)",
+ },
+ {
+ "name": "Type name",
+ "scope": "meta.generic-name, support.type, storage.type - punctuation.definition",
+ "foreground": "var(teal)",
+ },
// {
// "name": "Inherited class name",
// "scope": "entity.other.inherited-class",
@@ -109,10 +116,20 @@
// "font_style": "italic",
// },
{
- "name": "Library function",
- "scope": "support.function",
+ "name": "Command",
+ "scope": "support.function, variable.function",
"foreground": "var(blue5)",
},
+ {
+ "name": "CLI option",
+ "scope": "variable.parameter.option",
+ "foreground": "var(blue7)",
+ },
+ {
+ "name": "CLI value",
+ "scope": "string.unquoted - meta.mapping.key",
+ "foreground": "var(purple)",
+ },
// {
// "name": "Library object",
// "scope": "support.class, support.type",
@@ -132,9 +149,14 @@
// "foreground": "var(blue7)",
// },
{
- "name": "PowerShell: Assignment Operator",
- "scope": "keyword.operator.assignment.powershell",
- "foreground": "var(grey)",
+ "name": "Operator",
+ "scope": "keyword.operator, meta.brackets.indexer punctuation.section.brackets",
+ "foreground": "var(grey2)",
+ },
+ {
+ "name": "Argument separator",
+ "scope": "punctuation.separator",
+ "foreground": "var(grey2)",
},
{
"name": "Invalid",
@@ -146,6 +168,6 @@
"name": "Invalid trailing whitespace",
"scope": "invalid.deprecated.trailing-whitespace",
"background": "var(red3)",
- }
- ]
+ },
+ ],
}
diff --git a/LICENSE.txt b/LICENSE.txt
index 0a8767aa..513b0e8f 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,5 +1,5 @@
Copyright (c) 2011-2015 Guillermo López-Anglada
- 2020-2021 Michael Lyons
+ 2020-2025 Michael Lyons
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
diff --git a/Main.sublime-menu b/Main.sublime-menu
new file mode 100644
index 00000000..7ac8f6b9
--- /dev/null
+++ b/Main.sublime-menu
@@ -0,0 +1,33 @@
+[{
+ "id": "preferences",
+ "children": [
+ {
+ "id": "package-settings",
+ "children": [
+ {
+ "caption": "PowerShell",
+ "children": [
+ {
+ "caption": "Settings",
+ "id": "powershell-settings",
+ "command": "edit_settings",
+ "args": {
+ "base_file": "${packages}/PowerShell/PowerShell.sublime-settings",
+ "default": "/* See the left pane for the list of settings and valid values. */\n{\n\t$0\n}\n",
+ },
+ },
+ {
+ "caption": "Key Bindings",
+ "id": "powershell-keymap",
+ "command": "edit_settings",
+ "args": {
+ "base_file": "${packages}/PowerShell/Default.sublime-keymap",
+ "default": "/* See the left pane for the shipped keybindings. */\n[\n\t$0\n]\n",
+ },
+ },
+ ]
+ },
+ ]
+ },
+ ]
+}]
diff --git a/Support/PowerShell.sublime-settings b/PowerShell.sublime-settings
similarity index 86%
rename from Support/PowerShell.sublime-settings
rename to PowerShell.sublime-settings
index 77a3a3b6..eb30a80e 100644
--- a/Support/PowerShell.sublime-settings
+++ b/PowerShell.sublime-settings
@@ -1,5 +1,4 @@
{
- "word_wrap": false,
"translate_tabs_to_spaces": true,
// Skip `-` in word separators
"word_separators": "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?",
diff --git a/PowerShell.sublime-syntax b/PowerShell.sublime-syntax
index 6372d331..f69ebfb6 100644
--- a/PowerShell.sublime-syntax
+++ b/PowerShell.sublime-syntax
@@ -1,6 +1,7 @@
%YAML 1.2
---
-# http://www.sublimetext.com/docs/3/syntax.html
+# http://www.sublimetext.com/docs/syntax.html
+# https://learn.microsoft.com/en-us/powershell/
name: PowerShell
scope: source.powershell
version: 2
@@ -12,77 +13,103 @@ file_extensions:
first_line_match: |-
(?x:
- ^\#!.*\b(?:pwsh|powershell)\b
+ ^\#!.*{{shebang_language}}
| ^\# \s* -\*- [^*]* mode: \s* powershell [^*]* -\*-
)
-variables:
- dec_exponent: (?:[eE][-+]?\d*)
- dec_suffix: '[dD]'
- float_suffix: '[dDlL]'
- int_suffix: (?i:u[lsy]?|[lnsy])
- unit_suffix: (?i:[kmgtp]b\b)
- kebab_break: (?![\w-])
-
contexts:
+ prototype:
+ - include: regions
+ - include: comments
- pop-before-newline:
- - match: (?=\n|$)
- pop: true
+ main:
+ - meta_include_prototype: false
+ - match: ''
+ push: [statements, imports, shebang]
- pop-at-newline:
- - match: \n|$
- pop: true
+ shebang:
+ - meta_include_prototype: false
+ - match: ^\s*(\#!)
+ captures:
+ 1: punctuation.definition.comment.powershell
+ set: shebang-body
+ - include: else-pop
+
+ shebang-body:
+ - meta_include_prototype: false
+ - meta_scope: comment.line.shebang.powershell
+ - match: '{{shebang_language}}'
+ scope: constant.language.shebang.powershell
+ - include: pop-eol
+
+ imports:
+ - include: using-directives
+ - include: else-pop
+
+ statements:
+ - include: classes
+ - include: functions
+ - include: workflows
+ - include: desired-state-configurations
+
+ - include: exceptions
+ - include: loops
+ - include: flow
+ - include: conditionals
+
+ - match: \B\.(?= )
+ scope: keyword.operator.source.powershell
+ push:
+ - include: commands-quoted
+ - include: else-pop
+ - match: \&
+ scope: keyword.operator.call.powershell
+ push:
+ - include: commands-quoted
+ - include: else-pop
- main:
- - include: regions
- - include: comments
- include: expressions
expressions:
- - include: redirection
+ - include: expressions-without-commands
- include: commands
- - include: variable
- - include: group
- - include: function
- - include: attribute
- - include: using-directive
- - include: type
- - include: hashtable
+
+ expressions-without-commands:
+ # Meta
+ - include: labels
+ - include: requires-directives
+
+ - include: escape-sequences
+
+ # Normal code
+ - include: types
- include: strings
- - include: script-block
- - include: escape-characters
- - include: numeric-constant
- - include: class-method
- - match: (@)(\()
- captures:
- 1: keyword.other.array.begin.powershell
- 2: punctuation.section.group.begin.powershell
- push:
- - meta_scope: meta.group.array-expression.powershell
- - match: \)
- scope: punctuation.section.group.end.powershell
- pop: true
- - include: main
- - match: (\$)(\()
- # TODO: move to repo; make recursive.
- captures:
- 1: keyword.other.variable.definition.powershell
- 2: punctuation.section.group.begin.powershell
- push:
- - meta_scope: meta.group.complex.subexpression.powershell
- - match: \)
- scope: punctuation.section.group.end.powershell
- pop: true
- - include: main
- - match: \b[\w.-]+\.(?i:exe|com|cmd|bat)\b
- scope: variable.function.powershell
- # Consume a string with a trailing dot
- # to prevent members with particular names from being recognized as keywords.
- - match: \b[\w-]+(?=\.)
- scope: variable.other.object.powershell
- push: members
- # Exceptions
+ - include: numbers
+ - include: constants
+ - include: variables
+
+ - include: hashtables
+ - include: arrays
+
+ - include: data-blocks
+ - include: script-blocks
+ - include: groups
+ - include: subexpressions
+
+ - include: future-reserved-words
+
+ - include: operators
+
+ future-reserved-words:
+ # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_reserved_words
+ - match: \b(?i:define|from){{kebab_break}}
+ scope: keyword.control.powershell
+ - match: \b(?i:var){{kebab_break}}
+ scope: keyword.declaration.variable.powershell
+
+###[ EXCEPTIONS ]##############################################################
+
+ exceptions:
- match: \b(?i:throw){{kebab_break}}
scope: keyword.control.exception.raise.powershell
- match: \b(?i:try){{kebab_break}}
@@ -91,29 +118,10 @@ contexts:
scope: keyword.control.exception.catch.powershell
- match: \b(?i:finally){{kebab_break}}
scope: keyword.control.exception.finally.powershell
- # Conditionals
- - match: \b(?i:if){{kebab_break}}
- scope: keyword.control.conditional.if.powershell
- - match: \b(?i:elseif){{kebab_break}}
- scope: keyword.control.conditional.elseif.powershell
- - match: \b(?i:else){{kebab_break}}
- scope: keyword.control.conditional.else.powershell
- - match: \b(?i:switch){{kebab_break}}
- scope: keyword.control.conditional.switch.powershell
- - match: \?
- scope: keyword.control.conditional.select.powershell
- - match: \b(?i:where(?!-object)){{kebab_break}}
- scope: keyword.control.conditional.select.powershell
- # Begin/End
- - match: \b(?i:begin){{kebab_break}}
- scope: keyword.context.block.begin.powershell
- - match: \b(?i:process){{kebab_break}}
- scope: keyword.context.block.process.powershell
- - match: \b(?i:end){{kebab_break}}
- scope: keyword.context.block.end.powershell
- - match: \b(?i:clean){{kebab_break}}
- scope: keyword.context.block.clean.powershell
- # Loops
+
+###[ LOOPS ]###################################################################
+
+ loops:
- match: \b(?i:for|foreach(?!-object)){{kebab_break}}
scope: keyword.control.loop.for.powershell
- match: \b(?i:do){{kebab_break}}
@@ -122,7 +130,10 @@ contexts:
scope: keyword.control.loop.while.powershell
- match: \b(?i:until){{kebab_break}}
scope: keyword.control.loop.repeat-until.powershell
- # Flow
+
+###[ FLOW ]####################################################################
+
+ flow:
- match: \b(?i:break){{kebab_break}}
scope: keyword.control.flow.break.powershell
- match: \b(?i:continue){{kebab_break}}
@@ -131,95 +142,815 @@ contexts:
scope: keyword.control.flow.exit.powershell
- match: \b(?i:return){{kebab_break}}
scope: keyword.control.flow.return.powershell
- # Declaration
- - match: \b(?i:var){{kebab_break}}
- # scope: storage.type.variable.powershell
- scope: keyword.declaration.variable.powershell
- - match: \b(?i:(?:dynamic)?param){{kebab_break}}
- scope: keyword.declaration.parameter.powershell # This scope is not standard
- # Uncategorized keywords
- - match: \b(?i:data|default|define|from|in|inlinescript|parallel|sequence){{kebab_break}}
- scope: keyword.control.powershell
- - match: \B--%\B
- scope: keyword.control.powershell
+
+###[ CONDITIONALS ]############################################################
+
+ conditionals:
+ - match: \b(?i:if){{kebab_break}}
+ scope: keyword.control.conditional.if.powershell
+ - match: \b(?i:elseif){{kebab_break}}
+ scope: keyword.control.conditional.elseif.powershell
+ - match: \b(?i:else){{kebab_break}}
+ scope: keyword.control.conditional.else.powershell
+ - match: \b(?i:switch){{kebab_break}}
+ scope: keyword.control.conditional.switch.powershell
+ push: in-command
+ - match: \b(?i:default){{kebab_break}}
+ scope: keyword.control.conditional.default.powershell
+ - match: \b(?i:where(?!-object)){{kebab_break}}
+ scope: keyword.control.conditional.select.powershell
+
+###[ GROUPS ]##################################################################
+
+ groups:
+ - match: \(
+ scope: punctuation.section.group.begin.powershell
+ push: inside-group
+
+ inside-group:
+ - meta_scope: meta.group.powershell
+ - match: \)
+ scope: punctuation.section.group.end.powershell
+ set: members
+ # TODO: Move this to a foreach (X in Y) construct
+ - match: \b(?i:in){{kebab_break}}
+ scope: keyword.control.loop.in.powershell
+ - include: attributes
+ - include: expressions
+
+ arrays:
+ - match: (@)(\()
+ captures:
+ 1: keyword.other.array.begin.powershell
+ 2: punctuation.section.group.begin.powershell
+ push: [members, inside-array]
+
+ inside-array:
+ - meta_scope: meta.group.array-expression.powershell
+ - match: \)
+ scope: punctuation.section.group.end.powershell
+ pop: 1
+ - include: expressions
+
+ hashtables:
+ - match: (@)(\{)
+ captures:
+ 1: keyword.other.hashtable.begin.powershell
+ 2: punctuation.section.braces.begin.powershell
+ push: [members, inside-hashtable]
+
+ inside-hashtable:
+ - meta_scope: meta.hashtable.powershell
+ - match: \}
+ scope: punctuation.section.braces.end.powershell
+ pop: 1
+ - match: \b(({{single_quote}}){{identifier_simple}}({{single_quote}}))\s*(=)\s*
+ captures:
+ 1: meta.mapping.key.powershell string.quoted.single.powershell
+ 2: punctuation.definition.string.begin.powershell
+ 3: punctuation.definition.string.end.powershell
+ 4: punctuation.separator.key-value.powershell
+ - match: \b(({{double_quote}}){{identifier_simple}}({{double_quote}}))\s*(=)\s*
+ captures:
+ 1: meta.mapping.key.powershell string.quoted.double.powershell
+ 2: punctuation.definition.string.begin.powershell
+ 3: punctuation.definition.string.end.powershell
+ 4: punctuation.separator.key-value.powershell
+ - match: \b({{identifier_simple}})\s*(=)\s*
+ captures:
+ 1: meta.mapping.key.powershell string.unquoted.powershell
+ 2: punctuation.separator.key-value.powershell
+ - include: expressions
+
+ subexpressions:
+ - match: (\$)(\()
+ captures:
+ 1: keyword.other.variable.definition.powershell
+ 2: punctuation.section.group.begin.powershell
+ push: inside-subexpression
+
+ inside-subexpression:
+ - meta_scope: meta.group.complex.subexpression.powershell
+ - match: \)
+ scope: punctuation.section.group.end.powershell
+ pop: 1
+ - include: expressions
+
+ script-blocks:
+ - match: (%)?(\{)
+ captures:
+ 1: keyword.control.loop.for.powershell
+ 2: punctuation.section.braces.begin.powershell
+ push: [members, inside-script-block]
+
+ inside-script-block:
+ - meta_scope: meta.block.powershell
+ - match: \}
+ scope: punctuation.section.braces.end.powershell
+ pop: 1
+ - include: param-block
+ - include: statements
+
+###[ COMMANDS ]################################################################
+
+ commands:
+ - include: commands-verb-noun
+ - include: commands-reserved
+ - include: script-invocation
+ - include: command-freeform
+
+ commands-verb-noun:
+ # The "Verb-Noun" pattern
+ - match: |-
+ (?x:
+ (?:[.\w\\/:-]*[\\/])? # Path stuff
+ {{command_verbs}} # Approved verbs
+ \-\w+? # Any "noun"
+ (?:\.(?i:exe|cmd|bat|ps1))?\b # More path stuff
+ )
+ scope: meta.function-call.powershell support.function.powershell
+ push: in-command
+
+ commands-reserved:
+ # Builtin cmdlets with reserved verbs
+ - match: \b(?i:(?:ForEach|Where|Sort|Tee)-Object)\b
+ scope: meta.function-call.powershell support.function.powershell
+ push: in-command
+
+ script-invocation:
+ - match: \b(?i:[a-z]:)?[\w.\\/-]+\.(?i:exe|com|cmd|bat|ps1)\b
+ scope: meta.function-call.powershell variable.function.powershell
+ push: in-command
+
+ commands-quoted:
+ - match: (?={{single_quote}})
+ push: [in-command, single-quoted-command-string]
+ - match: (?={{double_quote}})
+ push: [in-command, double-quoted-command-string]
+
+ single-quoted-command-string:
+ - match: '{{single_quote}}'
+ scope: punctuation.definition.string.begin.powershell
+ push: inside-single-quoted-command-string
+ - include: immediately-pop
+
+ inside-single-quoted-command-string:
+ - meta_include_prototype: false
+ - meta_scope: meta.string.powershell string.quoted.single.powershell meta.function-call.powershell variable.function.powershell
+ - match: '{{single_quote}}{2}'
+ scope: constant.character.escape.powershell
+ - match: '{{single_quote}}'
+ scope: punctuation.definition.string.end.powershell
+ pop: 1
+ - include: path-punctuation
+
+ double-quoted-command-string:
+ - match: '{{double_quote}}'
+ scope: punctuation.definition.string.begin.powershell
+ push: inside-double-quoted-command-string
+ - include: immediately-pop
+
+ inside-double-quoted-command-string:
+ - meta_include_prototype: false
+ - meta_scope: meta.string.interpolated.powershell string.quoted.double.powershell meta.function-call.powershell variable.function.powershell
+ - match: '{{double_quote}}{2}'
+ scope: constant.character.escape.powershell
+ - match: '{{double_quote}}'
+ scope: punctuation.definition.string.end.powershell
+ pop: 1
+ - include: escape-sequences
+ - include: string-interpolations
+ - include: path-punctuation
+
+ command-freeform:
+ - match: '{{identifier_function}}'
+ scope: meta.function-call.powershell variable.function.powershell
+ push: in-command
+
+ in-command:
+ - meta_content_scope: meta.function-call.arguments.powershell
+ - include: pop-end-of-command
+ - include: stop-parsing-token
+ - include: redirection
+ - include: cli-parameters
+ - include: expressions-without-commands
+ - match: (?=\S)
+ push: inside-unquoted-string
+
+ inside-unquoted-string:
+ - meta_include_prototype: false
+ - meta_scope: string.unquoted.powershell
+ - match: $|(?=[\s#|>;,()}])
+ pop: 1
+ - match: \{
+ push: inside-unquoted-string-brace
+ - include: path-punctuation
+ - include: escape-sequences
+ - include: string-wildcards
+
+ inside-unquoted-string-brace:
+ - meta_include_prototype: false
+ - match: \}
+ pop: 1
+ - include: inside-unquoted-string
+
+ pop-end-of-command:
+ - include: line-continuations
+ - include: pop-eol
+ - match: (?=[)}])
+ pop: 1
+ - include: pop-terminator
+ - include: pop-pipe
+
+ pop-terminator:
+ - match: ';'
+ scope: punctuation.terminator.statement.powershell
+ pop: 1
+
+ pop-pipe:
+ - match: (?:(\|)|(\|\||&&))\s*\n
+ captures:
+ 1: keyword.operator.pipe.powershell
+ 2: keyword.operator.pipe.conditional.powershell
push:
+ - match: ^
+ pop: 2
+ - match: \|\||&&
+ scope: keyword.operator.pipe.conditional.powershell
+ pop: 1
+ - match: \|
+ scope: keyword.operator.pipe.powershell
+ pop: 1
+
+ cli-parameters:
+ # Flags/Options/Parameters
+ - match: \B((--?|[/+])\p{L}(?:[\w-]*\w)?)([=:])?
+ scope:
+ captures:
+ 1: variable.parameter.option.powershell
+ 2: punctuation.definition.parameter.powershell
+ 3: keyword.operator.assignment.powershell
+
+ stop-parsing-token:
+ - match: \B--%\B
+ scope: keyword.control.stop-parsing.powershell
+ set:
+ - meta_include_prototype: false
+ - meta_scope: meta.function-call.arguments.powershell
- meta_content_scope: string.unquoted.powershell
- - include: pop-before-newline
+ - include: pop-before-eol
+ - include: pop-pipe
+
+###[ DIRECTIVES ]##############################################################
+
+ requires-directives:
+ - match: (#)((?i:requires))\s
+ captures:
+ 1: punctuation.definition.keyword.powershell
+ 2: keyword.control.import.require.powershell
+ push:
+ - meta_scope: meta.requires.powershell
+ - include: pop-eol
+ - include: hashtables
+ - match: (-)(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
+ scope: variable.parameter.option.powershell
+ captures:
+ 1: punctuation.definition.variable.powershell
+ - match: ','
+ scope: punctuation.separator.powershell
+
+ using-directives:
+ - match: \b(?i)using(?=\s)
+ scope: keyword.control.import.powershell
+ push: inside-using
+
+ inside-using:
+ - match: \bnamespace(?=\s)
+ scope: keyword.control.import.powershell
+ set: inside-using-namespace
+ - match: \bmodule(?=\s)
+ scope: keyword.control.import.powershell
+ set: inside-using-module
+ - include: else-pop
+
+ inside-using-namespace:
+ - include: pop-eol
+ - match: '{{identifier_csharp}}(\.)'
+ scope: meta.path.powershell
+ captures:
+ 1: punctuation.accessor.dot.powershell
+ - match: '{{identifier_csharp}}'
+ scope: meta.path.powershell
+
+ inside-using-module:
+ - include: pop-eol
+ - match: '{{identifier_csharp}}(\.)'
+ scope: meta.path.powershell
+ captures:
+ 1: punctuation.accessor.dot.powershell
+ - match: '{{identifier_csharp}}'
+ scope: meta.path.powershell support.type.powershell
+
+###[ CLASSES ]#################################################################
+
+ classes:
+ - match: \b(?i)class(?=\s)
+ scope: keyword.declaration.class.powershell
+ push: [class-body, class-parents, class-name]
+
+ class-name:
+ - match: '{{identifier_simple}}'
+ scope: entity.name.class.powershell
+ pop: 1
+ - include: else-pop
+
+ class-parents:
+ - match: ':'
+ scope: punctuation.separator.type.powershell
+ push: inside-class-parents
+ - include: else-pop
+
+ inside-class-parents:
+ - include: comma-separators
+ - match: '{{identifier_simple}}'
+ scope: entity.other.inherited-class.powershell
+ - include: else-pop
+
+ class-body:
+ - meta_scope: meta.class.powershell
+ - match: \{
+ scope: punctuation.section.block.begin.powershell
+ push: inside-class-body
+ - include: else-pop
+
+ inside-class-body:
+ - match: \}
+ scope: punctuation.section.block.end.powershell
+ pop: 1
- match: \b(?i:hidden|static)\b
- # This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.
scope: storage.modifier.powershell
- - match: \b((?i:class))\s+([\w-]+)\b
+ - include: attributes
+ - include: types-without-members
+ - include: variables-without-members
+ - match: (?={{identifier_simple}})
+ push: [function-body, function-inline-params, function-name]
+
+###[ FUNCTIONS ]###############################################################
+
+ functions:
+ - match: ^\s*(?i)(function|filter)(?=\s)
+ captures:
+ 1: keyword.declaration.function.powershell
+ push: [function-body, function-inline-params, function-name]
+
+ function-name:
+ - match: (?:(global|local|script|private):)?({{identifier_function}})
+ captures:
+ 1: storage.modifier.scope.powershell
+ 2: entity.name.function.powershell
+ - match: (?=[{(])
+ pop: 1
+
+ function-inline-params:
+ - match: \(
+ scope: punctuation.section.parameters.begin.powershell
+ push: inside-function-inline-params
+ - include: else-pop
+
+ inside-function-inline-params:
+ - match: \)
+ scope: punctuation.section.parameters.end.powershell
+ pop: 1
+ - include: comma-separators
+ - include: types
+ - match: (\$){{identifier_simple}}
+ scope: variable.parameter.powershell
+ captures:
+ 1: punctuation.definition.variable.begin.powershell
+ - include: assignment-normal
+
+ function-body:
+ - meta_scope: meta.function.powershell
+ - match: \{
+ scope: punctuation.section.block.begin.powershell
+ push: inside-function-body
+ - include: else-pop
+
+ inside-function-body:
+ - match: \}
+ scope: punctuation.section.block.end.powershell
+ pop: 2
+
+ - include: param-block
+
+ - match: \b(?i:Begin|Process|End|Clean){{kebab_break}}
+ scope: keyword.context.block.powershell
+ push: expect-function-context
+
+ - include: attributes
+ - include: workflow-execution-contexts
+ - include: statements
+
+ param-block:
+ - match: \b(?i:(?:Dynamic)?Param){{kebab_break}}
+ scope: keyword.declaration.parameter.powershell # This scope is not standard
+ push: expect-param-context
+
+ expect-function-context:
+ - meta_scope: meta.block.powershell
+ - match: \{
+ scope: punctuation.section.block.begin.powershell
+ push: inside-function-context
+ - include: else-pop
+
+ inside-function-context:
+ - match: \}
+ scope: punctuation.section.block.end.powershell
+ pop: 2
+ - include: workflow-execution-contexts
+ - include: statements
+
+ expect-param-context:
+ - match: \(
+ scope: punctuation.section.block.begin.powershell
+ push: inside-param-context
+ - include: else-pop
+
+ inside-param-context:
+ - meta_scope: meta.block.parameters.powershell
+ - match: \)
+ scope: punctuation.section.block.end.powershell
+ pop: 2
+ - include: comma-separators
+ - include: attributes
+ - include: types-without-members
+ - include: variables-without-members
+ - include: literals
+ - include: assignment-normal
+
+ attributes:
+ - match: (\[)\s*(ValidatePattern)
+ captures:
+ 1: punctuation.section.brackets.begin.powershell
+ 2: support.function.attribute.powershell
+ push: inside-attribute
+ with_prototype:
+ - include: regex-strings
+ - match: (\[)\s*({{attributes}})
+ captures:
+ 1: punctuation.section.brackets.begin.powershell
+ 2: support.function.attribute.powershell
+ push: inside-attribute
+
+ inside-attribute:
+ - meta_scope: meta.attribute.powershell
+ - match: \]
+ scope: punctuation.section.brackets.end.powershell
+ pop: 1
+ - match: \(
+ scope: punctuation.section.group.begin.powershell
+ push: inside-attribute-parameters
+
+ inside-attribute-parameters:
+ - match: \)
+ scope: punctuation.section.group.end.powershell
+ pop: 1
+ - match: ({{attribute_parameters}})\s*(=)?
+ captures:
+ 1: variable.parameter.attribute.powershell
+ 2: keyword.operator.assignment.powershell
+ - include: expressions
+
+###[ WORKFLOWS ]###############################################################
+
+ workflows:
+ - match: ^\s*(?i)(workflow)(?=\s)
+ captures:
+ 1: keyword.declaration.function.powershell
+ push: [function-body, function-name]
+
+ workflow-body:
+ - meta_scope: meta.function.powershell
+ - match: \{
+ scope: punctuation.section.block.begin.powershell
+ push: inside-workflow-body
+ with_prototype:
+ - include: workflow-execution-contexts
+ - include: else-pop
+
+ inside-workflow-body:
+ - match: \}
+ scope: punctuation.section.block.end.powershell
+ pop: 2
+ - include: statements
+
+ workflow-execution-contexts:
+ - match: \b(?i:inlinescript){{kebab_break}}
+ scope: keyword.control.context.powershell
+ push: expect-function-context
+ - match: \b(?i:parallel|sequence){{kebab_break}}
+ scope: keyword.control.flow.powershell
+ push: expect-function-context
+
+###[ DESIRED STATE CONFIGURATIONS ]############################################
+
+ desired-state-configurations:
+ - match: ^\s*(?i)(configuration)(?=\s)
+ captures:
+ 1: keyword.declaration.function.powershell
+ push:
+ - desired-state-configuration-body
+ - desired-state-configuration-name
+
+ desired-state-configuration-name:
+ - match: '{{identifier_function}}'
+ scope: entity.name.function.powershell
+ - match: (?=[{(])
+ pop: 1
+
+ desired-state-configuration-body:
+ - meta_scope: meta.function.powershell
+ - match: \{
+ scope: punctuation.section.block.begin.powershell
+ push: inside-desired-state-configuration-body
+ - include: else-pop
+
+ inside-desired-state-configuration-body:
+ - match: \}
+ scope: punctuation.section.block.end.powershell
+ pop: 2
+
+ - match: \b(?i:Param){{kebab_break}}
+ scope: keyword.declaration.parameter.powershell # This scope is not standard
+ push: expect-param-context
+
+ - match: \b(?i:Node){{kebab_break}}
+ scope: keyword.context.block.powershell
+ push: expect-node-context
+
+ - include: attributes
+
+ expect-node-context:
+ - match: \{
+ scope: punctuation.section.block.begin.powershell
+ push: inside-node-context
+ - include: expressions
+ - include: else-pop
+
+ inside-node-context:
+ - match: \}
+ scope: punctuation.section.block.end.powershell
+ pop: 2
+ - match: \b((?i:WindowsFeature))\s+({{identifier_csharp}})
captures:
- 1: storage.type.class.powershell
- 2: meta.class.powershell entity.name.class.powershell
- # Operators...
- - match: \B(-)(?i:as){{kebab_break}}
+ 1: keyword.other.powershell
+ 2: entity.name.label.powershell
+ - include: expressions
+
+###[ VARIABLES ]###############################################################
+
+ variables:
+ - match: '{{var_lookahead}}'
+ push: [members, expect-variable]
+
+ variables-without-members:
+ - match: '{{var_lookahead}}'
+ push: [expect-variable]
+
+ expect-variable:
+ - match: (\$|@){{var_constants}}
+ scope: support.constant.variable.powershell
+ captures:
+ 1: punctuation.definition.variable.powershell
+ - match: (\$|@){{var_language}}
+ scope: variable.language.powershell
+ captures:
+ 1: punctuation.definition.variable.powershell
+ - match: (\$)(\{)
+ captures:
+ 1: punctuation.definition.variable.powershell
+ 2: punctuation.section.interpolation.begin.powershell
+ push: inside-variable-special-char
+ - match: (\$|@)
+ captures:
+ 1: punctuation.definition.variable.powershell
+ 2: punctuation.section.interpolation.begin.powershell
+ push: inside-variable-simple
+ - include: immediately-pop
+
+ inside-variable-simple:
+ - meta_include_prototype: false
+ - meta_scope: variable.other.readwrite.powershell
+ - match: ({{var_scope_mod}})(:)
+ captures:
+ 1: storage.modifier.scope.powershell
+ 2: punctuation.accessor.colon.powershell
+ - match: ({{identifier_simple}})(:)
+ captures:
+ 1: support.variable.drive.powershell
+ 2: punctuation.accessor.colon.powershell
+ - match: '{{identifier_simple}}'
+ - include: immediately-pop
+
+ inside-variable-special-char:
+ - meta_include_prototype: false
+ - meta_scope: variable.other.readwrite.powershell
+ - match: '`.'
+ scope: constant.character.escape.powershell
+ - match: \}
+ scope: punctuation.section.interpolation.end.powershell
+ pop: 1
+ - match: ({{var_scope_mod}})(:)
+ captures:
+ 1: storage.modifier.scope.powershell
+ 2: punctuation.accessor.colon.powershell
+ - match: ({{identifier_simple}})(:)
+ captures:
+ 1: support.variable.drive.powershell
+ 2: punctuation.accessor.colon.powershell
+
+ members:
+ - match: (?=\.\.)
+ pop: 1
+ - match: \?\.(?=\$?{{identifier_simple}})
+ scope: punctuation.accessor.null-coalescing.powershell
+ - match: \??\.(?=\$?{{identifier_simple}})
+ scope: punctuation.accessor.dot.powershell
+ - match: ::(?={{identifier_simple}})
+ scope: punctuation.accessor.double-colon.powershell
+ - match: (new)(\()
+ captures:
+ 1: meta.function-call.powershell support.function.constructor.powershell
+ 2: meta.function-call.arguments.powershell punctuation.section.arguments.begin.powershell
+ push: inside-function-call-arguments
+ - match: ({{identifier_simple}})(\()
+ captures:
+ 1: meta.function-call.powershell variable.function.powershell
+ 2: meta.function-call.arguments.powershell punctuation.section.arguments.begin.powershell
+ push: inside-function-call-arguments
+ - match: '{{identifier_simple}}'
+ scope: variable.other.member.powershell
+ - match: (\?)(\[)
+ captures:
+ 1: punctuation.accessor.null-coalescing.powershell
+ 2: punctuation.section.brackets.begin.powershell
+ push: inside-indexer
+ - match: \[
+ scope: punctuation.section.brackets.begin.powershell
+ push: inside-indexer
+ - include: immediately-pop
+
+ inside-function-call-arguments:
+ - meta_content_scope: meta.function-call.arguments.powershell
+ - match: \)
+ scope: meta.function-call.arguments.powershell punctuation.section.arguments.end.powershell
+ pop: 1
+ - include: expressions
+
+ inside-indexer:
+ - meta_scope: meta.brackets.indexer.powershell
+ - match: \]
+ scope: punctuation.section.brackets.end.powershell
+ pop: 1
+ - include: expressions
+
+###[ TYPES ]###################################################################
+
+ types:
+ - match: \[
+ scope: punctuation.section.brackets.begin.powershell
+ push: [members, inside-type]
+
+ types-without-members:
+ - match: \[
+ scope: punctuation.section.brackets.begin.powershell
+ push: inside-type
+
+ inside-type:
+ - meta_include_prototype: false
+ - match: \]
+ scope: punctuation.section.brackets.end.powershell
+ pop: 1
+ - match: \p{L}[\p{L}\p{N}]+(\.)
+ scope: meta.generic-name.powershell
+ captures:
+ 1: punctuation.accessor.dot.powershell
+ - match: '{{builtin_types}}'
+ scope: storage.type.powershell
+ - match: \p{L}[\p{L}\p{N}]+
+ scope: support.type.powershell
+ - include: types-without-members
+ - match: \,
+ scope: punctuation.separator.sequence.powershell
+ - match: \+
+ scope: punctuation.accessor.plus.powershell
+
+###[ OPERATORS ]###############################################################
+
+ operators:
+ - include: operator-words
+ - include: operator-symbols
+
+ operator-words:
+ # RegExp context
+ - match: (-)(?i:[ic]?(?:not)?(?:match)){{operator_break}}
+ scope: keyword.operator.logical.powershell
+ captures:
+ 1: punctuation.definition.keyword.powershell
+ push: expect-regex-string
+ - match: (-)(?i:replace){{operator_break}}
+ scope: keyword.operator.string.powershell
+ captures:
+ 1: punctuation.definition.keyword.powershell
+ push: expect-regex-string
+
+ - match: (-)(?i:as){{operator_break}}
scope: keyword.operator.cast.powershell
captures:
1: punctuation.definition.keyword.powershell
- - match: \B(-)(?i:[ic]?(?:eq|ne|[gl][te])){{kebab_break}}
+ - match: (-)(?i:[ic]?(?:eq|ne|[gl][te])){{operator_break}}
scope: keyword.operator.comparison.powershell
captures:
1: punctuation.definition.keyword.powershell
- - match: \B(-)(?i:[ic]?(?:not)?(?:like|match|contains|in)){{kebab_break}}
+ - match: (-)(?i:[ic]?(?:not)?(?:like|contains|in)){{operator_break}}
scope: keyword.operator.logical.powershell
captures:
1: punctuation.definition.keyword.powershell
- - match: \B(-)(?i:join|split|replace){{kebab_break}}
+ - match: (-)(?i:join|split){{operator_break}}
scope: keyword.operator.string.powershell
captures:
1: punctuation.definition.keyword.powershell
- - match: \B(-)(?i:is(?:not)?){{kebab_break}}
+ - match: (-)(?i:is(?:not)?){{operator_break}}
scope: keyword.operator.logical.powershell
captures:
1: punctuation.definition.keyword.powershell
- - match: \B(-)(?i:and|or|not|xor){{kebab_break}}|! # <-- note `!`
+ - match: (-)(?i:and|or|not|xor){{operator_break}}
scope: keyword.operator.logical.powershell
captures:
1: punctuation.definition.keyword.powershell
- - match: \B(-)(?i:band|bor|bnot|bxor|sh[lr]){{kebab_break}}
+ - match: (-)(?i:band|bor|bnot|bxor|sh[lr]){{operator_break}}
scope: keyword.operator.bitwise.powershell
captures:
1: punctuation.definition.keyword.powershell
- - match: \B(-)(?i:f){{kebab_break}}
+ - match: (-)(?i:f){{operator_break}}
scope: keyword.operator.string-format.powershell
captures:
1: punctuation.definition.keyword.powershell
- # Flags/Options/Parameters
- - match: \B(--?|[/+])\p{L}(?:[\w-]*\w)?
- scope: variable.parameter.option.powershell
- captures:
- 1: punctuation.definition.parameter.powershell
- # Operators continue...
- - match: '[+/*%-]?='
- scope: keyword.operator.assignment.powershell
- - match: (?:\+\+|--)(?![ \t]*\d)
+
+ operator-symbols:
+ # Pipes
+ - match: \|\||&&
+ scope: keyword.operator.pipe.conditional.powershell
+ - match: \|
+ scope: keyword.operator.pipe.powershell
+
+ # Assignment with context
+ - include: assignment-normal
+ - match: (?:[+/*%-]|\?\?)=
+ scope: keyword.operator.assignment.augmented.powershell
+ push: in-assignment
+ # Assignment same context
+ - match: (?:\+\+|--)(?![ \t]*\d|[[:alpha:]])
scope: keyword.operator.assignment.powershell
- - match: '[+-](?=\.?\d)' # This is sort of heuristic
+
+ # Heuristically guess the context with lookaheads
+ # Mostly to avoid matching CLI parameters
+ - match: '[+-](?=\.?\d)'
scope: keyword.operator.unary.powershell
- - match: '[+/*-]'
+ - match: '[/+](?![[:alpha:]])'
+ scope: keyword.operator.arithmetic.powershell
+ - match: -(?![[:alpha:]-])
scope: keyword.operator.arithmetic.powershell
+ - match: \*(?!\.?[[:alpha:]])
+ scope: keyword.operator.arithmetic.powershell
+ - match: \.\.(?=\-?\d|\(|\$)
+ scope: keyword.operator.range.powershell
+ # Exclude foreach shortcut
- match: '%(?!\s*\{)'
scope: keyword.operator.arithmetic.powershell
- - match: \|\||&&
+
+ - match: \!
scope: keyword.operator.logical.powershell
- - match: \|
- scope: keyword.operator.logical.pipe.powershell
+ - match: \?\?
+ scope: keyword.operator.null-coalescing.powershell
+ - match: '[?:]'
+ scope: keyword.operator.ternary.powershell
- match: ;
scope: punctuation.terminator.statement.powershell
- - match: \`(?=\n|$)
- scope: punctuation.separator.continuation.line.powershell
- - match: ','
- scope: punctuation.separator.sequence.powershell
- - match: '&|\B\.(?= )'
- scope: keyword.operator.other.powershell
- - match: \.\.(?=\-?\d|\(|\$)
- # This is very imprecise. Is there a syntax for 'must come after...'?
- scope: keyword.operator.range.powershell
+ - include: comma-separators
+ - match: '&'
+ scope: keyword.operator.background.powershell
- comments:
- - include: comment-block
- - include: comment-line
+ assignment-normal:
+ - match: =
+ scope: keyword.operator.assignment.powershell
+ push: in-assignment
+
+ in-assignment:
+ - include: pop-end-of-command
+ # INFO: Someday maybe we can nix the workflow stuff
+ - include: workflow-execution-contexts
+ - include: expressions
redirection:
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection
@@ -237,333 +968,287 @@ contexts:
# - match: <+
# scope: invalid.illegal.powershell
- requires-directive:
- # TODO: add back `(?<=#)`-equivalent match
- - match: (#)((?i:requires))\s
- captures:
- 1: punctuation.definition.keyword.powershell
- 2: keyword.control.import.require.powershell
- push:
- - meta_scope: meta.requires.powershell
- - include: pop-at-newline
- - include: hashtable
- - match: (-)(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
- scope: variable.parameter.option.powershell
- captures:
- 1: punctuation.definition.variable.powershell
- - match: ','
- scope: punctuation.separator.powershell
+###[ DATA BLOCK ]##############################################################
- using-directive:
- - match: \b(?i:(using))\s+(?i:(namespace|module))\s+(?i:((?:\w+(?:\.)?)+))
- captures:
- 1: keyword.control.using.powershell
- 2: keyword.other.powershell
- 3: variable.parameter.powershell
+ data-blocks:
+ - match: \b(?i:data){{kebab_break}}
+ scope: keyword.control.context.powershell
+ push: [data-block-body, data-block-name]
- attribute:
- - match: |-
- (?xi:
- (\[)\s*
- (
- CmdletBinding | Alias | OutputType | Parameter
- | Validate
- (?:
- Count | NotNull(?:OrEmpty)? | Range | Pattern | Length | Set
- | Script)
- | Allow(?: Null | Empty(?: Collection | String ))
- )\b
- )
- captures:
- 1: punctuation.section.brackets.begin.powershell
- 2: support.function.attribute.powershell
- push:
- - meta_scope: meta.attribute.powershell
- - match: \]
- scope: punctuation.section.brackets.end.powershell
- pop: true
- - match: \(
- scope: punctuation.section.group.begin.powershell
- push:
- - match: \)
- scope: punctuation.section.group.end.powershell
- pop: true
- - include: variable
- - include: variable-no-property
- - include: hashtable
- - include: script-block
- - include: escape-characters
- - include: double-quoted-string
- - include: type
- - include: numeric-constant
- - include: main
- - match: |-
- (?xi:
- \b(
- Mandatory | ValueFromPipeline(?:ByPropertyName)?
- | ValueFromRemainingArguments | Position(?:alBinding)?
- | (?:Default)?ParameterSetName | SupportsShouldProcess | SupportsPaging
- | HelpUri | ConfirmImpact | HelpMessage
- )\b
- \s*(=)?
- )
- captures:
- 1: variable.parameter.attribute.powershell
- 2: keyword.operator.assignment.powershell
- - match: \'
- scope: punctuation.definition.string.begin.powershell
- push:
- - meta_scope: string.quoted.single.powershell
- - match: \'\'
- scope: constant.character.escape.powershell
- - match: \'
- scope: punctuation.definition.string.end.powershell
- pop: true
+ data-block-name:
+ - match: '{{identifier_simple}}'
+ scope: entity.name.section.powershell
+ pop: 1
+ - include: else-pop
- commands:
- # "Verb-Noun pattern:"
- - match: |-
- (?x:
- (?:[\w\\:-]*\\)? # Path stuff
- \b(?i:
- Add | Approve | Assert | Backup | Block | Build | Checkpoint # "Official" Verbs
- | Clear | Close | Compare | Complete | Compress | Confirm | Connect
- | Convert | ConvertFrom | ConvertTo | Copy | Debug | Deny | Deploy
- | 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+? # Any "noun"
- (?:\.(?i:exe|cmd|bat|ps1))?\b # More path stuff
- )
- scope: meta.function-call.powershell support.function.powershell
- # Builtin cmdlets with reserved verbs
- - match: \b(?i:(?:foreach|where|sort|tee)-object)\b
- scope: support.function.powershell
+ data-block-body:
+ - meta_scope: meta.block.data.powershell
+ - match: \{
+ scope: punctuation.section.block.begin.powershell
+ push: inside-data-block
+ - include: else-pop
- comment-block:
- - match: <#
- scope: punctuation.definition.comment.block.begin.powershell
- push:
- - meta_scope: comment.block.powershell
- - match: '#>'
- scope: punctuation.definition.comment.block.end.powershell
- pop: true
- - include: comment-embedded-docs
+ inside-data-block:
+ - match: \}
+ scope: punctuation.section.block.end.powershell
+ pop: 2
+ # Data sections use a subset of Pwsh, but we don't distinguish yet.
+ - include: statements
- comment-embedded-docs:
- # TODO
- # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help
- - match: |-
- (?xi:
- ^\s*(\.)
- (
- Component | Description | Example | ExternalHelp | ForwardHelpCategory | ForwardHelpTargetName
- | Functionality | Inputs | Link | Notes | Outputs | Parameter | RemoteHelpRunSpace
- | Role | Synopsis
- )
- )
- scope: comment.documentation.embedded.powershell
+###[ CONSTANTS ]###############################################################
+
+ constants:
+ - match: (?i)(\$)True\b
+ scope: constant.language.boolean.true.powershell
captures:
- 1: punctuation.definition.keyword.documentation.powershell
- 2: keyword.other.documentation.powershell
- - match: ^\s*(\.)(?i:(Parameter)\s+([a-z0-9-_]+))
- scope: comment.documentation.embedded.powershell
+ 1: punctuation.definition.variable.powershell
+ - match: (?i)(\$)False\b
+ scope: constant.language.boolean.false.powershell
captures:
- 1: punctuation.definition.keyword.documentation.powershell
- 2: keyword.other.documentation.param.powershell
- 3: variable.parameter.powershell
- - match: ^\s*(\.)(?i:(ForwardHelpTargetName|ForwardHelpCategory|ExternalHelp|Link)\s+([a-z0-9-_]+))
- scope: comment.documentation.embedded.powershell
+ 1: punctuation.definition.variable.powershell
+ - match: (?i)(\$)Null\b
+ scope: constant.language.null.powershell
captures:
- 1: punctuation.definition.keyword.documentation.powershell
- 2: keyword.other.documentation.powershell
- 3: markup.underline.link.powershell
-
- comment-line:
- - include: requires-directive
- - match: '#'
- scope: punctuation.definition.comment.powershell
- push:
- - meta_scope: comment.line.powershell
- - include: pop-at-newline
- - include: comment-embedded-docs
+ 1: punctuation.definition.variable.powershell
- static-members:
- # - meta_content_scope: debug.in.static-members
- - match: '::'
- scope: punctuation.accessor.double-colon.powershell
- set: members
+###[ LITERALS ]################################################################
- members:
- # - meta_content_scope: debug.in.members
- - match: (?=\.\.)
- pop: true
- - match: \.(?=\w)
- scope: punctuation.accessor.dot.powershell
- - match: (\w+)(\()
- captures:
- 1: meta.function-call.powershell variable.function.powershell
- 2: meta.function-call.arguments.powershell punctuation.section.arguments.begin.powershell
- push:
- - meta_content_scope: meta.function-call.arguments.powershell
- - match: \)
- scope: meta.function-call.arguments.powershell punctuation.section.arguments.end.powershell
- pop: true
- - include: expressions
- - match: \w+
- scope: variable.other.member.powershell
- - match: \[
- scope: punctuation.section.brackets.begin.powershell
- push:
- - meta_scope: meta.brackets.indexer.powershell
- - match: \]
- scope: punctuation.section.brackets.end.powershell
- pop: true
- - include: expressions
- - match: ''
- pop: true
+ literals:
+ - include: strings
+ - include: numbers
strings:
- - include: double-quoted-string
- - include: single-quoted-string
- - match: \@"(?=$)
- scope: punctuation.definition.string.begin.powershell
- push:
- - meta_scope: meta.string.powershell string.quoted.double.heredoc.powershell
- - match: ^"@
- scope: punctuation.definition.string.end.powershell
- pop: true
- - include: escape-characters
- - include: interpolation
- - match: \@'(?=$)
+ - include: double-quoted-strings
+ - include: single-quoted-strings
+ - include: double-quoted-heredoc-strings
+ - include: single-quoted-heredoc-strings
+
+ expect-regex-string:
+ - include: regex-strings
+ - include: comma-separators
+ - include: else-pop
+ - include: pop-eol
+
+ regex-strings:
+ - match: '{{single_quote}}'
+ scope: meta.string.powershell string.quoted.single.powershell punctuation.definition.string.begin.powershell
+ embed: scope:source.regexp
+ embed_scope: meta.string.powershell source.regexp.embedded
+ escape: ({{single_quote}})
+ escape_captures:
+ 1: meta.string.powershell string.quoted.single.powershell punctuation.definition.string.end.powershell
+
+ single-quoted-strings:
+ - match: '{{single_quote}}'
scope: punctuation.definition.string.begin.powershell
- push:
- - meta_scope: meta.string.powershell string.quoted.single.heredoc.powershell
- - match: ^'@
- scope: punctuation.definition.string.end.powershell
- pop: true
- - match: "''"
- scope: constant.character.escape.powershell
+ push: inside-single-quoted-string
+
+ inside-single-quoted-string:
+ - meta_include_prototype: false
+ - meta_scope: meta.string.powershell string.quoted.single.powershell
+ - match: '{{single_quote}}{2}'
+ scope: constant.character.escape.powershell
+ - match: '{{single_quote}}'
+ scope: punctuation.definition.string.end.powershell
+ pop: 1
+ - include: single-quoted-string-placeholders
- single-quoted-string:
- - match: \'
+ double-quoted-strings:
+ - match: '{{double_quote}}'
scope: punctuation.definition.string.begin.powershell
- push:
- - meta_scope: meta.string.powershell string.quoted.single.powershell
- - match: "''"
- scope: constant.character.escape.powershell
- - match: \'
- scope: punctuation.definition.string.end.powershell
- pop: true
+ push: inside-double-quoted-string
+
+ inside-double-quoted-string:
+ - meta_include_prototype: false
+ - meta_scope: meta.string.interpolated.powershell string.quoted.double.powershell
+ - match: '{{double_quote}}{2}'
+ scope: constant.character.escape.powershell
+ - match: '{{double_quote}}'
+ scope: punctuation.definition.string.end.powershell
+ pop: 1
+ - include: escape-sequences
+ - include: string-interpolations
+ - include: double-quoted-string-placeholders
- double-quoted-string:
- - match: '"'
+ single-quoted-heredoc-strings:
+ - match: \@{{single_quote}}(?=$)
scope: punctuation.definition.string.begin.powershell
push:
- - meta_scope: meta.string.powershell string.quoted.double.powershell
- - match: '""'
+ - inside-single-quoted-heredoc-string
+ - inside-single-quoted-heredoc-string.syntax
+
+ inside-single-quoted-heredoc-string.syntax:
+ - meta_include_prototype: false
+ - match: (?={{csharp_indicator}})
+ set: scope:source.cs.embedded.powershell
+ with_prototype:
+ - match: (?=^{{single_quote}}@)
+ pop: 1
+ - match: '{{single_quote}}{2}'
scope: constant.character.escape.powershell
- - include: escape-characters
- - match: '"'
- scope: punctuation.definition.string.end.powershell
- pop: true
- - match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
- - include: interpolation
- - match: '`\s*$'
- scope: keyword.other.powershell
-
- escape-characters:
- - match: '`[0abenfrvt"''$`]'
- scope: constant.character.escape.powershell
- - match: '`u\{\h+\}'
+ - include: else-pop
+
+ inside-single-quoted-heredoc-string:
+ - meta_include_prototype: false
+ - meta_scope: meta.string.powershell string.quoted.single.heredoc.powershell
+ - match: ^{{single_quote}}@
+ scope: punctuation.definition.string.end.powershell
+ pop: 1
+ - match: '{{single_quote}}{2}'
scope: constant.character.escape.powershell
+ - include: single-quoted-string-placeholders
- function:
- - match: ^(?:\s*)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)
- scope: meta.function.powershell
- captures:
- 1: storage.type.powershell
- 2: storage.modifier.scope.powershell
- 3: entity.name.function.powershell
+ double-quoted-heredoc-strings:
+ - match: \@{{double_quote}}(?=$)
+ scope: punctuation.definition.string.begin.powershell
push:
- - match: (?=\{|\()
- pop: true
- - include: comment-line
+ - inside-double-quoted-heredoc-string
+ - inside-double-quoted-heredoc-string.syntax
- hashtable:
- - match: (@)(\{)
- captures:
- 1: keyword.other.hashtable.begin.powershell
- 2: punctuation.section.braces.begin.powershell
- push:
- - meta_scope: meta.hashtable.powershell
- - match: \}
- scope: punctuation.section.braces.end.powershell
- pop: true
- - match: \b(['"]?)(\w+)(['"]?)\s*(=)\s*
- scope: meta.hashtable.assignment.powershell
- captures:
- 1: punctuation.definition.string.begin.powershell
- 2: variable.other.readwrite.powershell
- 3: punctuation.definition.string.end.powershell
- 4: keyword.operator.assignment.powershell
- - include: script-block
- - include: main
-
- group:
- - match: \(
- scope: punctuation.section.group.begin.powershell
- push:
- - meta_scope: meta.group.powershell
- - match: \)
- scope: punctuation.section.group.end.powershell
- pop: true
- - include: main
+ inside-double-quoted-heredoc-string:
+ - meta_include_prototype: false
+ - meta_scope: meta.string.interpolated.powershell string.quoted.double.heredoc.powershell
+ - match: ^{{double_quote}}@
+ scope: punctuation.definition.string.end.powershell
+ pop: 1
+ - include: escape-sequences
+ - include: string-interpolations
+ - include: double-quoted-string-placeholders
+
+ inside-double-quoted-heredoc-string.syntax:
+ - meta_include_prototype: false
+ - match: (?={{csharp_indicator}})
+ set: scope:source.cs.embedded.powershell
+ with_prototype:
+ - match: (?=^{{double_quote}}@)
+ pop: 1
+ - include: escape-sequences
+ - include: else-pop
- interpolation:
+ string-interpolations:
- match: \$\(
scope: punctuation.section.interpolation.begin.powershell
push:
- clear_scopes: 1
+ - meta_include_prototype: false
- meta_scope: meta.interpolation.powershell
- meta_content_scope: source.powershell.embedded
- match: \)
scope: punctuation.section.interpolation.end.powershell
- pop: true
- - include: main
+ pop: 1
+ - include: expressions
- match: (?=\$)
push:
- clear_scopes: 1
+ - meta_include_prototype: false
- meta_scope: meta.interpolation.powershell
- - include: variable-no-property
- - include: variable
- - match: ''
- pop: true
+ - include: variables-without-members
+ - include: immediately-pop
+
+ double-quoted-string-placeholders:
+ - match: \{\{|\}\}
+ scope: constant.character.escape.powershell
+ - match: (\{)(\d+)
+ captures:
+ 1: punctuation.definition.placeholder.begin.powershell
+ 2: meta.number.integer.decimal.powershell constant.numeric.value.powershell
+ push: inside-double-quoted-string-placeholder
+
+ inside-double-quoted-string-placeholder:
+ - meta_include_prototype: false
+ - meta_scope: constant.other.placeholder.powershell
+ - match: \}
+ scope: punctuation.definition.placeholder.end.powershell
+ pop: 1
+ - match: (?={{double_quote}})
+ pop: 1
+ - match: ':'
+ scope: punctuation.separator.format-spec.powershell
+ push: inside-double-quoted-string-placeholder-formatspec
+ - include: string-placeholder-separators
+ - include: string-placeholder-numbers
+
+ inside-double-quoted-string-placeholder-formatspec:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.format-spec.powershell constant.other.format-spec.powershell
+ - match: \}
+ scope: punctuation.definition.placeholder.end.powershell
+ pop: 2
+ - match: '{{double_quote}}{2}'
+ scope: constant.character.escape.powershell
+ - match: (?={{double_quote}})
+ pop: 2
+ - include: escape-sequences
+ - include: string-placeholder-separators
+
+ single-quoted-string-placeholders:
+ - match: \{\{|\}\}
+ scope: constant.character.escape.powershell
+ - match: (\{)(\d+)
+ captures:
+ 1: punctuation.definition.placeholder.begin.powershell
+ 2: meta.number.integer.decimal.powershell constant.numeric.value.powershell
+ push: inside-single-quoted-string-placeholder
+
+ inside-single-quoted-string-placeholder:
+ - meta_include_prototype: false
+ - meta_scope: constant.other.placeholder.powershell
+ - match: \}
+ scope: punctuation.definition.placeholder.end.powershell
+ pop: 1
+ - match: (?={{single_quote}})
+ pop: 1
+ - match: ':'
+ scope: punctuation.separator.format-spec.powershell
+ push: inside-single-quoted-string-placeholder-formatspec
+ - include: string-placeholder-separators
+ - include: string-placeholder-numbers
+
+ inside-single-quoted-string-placeholder-formatspec:
+ - meta_include_prototype: false
+ - meta_content_scope: meta.format-spec.powershell constant.other.format-spec.powershell
+ - match: \}
+ scope: punctuation.definition.placeholder.end.powershell
+ pop: 2
+ - match: '{{single_quote}}{2}'
+ scope: constant.character.escape.powershell
+ - match: (?={{single_quote}})
+ pop: 2
+ - include: escape-sequences
+ - include: string-placeholder-separators
+
+ string-placeholder-numbers:
+ - match: \d+
+ scope: meta.number.integer.decimal.powershell constant.numeric.value.powershell
- numeric-constant:
- - match: \b(0[bB])([01]*)({{int_suffix}}?{{unit_suffix}}?)
+ string-placeholder-separators:
+ - match: '[,;]'
+ scope: punctuation.separator.powershell
+
+ string-wildcards:
+ - match: \*
+ scope: constant.other.wildcard.asterisk.powershell
+ - match: \?
+ scope: constant.other.wildcard.questionmark.powershell
+
+ numbers:
+ # Binary numbers
+ - match: (0[bB])([01]*)({{int_suffix}}?{{unit_suffix}}?)
scope: meta.number.integer.binary.powershell
captures:
1: constant.numeric.base.powershell
2: constant.numeric.value.powershell
3: constant.numeric.suffix.powershell
push: members
- - match: \b(0[xX])(\h*)({{int_suffix}}?{{unit_suffix}}?)
+ # Hexadecimal numbers
+ - match: (0[xX])(\h*)({{int_suffix}}?{{unit_suffix}}?)
scope: meta.number.integer.hexadecimal.powershell
captures:
1: constant.numeric.base.powershell
2: constant.numeric.value.powershell
3: constant.numeric.suffix.powershell
push: members
+ # Floats
- match: |-
(?x)
(
@@ -588,239 +1273,272 @@ contexts:
7: punctuation.separator.decimal.powershell
8: constant.numeric.suffix.powershell
push: members
- - match: \b(\d+)({{dec_suffix}}{{unit_suffix}}?)
+ # "Decimal" numbers
+ - match: (\d+)({{dec_suffix}}{{unit_suffix}}?)
scope: meta.number.float.decimal.powershell
captures:
1: constant.numeric.value.powershell
2: constant.numeric.suffix.powershell
push: members
- - match: \b(\d+)({{int_suffix}}?{{unit_suffix}}?)
+ # Integers
+ - match: (\d+)({{int_suffix}}?{{unit_suffix}}?)
scope: meta.number.integer.decimal.powershell
captures:
1: constant.numeric.value.powershell
2: constant.numeric.suffix.powershell
push: members
- script-block:
- - match: (%)?(\{)
- captures:
- 1: keyword.control.loop.for.powershell
- 2: punctuation.section.braces.begin.powershell
- push:
- - meta_scope: meta.block.powershell
- - match: \}
- scope: punctuation.section.braces.end.powershell
- pop: true
- - include: main
-
- type:
- # TODO: push a maybe-static-members context
- - match: \[
- scope: punctuation.section.brackets.begin.powershell
- push:
- - match: \](?=::)
- scope: punctuation.section.brackets.end.powershell
- set: static-members
- - match: \]
- scope: punctuation.section.brackets.end.powershell
- pop: true
- - match: (?!\d+|\.)[\p{L}\p{N}.]+
- scope: storage.type.powershell
- - include: main
-
- variable:
- - match: (\$)(?i:True|False|Null)\b
- scope: constant.language.powershell
- captures:
- 1: punctuation.definition.variable.powershell
- - match: |-
- (?xi:
- (\$)
- (?:
- ExecutionContext | Host | Home | IsCoreCLR | IsLinux | IsWindows
- | IsMacOS | PID | Profile | PsCommandPath | PsHome | PsScriptRoot
- | PsUiCulture | PsVersionTable | ShellID
- )
- )
- scope: support.constant.variable.powershell
- captures:
- 1: punctuation.definition.variable.powershell
- push: members
- - match: |-
- (?xi:
- (\$)
- (?:
- [$^?_]
- | (?:
- Args | ConsoleFileName | Error | Event | EventArgs
- | EventSubscriber | ForEach | Input | LastExitCode | Matches
- | MyInvocation | NestedPromptLevel | PsBoundParameters | PsCmdlet
- | PsCulture | PsDebugContext | PsItem | Pwd | Sender | SourceArgs
- | SourceEventArgs | StackTrace | Switch | This
- )\b
- )
- )
- scope: variable.language.powershell
- captures:
- 1: punctuation.definition.variable.powershell
- push: members
- - match: |-
- (?xi:
- (\$)
- (?:
- (?:
- Confirm | Debug | ErrorAction | Information | Progress | Verbose # *Preference
- | Warning | WhatIf
- )
- Preference
- | Maximum(?:Alias|Drive|Error|Function|History|Variable)Count # Maximum*Count
- | Log(?:Command|Engine|Provider)(?:Health|Lifecycle)Event # Log*Event
- | PsDebugContext | PsDefaultParameterValues | PsEmailServer
- | PsModuleAutoloadingPreference | PsSenderInfo
- | PsSessionApplicationName | PsSessionConfigurationName
- | PsSessionOption | ErrorView | FormatEnumerationLimit | OFS
- | OutputEncoding
- )
- )
- scope: variable.language.powershell
- captures:
- 1: punctuation.definition.variable.powershell
- push: members
- - match: ((\$|@)(?i:(global|local|private|script|using|workflow):\w+))
- captures:
- 1: variable.other.readwrite.powershell
- 2: punctuation.definition.variable.powershell
- 3: storage.modifier.scope.powershell
- push: members
- - match: ((\$)(\{)((?i:global|local|private|script|using|workflow)):([^}]*[^}`])(\}))
- captures:
- 1: variable.other.readwrite.powershell
- 2: punctuation.definition.variable.powershell
- 3: punctuation.section.braces.begin.powershell
- 4: storage.modifier.scope.powershell
- 6: punctuation.section.braces.end.powershell
- push: members
- - match: ((?i:(\$|@)(\w+:)?\w+))
- captures:
- 1: variable.other.readwrite.powershell
- 2: punctuation.definition.variable.powershell
- 3: support.variable.drive.powershell
- 4: variable.other.member.powershell
- push: members
- - match: ((?i:(\$)(\{)(\w+:)?([^}]*[^}`])(\})))
+###[ LABELS ]##################################################################
+
+ labels:
+ - match: ^\s*((:){{identifier_simple}})
captures:
- 1: variable.other.readwrite.powershell
- 2: punctuation.definition.variable.powershell
- 3: punctuation.section.braces.begin.powershell
- 4: support.variable.drive.powershell
- 6: punctuation.section.braces.end.powershell
- push: members
+ 1: entity.name.label.powershell
+ 2: punctuation.definition.label.powershell
- variable-no-property:
- - match: (\$)(?i:True|False|Null)\b
- scope: constant.language.powershell
+ regions:
+ - match: ^\s*(#)\s*(region\b)(?:\s*(\S.*))?(\s*\n?)
captures:
- 1: punctuation.definition.variable.powershell
- - match: |-
- (?xi:
- (\$)
- (?:
- ExecutionContext | Host | Home | IsCoreCLR | IsLinux | IsWindows
- | IsMacOS | PID | Profile | PsCommandPath | PsHome | PsScriptRoot
- | PsUiCulture | PsVersionTable | ShellID
- )
- )
- scope: support.constant.variable.powershell
+ 1: punctuation.definition.preprocessor.powershell
+ 2: keyword.control.directive.region.powershell
+ 3: entity.name.section.powershell
+ 4: meta.fold.block.begin.powershell
+ - match: ^\s*(#)\s*(endregion\b)(?:\s*(\S.*))?\s*\n?
captures:
- 1: punctuation.definition.variable.powershell
- - match: |-
- (?xi:
- (\$)
- (?:
- [$^?_]
- | (?:
- Args | ConsoleFileName | Error | Event | EventArgs
- | EventSubscriber | ForEach | Input | LastExitCode | Matches
- | MyInvocation | NestedPromptLevel | PsBoundParameters | PsCmdlet
- | PsCulture | PsDebugContext | PsItem | Pwd | Sender | SourceArgs
- | SourceEventArgs | StackTrace | Switch | This
- )\b
- )
- )
- scope: variable.language.powershell
+ 1: meta.fold.block.end.powershell punctuation.definition.preprocessor.powershell
+ 2: keyword.control.directive.endregion.powershell
+ 3: variable.other.section.powershell
+
+###[ COMMENTS ]################################################################
+
+ comments:
+ - include: comment-block
+ - include: comment-line
+
+ comment-block:
+ - match: <#
+ scope: punctuation.definition.comment.block.begin.powershell
+ push:
+ - meta_scope: comment.block.powershell
+ - match: '#>'
+ scope: punctuation.definition.comment.block.end.powershell
+ pop: 1
+ - include: comment-embedded-docs
+
+ comment-embedded-docs:
+ # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help
+ - match: ^\s*(\.)(?i:(Parameter)\s+([a-z0-9-_]+))
+ scope: comment.documentation.embedded.powershell
captures:
- 1: punctuation.definition.variable.powershell
- - match: |-
- (?xi:
- (\$)
- (?:
- (?:
- Confirm | Debug | ErrorAction | Information | Progress | Verbose # *Preference
- | Warning | WhatIf
- )
- Preference
- | Maximum(?:Alias|Drive|Error|Function|History|Variable)Count # Maximum*Count
- | Log(?:Command|Engine|Provider)(?:Health|Lifecycle)Event # Log*Event
- | PsDebugContext | PsDefaultParameterValues | PsEmailServer
- | PsModuleAutoloadingPreference | PsSenderInfo
- | PsSessionApplicationName | PsSessionConfigurationName
- | PsSessionOption | ErrorView | FormatEnumerationLimit | OFS
- | OutputEncoding
- )
- )
- scope: variable.language.powershell
+ 1: punctuation.definition.keyword.documentation.powershell
+ 2: keyword.other.documentation.param.powershell
+ 3: variable.parameter.powershell
+ - match: ^\s*(\.)(?i:(ForwardHelpTargetName|ExternalHelp|Link)\s+([a-z0-9-_:/.&]+))
+ scope: comment.documentation.embedded.powershell
captures:
- 1: punctuation.definition.variable.powershell
- - match: (?i:(\$|@)(global|local|private|script|using|workflow):(\w+))
+ 1: punctuation.definition.keyword.documentation.powershell
+ 2: keyword.other.documentation.powershell
+ 3: markup.underline.link.powershell
+ - match: ^\s*(\.)(?i:(ForwardHelpCategory)\s+({{doc_fwdhelp_cat}}))
+ scope: comment.documentation.embedded.powershell
captures:
- 1: punctuation.definition.variable.powershell
- 2: storage.modifier.scope.powershell
- 3: variable.other.readwrite.powershell
- - match: (?i:(\$)(\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\}))
+ 1: punctuation.definition.keyword.documentation.powershell
+ 2: keyword.other.documentation.powershell
+ 3: support.type.powershell
+ - match: ^\s*(\.)({{doc}})
+ scope: comment.documentation.embedded.powershell
captures:
- 1: punctuation.definition.variable.powershell
- 2: punctuation.section.braces.begin
- 3: storage.modifier.scope.powershell
- 4: variable.other.readwrite.powershell
- 5: punctuation.section.braces.end
- - match: (?i:(\$)(\w+:)?\w+)
- scope: variable.other.readwrite.powershell
+ 1: punctuation.definition.keyword.documentation.powershell
+ 2: keyword.other.documentation.powershell
+
+ comment-line:
+ - match: '#(?!(?i:requires|(?:end)?region)\b)'
+ scope: punctuation.definition.comment.powershell
+ push:
+ - meta_scope: comment.line.powershell
+ - include: pop-eol
+ - include: comment-embedded-docs
+
+###[ COMPONENTS ]##############################################################
+
+ path-punctuation:
+ - match: ':(?=[\\/])'
+ scope: punctuation.separator.path.powershell
+ - match: \.\.(?=[\\/])
+ scope: constant.other.path.parent.powershell
+ - match: \.(?=[\\/])
+ scope: constant.other.path.self.powershell
+ - match: ~(?=[\\/])
+ scope: variable.language.tilde.powershell
+ - match: '[\\/]+'
+ scope: punctuation.separator.path.powershell
+
+ line-continuations:
+ - match: (`)\n
captures:
- 1: punctuation.definition.variable.powershell
- 2: support.variable.drive.powershell
- - match: (?i:(\$)(\{)(\w+:)?([^}]*[^}`])(\}))
+ 1: punctuation.separator.continuation.line.powershell
+ push: line-continuation-body
+ - match: '`(\s+)\n'
captures:
- 1: punctuation.definition.variable.powershell
- 2: punctuation.section.braces.begin
- 3: support.variable.drive.powershell
- 4: variable.other.readwrite.powershell
- 5: punctuation.section.braces.end
+ 1: invalid.illegal.unexpected-whitespace.powershell
- class-method:
- - match: ^(?:\s*)(?i)(hidden|static)?\s*(\[)((?!\d+|\.)[\p{L}\p{N}.]+)(\])\s*((?:\p{L}|\d|_|-|\.)+)\s*(?=\()
- scope: meta.function.powershell
- captures:
- 1: storage.modifier.powershell
- 2: punctuation.section.brackets.begin.powershell
- 3: storage.type.powershell
- 4: punctuation.section.brackets.end.powershell
- 5: entity.name.function.powershell
- push:
- - match: (?=\()
- pop: true
- - include: comment-line
+ line-continuation-body:
+ - match: ^(?!\s*#)
+ pop: 1
- regions:
- - match: ^\s*((#)\s*(region\b)(?:\s*(\S.*))?(\n?))
- captures:
- 1: comment.line.powershell
- 2: punctuation.definition.comment.powershell
- 3: keyword.other.region.begin.powershell
- 4: meta.toc-list.powershell entity.name.section.powershell
- 5: meta.fold.begin.powershell
- - match: ^\s*((#)\s*(endregion\b).*(\n?))
- captures:
- 1: comment.line.powershell
- 2: punctuation.definition.comment.powershell
- 3: keyword.other.region.end.powershell
- 4: meta.fold.end.powershell
+ comma-separators:
+ - match: ','
+ scope: punctuation.separator.sequence.powershell
+
+ escape-sequences:
+ - match: '`(?:[0abenfrvt$`]|{{single_quote}}|{{double_quote}})'
+ scope: constant.character.escape.powershell
+ - match: '`u\{\h+\}'
+ scope: constant.character.escape.powershell
+
+ pop-eol:
+ - match: $\n?
+ pop: 1
+
+ pop-before-eol:
+ - match: (?=$)
+ pop: 1
+
+ immediately-pop:
+ - match: ''
+ pop: 1
+
+ else-pop:
+ - match: (?=\S)
+ pop: 1
+
+###############################################################################
+
+variables:
+ kebab_break: (?![\w-])
+ operator_break: (?![[:alpha:]]|-\d)
+ builtin_types: |-
+ \b(?x:
+ void | null | object | bool | char | string
+ | int (?:32|64)? | long | byte | float | double | decimal
+ | array | hashtable
+ )\b
+ shebang_language: \b(?:pwsh|powershell)\b
+
+ # Attributes
+ attributes: |-
+ \b(?xi:
+ CmdletBinding | Alias | OutputType | Parameter
+ | Validate
+ (?: Count | NotNull (?:OrEmpty)? | Range | Pattern | Length | Set | Script)
+ | Allow (?: Null | Empty (?: Collection | String ))
+ )\b
+ attribute_parameters: |-
+ \b(?xi:
+ Mandatory | ValueFromPipeline (?:ByPropertyName)?
+ | ValueFromRemainingArguments | Position(?:alBinding)?
+ | (?:Default)? ParameterSetName | SupportsShouldProcess | SupportsPaging
+ | HelpUri | ConfirmImpact | HelpMessage
+ )\b
+
+ # Numbers
+ dec_exponent: (?:[eE][-+]?\d*)
+ dec_suffix: '[dD]'
+ float_suffix: '[dDlL]'
+ int_suffix: (?i:u[lsy]?|[lnsy])
+ unit_suffix: (?i:[kmgtp]b\b)
+
+ # Variables
+ # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_variables
+ identifier_simple: '[\p{L}\p{Nd}_?]+'
+ identifier_special: '[^}]*[^}`]'
+ identifier_function: '[\p{L}_][\p{L}\p{Nd}_.-]*\b'
+ identifier_csharp: '[\p{L}_][\p{L}\p{Nd}_]*'
+ var_lookahead: |-
+ (?x: (?=
+ \$[$^{]
+ | [$@]{{identifier_simple}}
+ ))
+ # https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables
+ var_constants: |-
+ \b(?xi:
+ (?:
+ ExecutionContext | Host | Home | IsCoreCLR | IsLinux | IsWindows
+ | IsMacOS | PID | Profile | PsCommandPath | PsHome | PsScriptRoot
+ | PsUiCulture | PsVersionTable | ShellID
+ )
+ )\b
+ var_language: |-
+ (?xi:
+ [$^?]
+ | \b(?:
+ _ | Args | ConsoleFileName | Error | Event | EventArgs
+ | EventSubscriber | ForEach | Input | LastExitCode | Matches
+ | MyInvocation | NestedPromptLevel | PsBoundParameters | PsCmdlet
+ | PsCulture | PsDebugContext | PsItem | Pwd | Sender | SourceArgs
+ | SourceEventArgs | StackTrace | Switch | This
+ | (?:
+ Confirm | Debug | ErrorAction | Information | Progress # *Preference
+ | Verbose | Warning | WhatIf
+ ) Preference
+ | Maximum (?: Alias | Drive | Error | Function | History | Variable ) Count # Maximum*Count
+ | Log (?: Command | Engine | Provider ) (?: Health | Lifecycle ) Event # Log*Event
+ | PsNativeCommand (?: ArgumentPassing | UseErrorActionPreference ) # PsNativeCommand*
+ | PsDebugContext | PsDefaultParameterValues | PsEmailServer
+ | PsModuleAutoloadingPreference | PsSenderInfo
+ | PsSession (?: ApplicationName | ConfigurationName | Option ) # PsSession*
+ | ErrorView | FormatEnumerationLimit | OFS | OutputEncoding
+ )\b
+ )
+ var_scope_mod: (?i:global|local|private|script|using|workflow)
+
+ # The "Approved Verbs" list
+ # https://learn.microsoft.com/en-us/powershell/scripting/developer/cmdlet/approved-verbs-for-windows-powershell-commands
+ command_verbs: |-
+ \b(?xi:
+ # Common verbs
+ Add | Clear | Close | Copy | Enter | Exit | Find | Format | Get | Hide
+ | Join | Lock | Move | New | Open | Optimize | Pop | Push | Redo | Remove
+ | Rename | Reset | Resize | Search | Select | Set | Show | Skip | Split
+ | Step | Switch | Undo | Unlock | Watch
+ # Communications verbs
+ | Connect | Disconnect | Read | Receive | Send | Write
+ # Data verbs
+ | Backup | Checkpoint | Compare | Compress | Convert | ConvertFrom
+ | ConvertTo | Dismount | Edit | Expand | Export | Group | Import
+ | Initialize | Limit | Merge | Mount | Out | Publish | Restore | Save
+ | Sync | Unpublish | Update
+ # Diagnostic verbs
+ | Debug | Measure | Ping | Repair | Resolve | Test | Trace
+ # Lifecycle verbs
+ | Approve | Assert | Build | Complete | Confirm | Deny | Deploy | Disable
+ | Enable | Install | Invoke | Register | Request | Restart | Resume | Start
+ | Stop | Submit | Suspend | Uninstall | Unregister | Wait
+ # Security verbs
+ | Block | Grant | Protect | Revoke | Unblock | Unprotect
+ # Other verbs
+ | Use
+ )\b
+
+ # Documentation
+ doc: |-
+ (?xi:
+ Component | Description | Example | ExternalHelp | ForwardHelpCategory
+ | ForwardHelpTargetName | Functionality | Inputs | Link | Notes | Outputs
+ | Parameter | RemoteHelpRunSpace | Role | Synopsis
+ )
+ doc_fwdhelp_cat: |-
+ (?x:
+ Alias | Cmdlet | HelpFile | Function | Provider | General | FAQ
+ | Glossary | ScriptCommand | ExternalScript | Filter | All
+ )
+
+ # Strings
+ single_quote: "['‘’‚]"
+ double_quote: '["“”„]'
+ csharp_indicator: |-
+ (?x: \s* (?:
+ using\s+System[.;]
+ | public\s+class\s+
+ | \[DllImport\b
+ ))
diff --git a/README.md b/README.md
index c35ed0ae..6c6dad0c 100644
--- a/README.md
+++ b/README.md
@@ -1,26 +1,48 @@
-# PowerShell Package for Sublime Text 3
+# PowerShell Package for Sublime Text
[](https://gitter.im/SublimeText/PowerShell?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Adds support for the MS PowerShell programming language.
-### Installing
-1. Install [package control][package_control] for Sublime Text.
+## Features
+
+- Syntax highlighting
+- Symbol lookup for classes and functions
+- A build system to run the current file
+- Code snippets
+- Comment toggle
+- Indentation and code folding rules
+
+
+## Installing
+
+1. Install [Package Control][] for Sublime Text.
1. Install the **PowerShell** package:
- 1. Press Ctrl+Shift+P (Cmd+Shift+P on Mac)
- 1. Select 'Install Package'
- 1. Select 'PowerShell'
+ 1. Press Ctrl+Shift+P
+ (Cmd+Shift+P on Mac)
+ 1. Select **Install Package**.
+ 1. Select **PowerShell**.
+
+
+## Developing
+
+You want to contribute? Awesome!
+File an issue or send us a PR.
+Run the default build system in the syntax file
+to execute the regression tests.
+(Ctrl+B on Windows and Linux;
+Cmd+B on Mac)
-### Developing
-You want to contribute? Awesome! Take a look at [CONTRIBUTING.md](CONTRIBUTING.md).
+## EditorSyntax
-### EditorSyntax
+This project budded [EditorSyntax][] in 2016
+and tracked it from 2018 until 2024,
+when we diverged to follow Sublime Text conventions.
-Syntax highlighting is adapted from the [EditorSyntax][] project.
-[package_control]: https://sublime.wbond.net/installation
-[EditorSyntax]: https://github.com/PowerShell/EditorSyntax
+[package control]: https://packagecontrol.io/installation
+[editorsyntax]: https://github.com/PowerShell/EditorSyntax
diff --git a/Snippets/Powershell.sublime-completions b/Snippets/Powershell.sublime-completions
deleted file mode 100644
index b3d9dd8a..00000000
--- a/Snippets/Powershell.sublime-completions
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "scope": "source.powershell",
-
- "completions": [
- { "trigger": "dict\thashtable", "contents": "@{$1$0}" },
- { "trigger": "arr\tarray", "contents": "@($0)" },
- { "trigger": "req\trequires", "contents": "#requires -$0" },
- { "trigger": "reqp\trequires", "contents": "#requires -pssnapin $0" },
- { "trigger": "reqv\trequires", "contents": "#requires -version ${0:2}" },
- { "trigger": "void", "contents": "[void] ($1)$0" },
- { "trigger": "sb", "contents": "\\${$1}$0" },
- { "trigger": "wd\twrite-debug", "contents": "write-debug -message \"$1\"$0" },
- { "trigger": "wh\twrite-host", "contents": "write-host \"$1\"" },
- { "trigger": "ww\twrite-warning", "contents": "write-warning $0" },
- { "trigger": "param", "contents": "param(\\$${1:paramName})" }
- ]
-}
diff --git a/Support/Powershell.sublime-build b/Support/Powershell.sublime-build
deleted file mode 100644
index c9021510..00000000
--- a/Support/Powershell.sublime-build
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "cmd": ["pwsh", "-noprofile", "-ExecutionPolicy", "Bypass", "-file", "$file"],
- "selector": "source.powershell",
-
- "windows": {
- "cmd": ["powershell.exe", "-noprofile", "-ExecutionPolicy", "Bypass", "-file", "$file"],
- }
-}
diff --git a/Tests/syntax_test_Class.ps1 b/Tests/syntax_test_Class.ps1
deleted file mode 100644
index fe41a23c..00000000
--- a/Tests/syntax_test_Class.ps1
+++ /dev/null
@@ -1,138 +0,0 @@
-# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
-using namespace system.management.automation
-# <- keyword.control.using
-# ^^^^^^^^^ keyword.other
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter
-
-# Define a class
-class TypeName
-# <- storage.type
-# ^^^^^^^^ entity.name.class
-# @@@@@@@@ definition
-{
- # Property with validate set
- # <- punctuation.definition.comment
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line
- [ValidateSet("val1", "Val2")]
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^^^^^^ string.quoted.double
- # ^ punctuation.separator
- # ^^^^^^ string.quoted.double
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [string] $P1
- # <- punctuation.section.brackets.begin
- # ^^^^^ storage.type
- # ^ punctuation.section.brackets.end
- # ^ punctuation.definition.variable
- # ^^ variable.other.readwrite
-
- # Static property
- # <- punctuation.definition.comment
- # ^^^^^^^^^^^^^^^ comment.line
- static [hashtable] $P2
- #^^^^^ storage.modifier
- # ^ punctuation.section.brackets.begin
- # ^^^^^^^^^ storage.type
- # ^ punctuation.section.brackets.end
- # ^ punctuation.definition.variable
- # ^^ variable.other.readwrite
-
- # Hidden property does not show as result of Get-Member
- # <- punctuation.definition.comment
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line
- hidden [int] $P3
- #^^^^^ storage.modifier
- # ^ punctuation.section.brackets.begin
- # ^ storage.type
- # ^ punctuation.section.brackets.end
- # ^ punctuation.definition.variable
- # ^^ variable.other.readwrite
-
- # Constructor
- # <- punctuation.definition.comment
- # ^^^^^^^^^^^ comment.line
- TypeName ([string] $s) {
- # ^ punctuation.section.group.begin
- # ^ punctuation.section.brackets.begin
- # ^^^^^^ storage.type
- # ^ punctuation.section.brackets.end
- # ^ punctuation.definition.variable
- # ^ variable.other.readwrite
- # ^ punctuation.section.group.end
- $this.P1 = $s
- # <- punctuation.definition.variable
- # ^ variable.language
- # ^^ variable.other.member
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^ variable.other.readwrite
- }
-
- # Static method
- # <- punctuation.definition.comment
- # ^^^^^^^^^^^^^ comment.line
- static [void] MemberMethod1([hashtable] $h) {
- # <- storage.modifier
- # ^ punctuation.section.brackets.begin
- # ^^^^ storage.type
- # ^ punctuation.section.brackets.end
- # ^^^^^^^^^^^^^ entity.name.function
- # @@@@@@@@@@@@@ definition
- # ^ punctuation.section.group.begin
- # ^ punctuation.section.brackets.begin
- # ^^^^^^^^^ storage.type
- # ^ punctuation.section.brackets.end
- # ^ punctuation.definition.variable
- # ^ variable.other.readwrite
- # ^ punctuation.section.group.end
- [TypeName]::P2 = $h
- # <- punctuation.section.brackets.begin
- # ^ storage.type
- # ^ punctuation.section.brackets.end
- # ^^ punctuation.accessor.double-colon
- # ^^ variable.other.member
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^ variable.other.readwrite
- }
-
- # Instance method
- # <- punctuation.definition.comment
- # ^^^^^^^^^^^^^^^ comment.line
- [int] MemberMethod2([int] $i) {
- # <- punctuation.section.brackets.begin
- # ^ storage.type
- # ^ punctuation.section.brackets.end
- # ^^^^^^^^^^^^^ entity.name.function
- # @@@@@@@@@@@@@ definition
- # ^ punctuation.section.group.begin
- # ^ punctuation.section.brackets.begin
- # ^^^ storage.type
- # ^ punctuation.section.brackets.end
- # ^ punctuation.definition.variable
- # ^ variable.other.readwrite
- # ^ punctuation.section.group.end
- $this.P3 = $i
- # <- punctuation.definition.variable
- # ^^^ variable.language
- # ^^ variable.other.member
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^ variable.other.readwrite
- return $this.P3
- # <- keyword.control
- # ^ punctuation.definition.variable
- # ^^^^ variable.language
- # ^^ variable.other.member
- }
-}
-
-[TypeName]::MemberMethod1()
-# @@@@@@@@@@@@@ reference
-
-$object.MemberMethod2()
-# @@@@@@@@@@@@@ reference
diff --git a/Tests/syntax_test_Function.ps1 b/Tests/syntax_test_Function.ps1
deleted file mode 100644
index f79bfdc7..00000000
--- a/Tests/syntax_test_Function.ps1
+++ /dev/null
@@ -1,402 +0,0 @@
-# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
-
-using module Microsoft.Management
-# <- keyword.control.using
-# ^ keyword.other
-# ^ variable.parameter
-
-function Test-Path {}
-# @@@@@@@@@ definition
-<#
-# <- punctuation.definition.comment.block.begin
- .Synopsis
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- Short description
- .DESCRIPTION
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- Long description
- .EXAMPLE
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- Example of how to use this cmdlet
- .EXAMPLE
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- Another example of how to use this cmdlet
- .INPUTS
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- Inputs to this cmdlet (if any)
- .OUTPUTS
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- Output from this cmdlet (if any)
- .NOTES
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- General notes
- .COMPONENT
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- The component this cmdlet belongs to
- .ROLE
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- The role this cmdlet belongs to
- .FUNCTIONALITY
- # <- punctuation.definition.keyword
- # ^ keyword.other.documentation
- The functionality that best describes this cmdlet
-
- This should not be considered documentaton -> .role
- # ^ - keyword.operator.documentation
-#>
-# <- punctuation.definition.comment.block.end
-function Verb-Noun {
-#^^^^^^^^^^^^^^^^^ meta.function
-#^^^^^^^ storage.type
-# ^^^^^^^^^ entity.name.function
-# @@@@@@@@@ definition
- [CmdletBinding(DefaultParameterSetName = 'Parameter Set 1',
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^ meta.attribute variable.parameter.attribute
- # ^ meta.attribute keyword.operator.assignment
- # ^ meta.attribute string.quoted.single
- SupportsShouldProcess = $true,
- # ^^^^^^^^^^^^^^^^^^^^^ meta.attribute variable.parameter.attribute
- # ^ meta.attribute keyword.operator.assignment
- # ^ meta.attribute punctuation.definition.variable
- # ^^^^ meta.attribute constant.language
- PositionalBinding = $false,
- # ^^^^^^^^^^^^^^^^^ meta.attribute variable.parameter.attribute
- # ^ meta.attribute keyword.operator.assignment
- # ^ meta.attribute punctuation.definition.variable
- # ^^^^^ meta.attribute constant.language
- HelpUri = 'http://www.microsoft.com/',
- # ^^^^^^^ meta.attribute variable.parameter.attribute
- # ^ meta.attribute keyword.operator.assignment
- # ^ meta.attribute string.quoted.single
- ConfirmImpact = 'Medium')]
- # ^^^^^^^^^^^^^ meta.attribute variable.parameter.attribute
- # ^ meta.attribute keyword.operator.assignment
- # ^ meta.attribute string.quoted.single
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [Alias()]
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [OutputType([String])]
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^ meta.attribute punctuation.section.brackets.begin
- # ^^^^^^ meta.attribute storage.type
- # ^ meta.attribute punctuation.section.brackets.end
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- Param
- #^^^^^ keyword.declaration.parameter
- (
- # <- punctuation.section.group.begin
- # Param1 help description
- # <- comment.line punctuation.definition.comment
- # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
- [Parameter(Mandatory=$true,
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^^^^ constant.language
- # ^ punctuation.separator
- ValueFromPipeline=$true,
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
- # ^^^^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^^^^ constant.language
- # ^ punctuation.separator
- ValueFromPipelineByPropertyName = $true,
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^^^^^ constant.language
- # ^ punctuation.separator
- ValueFromRemainingArguments=$false,
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^^^^^ constant.language
- # ^ punctuation.separator
- Position=0,
- #^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ constant.numeric.value
- # ^ punctuation.separator
- ParameterSetName = 'Parameter Set 1')]
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^^^^^^^^^^^^^^^^^ string.quoted.single
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- # ^ - meta.attribute
- [ValidateNotNullOrEmpty()]
- #^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^^^^^^^^^^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [ValidateNotNull()]
- #^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^^^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [ValidateNotNullOrEmpty()]
- #^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^^^^^^^^^^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [ValidateCount(0,5)]
- #^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ constant.numeric.value
- # ^ punctuation.separator
- # ^ constant.numeric.value
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [ValidateSet("sun", "moon", "earth")]
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^^^^ string.quoted.double
- # ^ punctuation.separator
- # ^^^^^^ string.quoted.double
- # ^ punctuation.separator
- # ^^^^^^^ string.quoted.double
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [Alias("p1")]
- #^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^^^^ string.quoted.double
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- $Param1,
- # <- punctuation.definition.variable
- # ^ variable.other.readwrite
- # ^ punctuation.separator
-
- # Param2 help description
- # <- comment.line punctuation.definition.comment
- # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
- [Parameter(ParameterSetName='Parameter Set 1')]
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^ support.function.attribute
- # ^^^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^^^^^^^^^^^^^^^^ string.quoted.single
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- # ^ - meta.attribute
- [AllowNull()]
- #^^^^^^^^^^^^ meta.attribute
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [AllowEmptyCollection()]
- #^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [AllowEmptyString()]
- #^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [ValidateScript({$true})]
- #^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- meta.attribute punctuation.section.brackets.begin
- # ^^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ meta.attribute
- # ^ punctuation.definition.variable
- # ^^^^ constant.language
- # ^ meta.attribute
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [ValidateRange(0,5)]
- #^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- meta.attribute punctuation.section.brackets.begin
- # ^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ constant.numeric.value
- # ^ punctuation.separator
- # ^ constant.numeric.value
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [int32]
- # <- punctuation.section.brackets.begin
- #^^^^^ storage.type
- # ^ punctuation.section.brackets.end
- $Param2,
- # <- punctuation.definition.variable
- # ^ variable.other.readwrite
- # ^ punctuation.separator
-
- # Param3 help description
- # <- comment.line punctuation.definition.comment
- # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
- [Parameter(ParameterSetName='Another Parameter Set')]
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^^^^^^^^^^^^^^^^ meta.attribute variable.parameter.attribute
- # ^ meta.attribute keyword.operator.assignment
- # ^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute string.quoted.single
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [ValidatePattern("[a-z]*")]
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^^^^^^^^ meta.attribute string.quoted.double
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [ValidateLength(0,15)]
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^ meta.attribute meta.number.integer.decimal constant.numeric.value
- # ^ punctuation.separator
- # ^^ meta.attribute meta.number.integer.decimal constant.numeric.value
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [String]
- # <- punctuation.section.brackets.begin
- #^^^^^^ storage.type
- # ^ punctuation.section.brackets.end
- $Param3,
- # <- punctuation.definition.variable
- #^^^^^^ variable.other.readwrite
- # ^ punctuation.separator
-
- # Param4 help description
- # <- comment.line punctuation.definition.comment
- # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
- [Parameter(ParameterSetName='Parameter Set 1')]
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^^^^^^^^^^^^^^^^ meta.attribute variable.parameter.attribute
- # ^ meta.attribute keyword.operator.assignment
- # ^^^^^^^^^^^^^^^^^ meta.attribute string.quoted.single
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [ValidateScript({Test-Path $_})] #Make sure cmdlets don't break highlighting
- # @@@@@@@@@ reference
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^ meta.attribute meta.block
- # ^^^^^^^^^ meta.block support.function
- # ^ meta.block punctuation.definition.variable
- # ^ meta.block variable.language
- # ^ meta.attribute meta.block
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [string]
- # <- punctuation.section.brackets.begin
- # ^ storage.type
- # ^ punctuation.section.brackets.end
- $Param4,
- # <- punctuation.definition.variable
- # ^ variable.other.readwrite
- # ^ punctuation.separator
-
- # Param5 help description
- # <- comment.line punctuation.definition.comment
- # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
- [Parameter(ParameterSetName='Parameter Set 1')]
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^^^^^^^^^^^^^^^^ meta.attribute variable.parameter.attribute
- # ^ meta.attribute keyword.operator.assignment
- # ^^^^^^^^^^^^^^^^^ meta.attribute string.quoted.single
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- [ValidatePattern('(?=^.{1,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)')] # this regex shouldn't break highlighting
- # <- meta.attribute punctuation.section.brackets.begin
- # ^ meta.attribute support.function.attribute
- # ^ meta.attribute punctuation.section.group.begin
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute string.quoted.single
- # ^ meta.attribute punctuation.section.group.end
- # ^ meta.attribute punctuation.section.brackets.end
- # ^ comment.line punctuation.definition.comment
- # ^ comment.line
- [string]
- # <- punctuation.section.brackets.begin
- # ^ storage.type
- # ^ punctuation.section.brackets.end
- $Param5
- # <- punctuation.definition.variable
- # ^ variable.other.readwrite
- )
- # <- punctuation.section.group.end
-
- Begin
- #^^^^^ keyword.context.block.begin
- {
- }
- Process {
- # <- keyword.context.block.process
- if ($pscmdlet.ShouldProcess("Target", "Operation")) {
- # <- keyword.control
- # ^ punctuation.section.group.begin
- # ^ punctuation.definition.variable
- # ^^^^^^^^ variable.language
- # ^^^^^^^^^^^^^ variable.function
- # @@@@@@@@@@@@@ reference
- # ^ punctuation.section.arguments.begin
- # ^^^^^^^^ string.quoted.double
- # ^ punctuation.separator
- # ^^^^^^^^^^^ string.quoted.double
- # ^ punctuation.section.arguments.end
- # ^ punctuation.section.group.end
- }
- }
- End {
- #^^^ keyword.context.block.end
-
- }
-}
diff --git a/Tests/syntax_test_PowerShell.ps1 b/Tests/syntax_test_PowerShell.ps1
deleted file mode 100644
index bb9d932a..00000000
--- a/Tests/syntax_test_PowerShell.ps1
+++ /dev/null
@@ -1,1847 +0,0 @@
-# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
-using namespace System.Management.Automation
-# <- keyword.control.using
-# ^ keyword.other
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter
-#Requires -PSSnapin DiskSnapin -Version 1.2
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^^ variable.parameter
-# ^^^^^^^^ variable.parameter
-#Requires -PSSnapin DiskSnapin
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^^ variable.parameter
-#Requires -Version 3
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^ variable.parameter
-#Requires -Version 3.0
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^ variable.parameter
-#Requires -Version 3 -RunAsAdministrator
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^ variable.parameter
-# ^^^^^^^^^^^^^^^^^^^ variable.parameter
-#Requires -RunAsAdministrator
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^^ variable.parameter
-#Requires -Modules PSWorkflow
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^ variable.parameter
-#Requires -Modules PSWorkflow -ThisIsInvalid
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^ variable.parameter
-# ^^^^^^^^ - variable.parameter
-#Requires -Modules PSWorkflow, ActiveDirectory
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^ variable.parameter
-# ^ punctuation.separator
-#Requires -Modules PSWorkflow,ActiveDirectory
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^ variable.parameter
-# ^ punctuation.separator
-#Requires -ShellId MyLocalShell
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^ variable.parameter
-#Requires -Modules PSWorkflow, @{ModuleName="PSScheduledJob"; ModuleVersion="1.0.0.0"}
-# <- punctuation.definition.keyword
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
-#^^^^^^^^ keyword.control.import.require
-# ^^^^^^^^ variable.parameter
-# ^ punctuation.separator
-# ^^^^^^^^^^ meta.requires meta.hashtable variable.other.readwrite
-# ^ meta.requires meta.hashtable
-# ^^^^^^^^^^^^^^^^ meta.requires meta.hashtable string.quoted.double
-# ^ meta.requires meta.hashtable punctuation.terminator.statement
-# ^^^^^^^^^^^^^ meta.requires meta.hashtable variable.other.readwrite
-# ^ meta.requires meta.hashtable
-# ^^^^^^^^^ meta.requires meta.hashtable string.quoted.double
-
-throw "Do not run this file!"
-# <- keyword.control
-# ^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double
-
-# Stop parsing
-& tool.exe /arg1 'value' /arg2 $value --% /arg3 $value /arg4 "value" # Comment
-# <- keyword.operator.other
-# ^^^^^^^^ variable.function
-# ^ punctuation.definition.parameter
-# ^^^^^ variable.parameter.option
-# ^ punctuation.definition.parameter
-# ^^^^^ variable.parameter.option
-# ^^^ keyword.control
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted - constant - variable - comment
-
-& gnutool.exe -s 'short option' --long-option --very_long_option value +plus-option
-#<- keyword.operator.other
-# ^^^^^^^^^^^ variable.function
-# ^ variable.parameter.option punctuation.definition.parameter
-# ^ variable.parameter.option
-# ^^ variable.parameter.option punctuation.definition.parameter
-# ^^ variable.parameter.option punctuation.definition.parameter
-# ^^^^^^^^^^^^^^^^ variable.parameter.option
-# ^ variable.parameter.option punctuation.definition.parameter
-# ^^^^^^^^^^^ variable.parameter.option
-
-# Automatic variables
-$_, $$, $^, $?
-# <- punctuation.definition.variable
-#^ variable.language
-# ^ punctuation.definition.variable
-# ^^ variable.language
-# ^ punctuation.definition.variable
-# ^^ variable.language
-# ^ punctuation.definition.variable
-# ^^ variable.language
-$args
-# <- punctuation.definition.variable
-#^^^^ variable.language
-$error
-# <- punctuation.definition.variable
-# ^^^^ variable.language
-$home
-# <- punctuation.definition.variable
-# ^^^ support.constant.variable
-$foreach
-# <- punctuation.definition.variable
-#^^^^^^^ variable.language
-
-# Normal variables
-$variable
-# <- punctuation.definition.variable
-# ^ variable.other.readwrite
-$script:variable
-# <- variable.other.readwrite punctuation.definition.variable
-# ^ storage.modifier.scope
-# ^ variable.other.readwrite
-$ENV:ComputerName
-# <- variable.other.readwrite punctuation.definition.variable
-# ^ support.variable.drive
-# ^ variable.other.readwrite
-${variable}
-# <- variable.other.readwrite punctuation.definition.variable
- # <- punctuation.section.braces.begin
-# ^^^^^^^^ variable.other.readwrite
-# ^ punctuation.section.braces.end
-${script:variable}
-# <- variable.other.readwrite punctuation.definition.variable
- # <- punctuation.section.braces.begin
-# ^ storage.modifier.scope
-# ^ variable.other.readwrite
-# ^ punctuation.section.braces.end
-
-# Variable properties should be highlighted
-$variable.Name
-# <- variable.other.readwrite punctuation.definition.variable
-#^^^^^^^^ variable.other.readwrite
-# ^ punctuation.accessor.dot
-# ^^^^^ - variable.other.readwrite
-# ^^^^ variable.other.member
-
-# Variable properties should be highlighted
-$variable.Name.Method( )
-# <- variable.other.readwrite punctuation.definition.variable
-#^^^^^^^^ variable.other.readwrite
-# ^ punctuation.accessor.dot
-# ^^^^ variable.other.member
-# ^ punctuation.accessor.dot
-# ^^^^^^ meta.function-call variable.function
-# @@@@@@ reference
-# ^^^ meta.function-call.arguments
-# ^^^^^^^^^^^^^^^ - variable.other.readwrite
-# ^ - meta.function-call
-
-# In double-quoted strings, only the variable should be highlighted, not the property
-"This is my $variable.Name!"
-# <- punctuation.definition.string.begin
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string
-#^^^^^^^^^^^ string.quoted.double
-# ^^^^^^^^^ meta.interpolation variable.other.readwrite - string
-# ^ punctuation.definition.variable
-# ^^^^^^ string.quoted.double - meta.interpolation - variable - punctuation
-# ^ punctuation.definition.string.end
-
-# When used in a subexpression, both should be highlighted
-"This is my $($variable.Name)!"
-# <- punctuation.definition.string.begin
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string
-#^^^^^^^^^^^ string.quoted.double
-# ^^^^^^^^^^^^^^^^^ meta.interpolation - string
-# ^^ string.quoted.double - meta.interpolation
-# ^^ punctuation.section.interpolation.begin
-# ^^^^^^^^^ variable.other.readwrite
-# ^ punctuation.definition.variable
-# ^ punctuation.accessor.dot
-# ^^^^ variable.other.member
-# ^ punctuation.section.interpolation.end
-# ^ punctuation.definition.string.end
-
-# $ENV:ComputerName should be highlighted
-"This is the name of my computer: $ENV:ComputerName"
-# <- punctuation.definition.string.begin
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double
-# ^^^^^^^^^^^^^^^^^ meta.interpolation - string
-# ^ punctuation.definition.variable
-# ^^^^ support.variable.drive
-# ^^^^^^^^^^^^ variable.other.readwrite
-# ^ punctuation.definition.string.end
-
-# Here as well
-"This is the name of my computer: ${ENV:ComputerName}"
-# <- punctuation.definition.string.begin
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double
-# ^^^^^^^^^^^^^^^^^^^ meta.interpolation - string
-# ^ punctuation.definition.variable
-# ^ punctuation.section.braces.begin
-# ^^^^ support.variable.drive
-# ^^^^^^^^^^^^ variable.other.readwrite
-# ^ punctuation.definition.string.end
-
-# The @splat references only work in argument mode, should not highlight in strings
-"This is a @double quoted string."
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.double
-# ^ - punctuation.definition.variable
-# ^^^^^^^ - variable
-
-# double check scopes for automatic variables in strings
-"$_ $$ $Pwd"
-#^^ variable.language
-# ^^ variable.language
-# ^^^^ variable.language
-
-# Single quotes string
-'This is a string'
-# <- punctuation.definition.string.begin
-#^^^^^^^^^^^^^^^^^ meta.string string.quoted.single
-# ^ punctuation.definition.string.end
-
-# Hashtable
-$properties = @{
-# <- punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ keyword.operator.assignment
-# ^ keyword.other.hashtable.begin
-# ^ punctuation.section.braces.begin
- Name = 'Name'
- # <- meta.hashtable meta.hashtable.assignment variable.other.readwrite
- # ^ meta.hashtable meta.hashtable.assignment keyword.operator.assignment
- # ^ meta.hashtable string.quoted.single
- Something = $else
- # <- meta.hashtable meta.hashtable.assignment variable.other.readwrite
- # Atom-grammar-test is not tokenizing this correctly... Need to test in Atom - TODO
- Number = 16
- # <- meta.hashtable meta.hashtable.assignment variable.other.readwrite
- # ^ meta.hashtable meta.hashtable.assignment keyword.operator.assignment
- # ^^ meta.hashtable meta.number.integer.decimal constant.numeric.value
- from = 'hello world'
- # <- meta.hashtable meta.hashtable.assignment variable.other.readwrite
- # ^ meta.hashtable meta.hashtable.assignment keyword.operator.assignment
- # ^^^^^^^^^^^^^ meta.hashtable string.quoted.single
- hash = @{
- # <- meta.hashtable meta.hashtable.assignment variable.other.readwrite
- # ^ meta.hashtable meta.hashtable.assignment keyword.operator.assignment
- # ^ keyword.other.hashtable.begin
- # ^ punctuation.section.braces.begin
- hello = 'world'
- # <- meta.hashtable meta.hashtable.assignment variable.other.readwrite
- # ^ meta.hashtable meta.hashtable.assignment keyword.operator.assignment
- # ^^^^^^^ meta.hashtable string.quoted.single
- }
- # <- punctuation.section.braces.end
-}
-# <- punctuation.section.braces.end
-
-function Invoke-Something {}
-# @@@@@@@@@@@@@@@@ definition
-
-# Spatting
- Invoke-Something @properties
-# ^^^^^^^^^^^^^^^^ support.function
-# @@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-
-# ScriptBlock
- {Invoke-Something @properties}
-# ^ punctuation.section.braces.begin
-# ^^^^^^^^^^^^^^^^ support.function
-# @@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.braces.end
-{
-# <- punctuation.section.braces.begin
- Invoke-Something @properties
-# ^^^^^^^^^^^^^^^^ support.function
-# @@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-}
-# <- punctuation.section.braces.end
-$sb = {
-# <- punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ keyword.operator.assignment
-# ^ punctuation.section.braces.begin
- Invoke-Something @properties
-# ^^^^^^^^^^^^^^^^ support.function
-# @@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-}
-# <- punctuation.section.braces.end
-
-# Arrays
-$a1 = @(1,2,3,4)
-# <- variable.other.readwrite punctuation.definition.variable
-#^^ variable.other.readwrite
-# ^ keyword.operator.assignment
-# ^ keyword.other.array.begin
-# ^ punctuation.section.group.begin
-# ^ punctuation.section.group.end
-# ^^^^^^^ meta.group.array-expression
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.separator.sequence
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.separator.sequence
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.separator.sequence
-# ^ meta.number.integer.decimal constant.numeric.value
-$a2 = ('one','two','three','four')
-# <- variable.other.readwrite punctuation.definition.variable
-#^^ variable.other.readwrite
-# ^ keyword.operator.assignment
-# ^ punctuation.section.group.begin
-# ^^^^^ string.quoted.single
-# ^ punctuation.separator.sequence
-# ^^^^^ string.quoted.single
-# ^ punctuation.separator.sequence
-# ^^^^^^^ string.quoted.single
-# ^ punctuation.separator.sequence
-# ^^^^^^ string.quoted.single
-# ^ punctuation.section.group.end
-$a3 = $one, $two, $three, $four
-# <- variable.other.readwrite punctuation.definition.variable
-#^^ variable.other.readwrite
-# ^ punctuation.definition.variable
-# ^^^^ variable.other.readwrite
-# ^ punctuation.definition.variable
-# ^^^^ variable.other.readwrite
-# ^ punctuation.definition.variable
-# ^^^^^^ variable.other.readwrite
-# ^ punctuation.definition.variable
-# ^^^^^ variable.other.readwrite
-# ^ keyword.operator.assignment
-# ^ punctuation.separator
-# ^ punctuation.separator
-# ^ punctuation.separator
-$a1[0]
-# <- variable.other.readwrite punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.brackets.begin
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.section.brackets.end
-# ^^^ meta.brackets.indexer
-$a2[-1]
-# <- variable.other.readwrite punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.brackets.begin
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.section.brackets.end
-# ^^^^ meta.brackets.indexer
-$a3[1..2]
-# <- variable.other.readwrite punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.brackets.begin
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^^ keyword.operator.range
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.section.brackets.end
-# ^^^^^^ meta.brackets.indexer
- @(@($a))
-# ^ keyword.other.array.begin
-# ^ punctuation.section.group.begin
-# ^ keyword.other.array.begin
-# ^ punctuation.section.group.begin
-# ^ variable.other.readwrite punctuation.definition.variable
-# ^^ variable.other.readwrite
-# ^^ punctuation.section.group.end
- @(($i = 10); (++$j))
-# ^ keyword.other.array.begin
-# ^^ punctuation.section.group.begin
-# ^ variable.other.readwrite punctuation.definition.variable
-# ^^ variable.other.readwrite
-# ^ keyword.operator.assignment
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.section.group.end
-# ^ punctuation.terminator.statement
-# ^ punctuation.section.group.begin
-# ^^ keyword.operator.assignment
-# ^ variable.other.readwrite punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^^ punctuation.section.group.end
- @($i = 10)
-# ^ keyword.other.array.begin
-# ^ punctuation.section.group.begin
-# ^ variable.other.readwrite punctuation.definition.variable
-# ^^ variable.other.readwrite
-# ^ keyword.operator.assignment
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.section.group.end
- $i[($y - 1) + $x]
-# ^ variable.other.readwrite punctuation.definition.variable
-# ^^ variable.other.readwrite
-# ^ punctuation.section.brackets.begin
-# ^ punctuation.section.group.begin
-# ^ variable.other.readwrite punctuation.definition.variable
-# ^^ variable.other.readwrite
-# ^ keyword.operator.arithmetic
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.section.group.end
-# ^ keyword.operator.arithmetic
-# ^ variable.other.readwrite punctuation.definition.variable
-# ^^ variable.other.readwrite
-# ^ punctuation.section.brackets.end
-# ^^^^^^^^^^^^^^^ meta.brackets.indexer
-
-# Single quoted strings
- 'This is a single quoted string.'
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single
- '$This is a single ''quoted'' string.'
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single
-# ^^ constant.character.escape
-# ^^ constant.character.escape
- 'This is a
- single quoted string.'
-# ^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single
- 'This #also'
-# ^^^^^^^^^^^^ meta.string string.quoted.single
- '$(Invoke-Something)'
-# ^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single - meta.interpolation - variable - support
- 'This "string" is nice.'
-# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.single
-
-# Double quoted strings
- "This is a double quoted string."
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.double
- "$This is a double ""quoted"" string."
-# ^ meta.string string.quoted.double
-# ^^^^^ meta.string meta.interpolation variable.language - string
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.double - meta.interpolation
-# ^^ constant.character.escape
-# ^^ constant.character.escape
- "This is a
- double quoted string."
-# ^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.double
- "This #also"
-# ^^^^^^^^^^^^ meta.string string.quoted.double
- "$(Invoke-Something)"
-# ^ meta.string string.quoted.double
-# ^^^^^^^^^^^^^^^^^^^ meta.string meta.interpolation - string
-# ^^ punctuation.section.interpolation.begin
-# ^^^^^^^^^^^^^^^^ support.function
-# ^ punctuation.section.interpolation.end
-# @@@@@@@@@@@@@@@@ reference
- "This 'string' is nice."
-# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.double
-
-# Double quoted here-string
-@"
-# <- string.quoted.double.heredoc
- # <- string.quoted.double.heredoc
-$This is a 'double quoted'
-# <- punctuation.definition.variable
-#^^^^ variable.language
-Isn't it "nice"??
-There is no @platting here!
-# ^^^^^^^^^ - variable - punctuation
-"@
-# <- string.quoted.double.heredoc
- # <- string.quoted.double.heredoc
-@'
-#<- meta.string string.quoted.single.heredoc punctuation.definition.string.begin
-A 'single quoted' "heredoc"
-'@
-#<- meta.string string.quoted.single.heredoc punctuation.definition.string.end
-
-# Numeric constants
-
- -3 +3 3 3l 3lm 3lmb
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ meta.number.integer.decimal constant.numeric.suffix
-# ^^ meta.number.integer.decimal
-# ^ - constant.numeric
-# ^^^^ meta.number.integer.decimal
-# ^ constant.numeric.value
-# ^^^ constant.numeric.suffix
-
- 3y 3uy 3s 3us 3u 3ul # PowerShell 6.2+
-# ^^ meta.number.integer.decimal
-# ^ constant.numeric.value
-# ^ constant.numeric.suffix
-# ^^^ meta.number.integer.decimal
-# ^ constant.numeric.value
-# ^^ constant.numeric.suffix
-# ^^ meta.number.integer.decimal
-# ^ constant.numeric.value
-# ^ constant.numeric.suffix
-# ^^^ meta.number.integer.decimal
-# ^ constant.numeric.value
-# ^^ constant.numeric.suffix
-# ^^ meta.number.integer.decimal
-# ^ constant.numeric.value
-# ^ constant.numeric.suffix
-# ^^^ meta.number.integer.decimal
-# ^ constant.numeric.value
-# ^^ constant.numeric.suffix
-
- 3n # PowerShell 7.0+
-# ^^ meta.number.integer.decimal
-# ^ constant.numeric.value
-# ^ constant.numeric.suffix
-
- .5
-# ^^ meta.number.float.decimal constant.numeric.value - constant constant
-# ^ punctuation.separator.decimal
-
- +.5
-# ^ keyword.operator.unary
-# ^^ meta.number.float.decimal constant.numeric.value - constant constant
-# ^ punctuation.separator.decimal
-
- 1.
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ - meta.number - constant.numeric
-
- 1.f 1.f()
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.accessor.dot
-# ^ variable.other.member
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.accessor.dot
-# @ reference
-# ^ meta.function-call variable.function
-# ^ meta.function-call.arguments punctuation.section.arguments.begin
-# ^ meta.function-call.arguments punctuation.section.arguments.end
-
- 1.d
-# ^^^ meta.number.float.decimal - constant constant
-# ^^ constant.numeric.value
-# ^ punctuation.separator.decimal
-# ^ constant.numeric.suffix
-
- 1.lGB
-# ^^^^^ meta.number.float.decimal
-# ^^ constant.numeric.value
-# ^ punctuation.separator.decimal
-# ^^^ constant.numeric.suffix
-
- 1.dGB
-# ^^^^^ meta.number.float.decimal
-# ^^ constant.numeric.value
-# ^ punctuation.separator.decimal
-# ^^^ constant.numeric.suffix
-
- 1.e+12d
-# ^^^^^^^ meta.number.float.decimal
-# ^^^^^^ constant.numeric.value
-# ^ punctuation.separator.decimal
-# ^ constant.numeric.suffix
-
- 1e+12d
-# ^^^^^^ meta.number.float.decimal
-# ^^^^^ constant.numeric.value
-# ^ constant.numeric.suffix
-
- 1.5
-# ^^^ meta.number.float.decimal constant.numeric.value
-# ^ punctuation.separator.decimal
-
- -1.5
-# ^ keyword.operator.unary
-# ^^^ meta.number.float.decimal constant.numeric.value
-# ^ punctuation.separator.decimal
-
- -3 + -2
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ keyword.operator.arithmetic
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-
- -3+-2
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ keyword.operator.arithmetic
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-
- 3++2
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ keyword.operator.arithmetic
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-
- +2
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-
- -3+-
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^^ keyword.operator
-
- 10/-10
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^ keyword.operator.arithmetic
-# ^^ meta.number.integer.decimal constant.numeric.value
-
- 10/-10D
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^ keyword.operator.arithmetic
-# ^^^ meta.number.float.decimal
-# ^^ constant.numeric.value
-# ^ constant.numeric.suffix
-
- -10.002L
-# ^ keyword.operator.unary
-# ^^^^^^^ meta.number.float.decimal
-# ^^^^^^ constant.numeric.value
-# ^ punctuation.separator.decimal
-# ^ constant.numeric.suffix
-
- $x..5.40D
-# ^ punctuation.definition.variable
-# ^^ variable.other.readwrite
-# ^^ keyword.operator.range
-# ^^^^^ meta.number.float.decimal
-# ^^^^ constant.numeric.value
-# ^ punctuation.separator.decimal
-# ^ constant.numeric.suffix
-
- -500..-495
-# ^ keyword.operator.unary
-# ^^^ meta.number.integer.decimal constant.numeric.value
-# ^^ keyword.operator.range
-# ^ keyword.operator.unary
-# ^^^ meta.number.integer.decimal constant.numeric.value
-
- $true..3
-# ^ punctuation.definition.variable
-# ^^^^ constant.language
-# ^^ keyword.operator.range
-# ^ meta.number.integer.decimal constant.numeric.value
-
- -2..$null
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^^ keyword.operator.range
-# ^^^^^ constant.language
-# ^ punctuation.definition.variable
-
- -3..3
-# ^ keyword.operator.unary
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^^ keyword.operator.range
-
- 1..3
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^^ keyword.operator.range
-
- 6,10,-3
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.separator.sequence -constant
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.separator.sequence -constant
-# ^ meta.number.integer.decimal constant.numeric.value
-
- 0x476 0X476 0x476l 0x47m 0x47mb
-# ^^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^^ constant.numeric.value
-# ^^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^^ constant.numeric.value
-# ^^^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^^ constant.numeric.value
-# ^ constant.numeric.suffix
-# ^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^ - constant.numeric
-# ^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^^ constant.numeric.suffix
-
- +0x20 +0X20 +0x20l +0x20m +0x20mb
-# ^ keyword.operator.unary
-# ^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^ keyword.operator.unary
-# ^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^ constant.numeric.suffix
-# ^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^ - constant.numeric
-# ^^^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^^ constant.numeric.suffix
-
- -0x20 -0X20 -0x20l -0x20m -0x20mb
-# ^ keyword.operator.unary
-# ^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^ keyword.operator.unary
-# ^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^ keyword.operator.unary
-# ^^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^ constant.numeric.suffix
-# ^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^ - constant.numeric
-# ^^^^^^ meta.number.integer.hexadecimal
-# ^^ constant.numeric.base
-# ^^ constant.numeric.value
-# ^^ constant.numeric.suffix
-
-# Types
-[string]
-# <- punctuation.section.brackets.begin
-# ^ storage.type
-# ^ punctuation.section.brackets.end
-[string[]]
-# <- punctuation.section.brackets.begin
-# ^ storage.type
-# ^ punctuation.section.brackets.begin
-# ^^ punctuation.section.brackets.end
-[int32]
-# <- punctuation.section.brackets.begin
-# ^^^^ storage.type
-# ^ punctuation.section.brackets.end
-[System.Collections.Generic.Dictionary[[System.String, mscorlib],[System.Management.Automation.ParameterMetadata,System.Management.Automation]]]
-# <- punctuation.section.brackets.begin
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ storage.type
-# ^^ punctuation.section.brackets.begin
-# ^^^^^^^^^^^^^ storage.type
-# ^^^^^^^^ storage.type
-# ^ punctuation.section.brackets.end
-# ^ punctuation.section.brackets.begin
-# ^^^^^^^^^^^^^^^^ storage.type
-# ^^^ punctuation.section.brackets.end
-[System.Array+SZArrayEnumerator]
-# <- punctuation.section.brackets.begin
-# ^^^^^^^^^^^ storage.type
-# ^^^^^^^^^^^^^^^^^ storage.type
-# ^ keyword.operator
-# ^ punctuation.section.brackets.end
-[int]::MinValue
-# <- punctuation.section.brackets.begin
-# ^ storage.type
-# ^ punctuation.section.brackets.end
-# ^^ punctuation.accessor.double-colon
-# ^^^^^^^^ variable.other.member
-[System.DateTime]::Parse('2016/09/21')
-# <- punctuation.section.brackets.begin
-# ^^^^^^^^^^^^^^ storage.type
-# ^ punctuation.section.brackets.end
-# ^^ punctuation.accessor.double-colon
-# ^^^^^ meta.function-call variable.function
-# @@@@@ reference
-# ^^^^^^^^^^^^^^ meta.function-call.arguments
-# ^ punctuation.section.arguments.begin
-# ^ punctuation.section.arguments.end
-
-# Commands (functions)
- Invoke-Something -foobar
-#^ support.function
-# ^ punctuation.definition.parameter
-# ^^^^^^^ variable.parameter.option
-#@@@@@@@@@@@@@@@@ reference
- Invoke-Something -foobar value
-#^ support.function
-# ^ punctuation.definition.parameter
-# ^^^^^^^ variable.parameter.option
-#@@@@@@@@@@@@@@@@ reference
- Invoke-Something -foobar:$true
-#^ support.function
-#@@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.parameter
-# ^^^^^^^ variable.parameter.option
-# ^ punctuation.definition.variable
-# ^^^^ constant.language
- Invoke-Something -foobar: $true
-#^ support.function
-#@@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.parameter
-# ^^^^^^^ variable.parameter.option
- Invoke-Something -p1 v1 -p2 10 -p3 'value' -switch -verbose
-#^ support.function
-#@@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
-# ^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^^^^^^ - keyword
-# ^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
- Invoke-Something (1..20 | Invoke-Something) -p2 'value'
-#^ support.function
-#@@@@@@@@@@@@@@@@ reference
-# @@@@@@@@@@@@@@@@ reference
-# ^^ keyword.operator.range
- Invoke-Something -p1 v2 -p2 30 | Invoke-Something -switch
-#^ support.function
-# @@@@@@@@@@@@@@@@ reference
-#@@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
-# ^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^ keyword.operator.logical.pipe
-# ^ support.function
-# ^ punctuation.definition.parameter
-# ^^^^^^^ variable.parameter.option - keyword
- Invoke-Something -p1 {
-#^ support.function
-#@@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
- Invoke-Something -foobar:$true
-# ^ support.function
-# @@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.parameter
-# ^^^^^^^ variable.parameter.option
-# ^ punctuation.definition.variable
-# ^^^^ constant.language
-} | Invoke-Something
-# <- punctuation.section.braces.end
-# ^ keyword.operator.logical.pipe
-# ^ support.function
-# @@@@@@@@@@@@@@@@ reference
- Invoke-Something -p1 value `
-#^ support.function
-#@@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
-# ^ punctuation.separator.continuation
- -p2 14.4 `
-# ^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
-# ^^^^ meta.number.float.decimal constant.numeric.value
-# ^ punctuation.separator.continuation
- -p3 $value | Invoke-Something -verbose
-# ^ punctuation.definition.parameter
-# ^^^ variable.parameter.option
-# @@@@@@@@@@@@@@@@ reference
-# ^ punctuation.definition.parameter
-# ^^^^^^^^ variable.parameter.option
-# ^ punctuation.definition.variable
-# ^ keyword.operator.logical.pipe
-# ^^^^^^^^^^^^^^^^ support.function
-
-# Commands (Built-in variables)
-ls *.ps1 -recurse
-# ^ keyword.operator
-# ^ punctuation.definition.parameter
-# ^^^^^^^^ variable.parameter.option
-
-# Commands (executable files)
-. .\scripts\myscript.ps1 -parameter 'value'
-# <- keyword.operator.other
-# ^ punctuation.definition.parameter
-# ^^^^^^^^^^ variable.parameter.option
-# ^^^^^^^ string.quoted.single
-& tool.exe
-# <- keyword.operator.other
-# ^^^^^^^^ variable.function
-something.cmd
-#^^^^^^^^^^^^ variable.function
- øyvind.com
-#^^^^^^^^^^ variable.function
-
-# switch
-switch ("fourteen") {}
-# <- keyword.control
-# ^ punctuation.section.group.begin
-# ^ string.quoted.double
-# ^ punctuation.section.group.end
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-switch -CaseSensitive ("fourteen") {}
-# <- keyword.control
-# ^ punctuation.definition.parameter
-# ^^^^^^^^^^^^^^ variable.parameter.option
-# ^ punctuation.section.group.begin
-# ^ string.quoted.double
-# ^ punctuation.section.group.end
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-switch -Regex ("fourteen") {}
-# <- keyword.control
-# ^ punctuation.definition.parameter
-# ^^^^^^ variable.parameter.option
-# ^ punctuation.section.group.begin
-# ^ string.quoted.double
-# ^ punctuation.section.group.end
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-switch -Wildcard ($a) {}
-# <- keyword.control
-# ^ punctuation.definition.parameter
-# ^^^^^^^^^ variable.parameter.option
-# ^ punctuation.section.group.begin
-# ^ punctuation.definition.variable
-# ^ punctuation.section.group.end
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-switch -regex -file .\somefile.txt {}
-# <- keyword.control
-# ^ punctuation.definition.parameter
-# ^^^^^^ variable.parameter.option
-# ^ punctuation.definition.parameter
-# ^^^^ variable.parameter.option
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-switch (3) {}
-# <- keyword.control
-# ^ punctuation.section.group.begin
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.section.group.end
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-switch (4, 2) {}
-# <- keyword.control
-# ^ punctuation.section.group.begin
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.separator
-# ^ punctuation.section.group.end
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-
-switch -Regex -File $filePath {
-# <- keyword.control
-# ^ punctuation.definition.parameter
-# ^^^^^^ variable.parameter.option
-# ^ punctuation.definition.parameter
-# ^^^^ variable.parameter.option
-# ^ punctuation.definition.variable
-# ^ meta.block punctuation.section.braces.begin
- '.' {}
-# ^^^ string.quoted.single
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
- default {}
-# ^^^^^^^ keyword.control
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-}
-# <- meta.block punctuation.section.braces.end
-
-switch -Wildcard -CaseSensitive ($something) {
-# <- keyword.control
-# ^ punctuation.definition.parameter
-# ^^^^^^^^^ variable.parameter.option
-# ^ punctuation.definition.parameter
-# ^^^^^^^^^^^^^^ variable.parameter.option
-# ^ punctuation.section.group.begin
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.group.end
-# ^ meta.block punctuation.section.braces.begin
- '.' {}
-# ^^^ string.quoted.single
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
- default {}
-# ^^^^^^^ keyword.control
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-}
-# <- meta.block punctuation.section.braces.end
-
-switch ('this') {
-# <- keyword.control
-# ^ punctuation.section.group.begin
-# ^^^^^^ string.quoted.single
-# ^ punctuation.section.group.end
-# ^ meta.block punctuation.section.braces.begin
- 'this' {}
-# ^^^^^^ string.quoted.single
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
- default {}
-# ^^^^^^^ keyword.control
-# ^ meta.block punctuation.section.braces.begin
-# ^ meta.block punctuation.section.braces.end
-}
-# <- meta.block punctuation.section.braces.end
-
-# Functions and filters
-functioN MyFunction{}
-# <- storage.type
-# ^^^^^^^^^^ entity.name.function
-# @@@@@@@@@@ definition
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-function My-Function {}
-# <- storage.type
-# ^^^^^^^^^^^ entity.name.function
-# @@@@@@@@@@@ definition
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-Function My.Function{}
-# <- storage.type
-# ^^^^^^^^^^^ entity.name.function
-# @@@@@@@@@@@ definition
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-function My-Function.Other{}
-# <- storage.type
-# ^^^^^^^^^^^^^^^^^ entity.name.function
-# @@@@@@@@@@@@@@@@@ definition
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-function Some.other.function{}
-# <- storage.type
-# ^^^^^^^^^^^^^^^^^^^ entity.name.function
-# @@@@@@@@@@@@@@@@@@@ definition
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-FUNCTION MyFunction2 {}
-# <- storage.type
-# ^^^^^^^^^^^ entity.name.function
-# @@@@@@@@@@@ definition
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-function New-File { }
-# <- storage.type
-# ^^^^^^^^ entity.name.function
-# @@@@@@@@ definition
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-function New-File ($Name) { }
-# <- storage.type
-# ^^^^^^^^ entity.name.function
-# @@@@@@@@ definition
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
- New-File
-#^^^^^^^^ meta.function-call support.function
-#@@@@@@@@ reference
-function NewFile($Name) { }
-# <- storage.type
-# ^^^^^^^ entity.name.function
-# @@@@@@@ definition
-# ^ punctuation.section.group.begin
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.group.end
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-filter myfilter($param) {}
-# <- storage.type
-# ^^^^^^^^ entity.name.function
-# @@@@@@@@ definition
-# ^ punctuation.section.group.begin
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.group.end
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-Filter my-Filter ($param){}
-# <- storage.type
-# ^^^^^^^^^ entity.name.function
-# @@@@@@@@@ definition
-# ^ punctuation.section.group.begin
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.group.end
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-
-# Note that the # in the path should highlight as a comment!
-function Test-Drive([string]$roman) {
-# <- storage.type
-# ^^^^^^^^^^ entity.name.function
-# @@@@@@@@@@ definition
-# ^ punctuation.section.group.begin
-# ^ punctuation.section.brackets.begin
-# ^^^^^^ storage.type
-# ^ punctuation.section.brackets.end
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.group.end
-# ^ punctuation.section.braces.begin
- $roman | c:\users\Me\Documents\Programming\F#\test.exe $roman
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ keyword.operator.logical.pipe
-# ^ punctuation.definition.comment
-# ^^^^ comment.line
-}
-# <- punctuation.section.braces.end
-
-function Verb-Noun
-#^^^^^^^^^^^^^^^^^ meta.function
-#^^^^^^^ storage.type
-# ^^^^^^^^^ meta.function entity.name.function
-# @@@@@@@@@ definition
-{
-# <- punctuation.section.braces.begin
-
- Param
- #^^^^^ keyword.declaration.parameter
- (
- # <- punctuation.section.group.begin
- # Param1 help description
- # <- comment.line punctuation.definition.comment
- # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
- [Parameter(Mandatory=$true,
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^^^^ constant.language
- # ^ punctuation.separator
- ValueFromPipeline=$true,
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^^^^ constant.language
- # ^ punctuation.separator
- ValueFromPipelineByPropertyName = $true,
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^^^^^ constant.language
- # ^ punctuation.separator
- ValueFromRemainingArguments=$false,
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ punctuation.definition.variable
- # ^^^^^ constant.language
- # ^ punctuation.separator
- Position=0,
- #^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^ meta.number.integer.decimal constant.numeric.value
- # ^ punctuation.separator
- SupportsPaging,
- #^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ punctuation.separator
- ParameterSetName = 'Parameter Set 1')]
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # ^^^^^^^^^^^^^^^^ variable.parameter.attribute
- # ^ keyword.operator.assignment
- # ^^^^^^^^^^^^^^^^^ string.quoted.single
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- # ^ - meta.attribute
- [ValidateNotNullOrEmpty()]
- #^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^^^^^^^^^^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [ValidateNotNull()]
- #^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^^^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [ValidateNotNullOrEmpty()]
- #^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^^^^^^^^^^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [ValidateCount(0,5)]
- #^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^^^^^^^^^^^^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^ meta.number.integer.decimal constant.numeric.value
- # ^ punctuation.separator
- # ^ meta.number.integer.decimal constant.numeric.value
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [ValidateSet("sun", "moon", "earth")]
- #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^^^^ string.quoted.double
- # ^ punctuation.separator
- # ^^^^^^ string.quoted.double
- # ^ punctuation.separator
- # ^^^^^^^ string.quoted.double
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- [Alias("p1")]
- #^^^^^^^^^^^^ meta.attribute
- # <- punctuation.section.brackets.begin
- # ^ support.function.attribute
- # ^ punctuation.section.group.begin
- # ^^^^ string.quoted.double
- # ^ punctuation.section.group.end
- # ^ punctuation.section.brackets.end
- $Param1
- # <- punctuation.definition.variable
- # ^ variable.other.readwrite
- )
- # <- punctuation.section.group.end
-
- # Do Something....
-
-}
-# <- punctuation.section.braces.end
-
-# Class
-class Vehicle {
-# <- storage.type.class
-# ^^^^^^^ entity.name.class
-# @@@@@@@ definition
-# ^ punctuation.section.braces.begin
- Vehicle() {}
-# ^ punctuation.section.group.begin
-# ^ punctuation.section.group.end
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
- Vehicle([string]$Owner) {
-# ^ storage.type
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-# ^ punctuation.section.braces.begin
- $this.Owner = $Owner
- }
-
- [int]$Mileage
-# ^ storage.type
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
- [int]$Age
-# ^ storage.type
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
- [string]$Owner
-# ^ storage.type
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
-
- [void]Drive([int]$NumberOfMiles) {
-# ^^^^ storage.type
-# ^^^^^ meta.function entity.name.function
-# @@@@@ definition
-# ^^^ storage.type
-# ^ punctuation.definition.variable
-# ^ variable.other.readwrite
- $this.Mileage += $NumberOfMiles
-# ^^^^^ variable.language
-# ^ punctuation.definition.variable
-# ^^^^^^^ variable.other.member
-# ^^ keyword.operator.assignment
-
- }
- # <- punctuation.section.braces.end
- static [System.Array] GetAvailableColors() {
-# ^^^^^^^^^^^^^^^^^^ meta.function entity.name.function
-# @@@@@@@@@@@@@@@@@@ definition
-# ^^^^^^ meta.function storage.modifier
-# ^^^^^^^^^^^ meta.function storage.type
- return 'yellow', 'red'
- }
-}
-# <- punctuation.section.braces.end
-
-$fiat.Drive(42)
-# ^^^^^ meta.function-call
-# @@@@@ reference
-[Vehicle]::GetAvailableColors()
-# ^^^^^^^^^^^^^^^^^^ meta.function-call variable.function
-# @@@@@@@@@@@@@@@@@@ reference
-
-# Control words
-foreach ($item in $collection) {
-# <- keyword.control
-# ^ punctuation.section.group.begin
-# ^^ keyword.control
-# ^ punctuation.section.group.end
-# ^ punctuation.section.braces.begin
-# ^ punctuation.definition.variable
-# ^ punctuation.definition.variable
-}
-# <- punctuation.section.braces.end
-
-try { }
-# <- keyword.control
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-catch { }
-# <- keyword.control
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-clean { }
-# <- keyword.context.block.clean
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-
-# Reserved words
-Configuration Crazyness {
-# <- storage.type
-# ^^^^^^^^^ entity.name.function
-# @@@@@@@@@ definition
-# ^ punctuation.section.braces.begin
- Node Whatever {
-# ^ punctuation.section.braces.begin
- }
- # <- punctuation.section.braces.end
-}
-# <- punctuation.section.braces.end
-
-# Redirection
-notepad.exe > log.txt
-#^^^^^^^^^^ variable.function
-# ^ keyword.operator.redirection
-notepad.exe 1> log.txt
-#^^^^^^^^^^ variable.function
-# ^ keyword.operator.redirection
-notepad.exe *> log.txt
-#^^^^^^^^^^ variable.function
-# ^ keyword.operator.redirection
-notepad.exe 2>&1
-#^^^^^^^^^^ variable.function
-# ^^ keyword.operator.redirection
-notepad.exe 3>&1
-#^^^^^^^^^^ variable.function
-# ^^ keyword.operator.redirection
-notepad.exe 4>&1
-#^^^^^^^^^^ variable.function
-# ^^ keyword.operator.redirection
-notepad.exe 5>&1
-#^^^^^^^^^^ variable.function
-# ^^ keyword.operator.redirection
-notepad.exe 6>&1
-#^^^^^^^^^^ variable.function
-# ^^ keyword.operator.redirection
-notepad.exe 2>&1> log.txt
-#^^^^^^^^^^ variable.function
-# ^^ keyword.operator.redirection
-# ^ keyword.operator.redirection
-
-# Operators
-if (10 -cgt 100) { }
-# <- keyword.control
-# ^ punctuation.section.group.begin
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^^^^ keyword.operator.comparison
-# ^^^ meta.number.integer.decimal constant.numeric.value
-# ^ punctuation.section.group.end
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-$a -is $b
-# ^^^ keyword.operator.logical
-$b -contains $c
-# ^^^^^^^^^ keyword.operator.logical
-$x -notcontains $c
-# ^^^^^^^^^^^^ keyword.operator.logical
-$c -in $b
-# ^^^ keyword.operator.logical
-$c -notin $x
-# ^^^^^^ keyword.operator.logical
-$a -match $b
-# ^^^^^^ keyword.operator.logical
-$a -notmatch $b
-# ^^^^^^^^^ keyword.operator.logical
-$x -like $c
-# ^^^^^ keyword.operator.logical
-100 -and 0
-# ^^^^ keyword.operator.logical
-# ^ meta.number.integer.decimal constant.numeric.value
-$a -ceq 4 -and $a -ine $d -or
-# ^^^^ keyword.operator.comparison
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^^^^ keyword.operator.logical
-# ^ punctuation.definition.variable
-# ^^^^ keyword.operator.comparison
-# ^^^ keyword.operator.logical
-$c -is [Type]
-# ^^^ keyword.operator.logical
-# ^ storage.type
-$c -isnot [Type]
-# ^^^^^^ keyword.operator.logical
-# ^ storage.type
-$c -as [Type]
-# ^^^ keyword.operator.cast
-# ^ storage.type
-$k = $y -bor $k
-# ^ keyword.operator.assignment
-# ^ keyword.operator.bitwise
-$x = $y -band $x
-# ^ keyword.operator.assignment
-# ^ keyword.operator.bitwise
-$z = -bnot $x
-# ^ keyword.operator.assignment
-# ^ keyword.operator.bitwise
-$l = 1 -shl 10
-# ^ keyword.operator.assignment
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^^^^ keyword.operator.bitwise
-$r = 10 -shr 1
-# ^ keyword.operator.assignment
-# ^^ meta.number.integer.decimal constant.numeric.value
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^^^^ keyword.operator.bitwise
-$k = $y -xor $b
-# ^ keyword.operator.assignment
-# ^ keyword.operator.logical
-$k = $y -bxor $b
-# ^ keyword.operator.assignment
-# ^ keyword.operator.bitwise
-$a -icontains $c
-# ^^^^^^^^^^ keyword.operator.logical
-$a -ccontains $c
-# ^^^^^^^^^^ keyword.operator.logical
-$a -iNotContains $c
-# ^^^^^^^^^^^^^ keyword.operator.logical
-$a -cNotContains $c
-# ^^^^^^^^^^^^^ keyword.operator.logical
-$a -cmatch $c
-# ^^^^^^^ keyword.operator.logical
-$x -iMatch $c
-# ^^^^^^^ keyword.operator.logical
-$x -iNotMatch $c
-# ^^^^^^^^^^ keyword.operator.logical
-$a -iLike $b
-# ^^^^^^ keyword.operator.logical
-$b -cLike $c
-# ^^^^^^ keyword.operator.logical
-"hey" -cgt "Hey"
-# ^^^^ keyword.operator.comparison
-"Hey" -igt "hey"
-# ^^^^ keyword.operator.comparison
-"hey" -cge "Hey"
-# ^^^^ keyword.operator.comparison
-"Hey" -ige "hey"
-# ^^^^ keyword.operator.comparison
-"HEY" -clt "hey"
-# ^^^^ keyword.operator.comparison
-"HEY" -ilt "hey"
-# ^^^^ keyword.operator.comparison
-"HEY" -cle "hey"
-# ^^^^ keyword.operator.comparison
-"HEY" -ile "hey"
-# ^^^^ keyword.operator.comparison
-
-# format
- "{0:N2}" -f $a
-# ^^^^^^^^ string.quoted.double
-# ^^ keyword.operator.string-format
- "{0:D8}" -f $a
-# ^^^^^^^^ string.quoted.double
-# ^^ keyword.operator.string-format
- "{0:C2}" -f $a
-# ^^^^^^^^ string.quoted.double
-# ^^ keyword.operator.string-format
- "{0:P0}" -f $a
-# ^^^^^^^^ string.quoted.double
-# ^^ keyword.operator.string-format
- "{0:X0}" -f $a
-# ^^^^^^^^ string.quoted.double
-# ^^ keyword.operator.string-format
- (1.11).ToString("#.#")
-# ^ punctuation.section.group.begin
-# ^^^^ meta.number.float.decimal constant.numeric.value
-# ^ punctuation.section.group.begin
-# ^ string.quoted.double
- "{1,10} {0,10} {2,10:x}" -f "First", "Second", 255
-# ^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double
-# ^^ keyword.operator.string-format
-# ^^^ meta.number.integer.decimal constant.numeric.value
- ("{0,6}" -f 4.99), ("{0,6:##.00}" -f 15.9)
-# ^^ keyword.operator.string-format
-# ^^^^ meta.number.float.decimal constant.numeric.value
-# ^^^^^^^^^^^^^ string.quoted.double
-# ^^ keyword.operator.string-format
- "{0:R}" -f (1mb/2.0)
-# ^ keyword.operator.string-format
-# ^ meta.number.integer.decimal constant.numeric.value
-# ^^ meta.number.integer.decimal constant.numeric.suffix
- "{0:00.0}" -f 4.12341234
-# ^ keyword.operator.string-format
- "{0:##.#}" -f 4.12341234
-# ^ string.quoted.double
-# ^ keyword.operator.string-format
-# ^^^^^^^^^^ meta.number.float.decimal constant.numeric.value
- "{0:#,#.#}" -f 1234.121234
-# ^ string.quoted.double
-# ^ keyword.operator.string-format
- "{0:##,,.000}" -f 1048576
-# ^ string.quoted.double
-# ^ keyword.operator.string-format
- "{this is not a #comment}"
-# ^ - comment
- "{0:##.#E000}" -f 2.71828
-# ^ string.quoted.double
-# ^ keyword.operator.string-format
- "{0:#.00'##'}" -f 2.71828
-# ^ string.quoted.double
-# ^ keyword.operator.string-format
- "{0:POS;NEG;ZERO}" -f -14
-# ^ string.quoted.double
-# ^ keyword.operator.string-format
- "{0:$## Please}" -f 14
-# ^ string.quoted.double
-# ^ keyword.operator.string-format
- "{0,-8:P1}" -f 1.75
-# ^ string.quoted.double
-# ^ keyword.operator.string-format
- "{0,10:N3}{1,10:N3}{2,10:N3}{3,10:N3}" -f 0.2, 0.3, 0.45, 0.91
-# ^ keyword.operator.string-format
- '{0:00000.000}' -f 7.125
-# ^ string.quoted.single
-# ^ keyword.operator.string-format
-
-function Test-Function {}
-# @@@@@@@@@@@@@ definition
-function New-Object {}
-# @@@@@@@@@@ definition
-# Misc test cases
- Test-Function -Class ClassName
-# ^^^^^ - storage.type
-#@@@@@@@@@@@@@ reference
- New-Object -TypeName System.Diagnostics.Process
-# ^^^^^^^ - keyword.control
-#@@@@@@@@@@ reference
- New-Object -TypeName System.Data
-# ^^^^ - keyword.control
-#@@@@@@@@@@ reference
- New-Object -TypeName Sy-stem.if
-# ^^ - keyword.control
-#@@@@@@@@@@ reference
- New-Object -TypeName S_ystem.Clean
-# ^^^^^ - keyword.control
-#@@@@@@@@@@ reference
- New-Object -TypeName Sy_stem-.Throw
-# ^^^^^ - keyword.control
-#@@@@@@@@@@ reference
-echo `"test`"
-# ^^^^^^^^^ - string.quoted
-# ^^ constant.character.escape
-# ^^ constant.character.escape
-@("any","array","has").foreach({ $_ })
-# <- keyword.other.array.begin
-# ^ meta.group.array-expression
-# ^ keyword.control
-# ^ meta.block
-@('any','array','has').foreach{ $_ }
-# <- keyword.other.array.begin
-# ^ meta.group.array-expression
-# ^ keyword.control
-# ^ meta.block
-@("any","array","has").where({ $_.Length -gt 3 })
-# <- keyword.other.array.begin
-# ^ meta.group.array-expression
-# ^ keyword.control
-# ^ meta.block
-@("any","array","has").where{ $_.Length -gt 3 }
-# <- keyword.other.array.begin
-# ^ meta.group.array-expression
-# ^ keyword.control
-# ^ meta.block
-function join-path {}
-# @@@@@@@@@ definition
-$file = join-path $env:SystemDrive "$([System.io.path]::GetRandomFileName()).ps1"
-# <- punctuation.definition.variable
-# @@@@@@@@@ reference
-# ^ support.function
-# ^ support.variable.drive
-# ^ variable.other.readwrite
-# ^^ meta.string meta.interpolation punctuation.section.interpolation.begin
-# ^ storage.type
-# @@@@@@@@@@@@@@@@@ reference
-function out-file {}
-# @@@@@@@@ definition
-$ScriptBlock | Out-File $file -Force
-# <- punctuation.definition.variable
-# @@@@@@@@ reference
-# ^ keyword.operator.logical.pipe
-# ^ punctuation.definition.variable
-# ^ punctuation.definition.parameter
-# ^^^^^^ variable.parameter.option
-workflow w1 {}
-# <- storage.type
-# ^^ entity.name.function
-# @@ definition
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-Workflow work { sequence {} }
-# <- storage.type
-# ^^^^ entity.name.function
-# @@@@ definition
-# ^ punctuation.section.braces.begin
-# ^^^^^^^^ keyword.control
-# ^ punctuation.section.braces.begin
-# ^ punctuation.section.braces.end
-# ^ punctuation.section.braces.end
-function get-something {}
-# @@@@@@@@@@@@@ definition
-function Out-WithYou {}
-# @@@@@@@@@@@ definition
- get-thing | Out-WithYou > $null # destroy
-#^^^^^^^^^ support.function
-#@@@@@@@@@ reference
-# ^^^^^^^^^^^ support.function
-# @@@@@@@@@@@ reference
-# ^ keyword.operator.logical.pipe
-# ^ keyword.operator.redirection
-# ^ punctuation.definition.variable
-# ^ constant.language
-# ^ punctuation.definition.comment
-# ^^^^^^^^^ comment.line
-"Escaped chars: `", `n, `$, `b, `t, `e, `u{10ffff}, `""
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double
-# ^^ constant.character.escape
-# ^^ constant.character.escape
-# ^^ constant.character.escape
-# ^^ constant.character.escape
-# ^^ constant.character.escape
-# ^^ constant.character.escape
-# ^^^^^^^^^^ constant.character.escape
-# ^^ constant.character.escape
-'But here they''re not escape chars: `", `n, `$, `b, `"'
-# ^^ constant.character.escape
-# ^^^^^^^^^^^^^^^^^^^ - constant
-function get-number {}
-# @@@@@@@@@@ definition
-"When you call a method: $( get-number | %{ invoke-command $( [string]::format("Like (this{0})","what?") ) $var } )"
-# ^^ punctuation.section.interpolation.begin - source.powershell.embedded
-# @@@@@@@@@@ reference
-# @@@@@@@@@@@@@@ reference
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.powershell.embedded
-# ^ keyword.operator.logical.pipe
-# ^ meta.group.complex.subexpression punctuation.section.group.begin
-# ^^^^^^ storage.type
-# ^^ punctuation.accessor.double-colon
-# ^^^^^^ meta.function-call variable.function
-# @@@@@@ reference
-# ^ meta.group.complex.subexpression punctuation.section.arguments.begin
-# ^ meta.group.complex.subexpression punctuation.section.arguments.end
-# ^ meta.group.complex.subexpression punctuation.section.group.end
-# ^ punctuation.definition.variable
-# ^ punctuation.section.interpolation.end - source.powershell.embedded
-"This is the DebugPreference variable: $DebugPreference"
-#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.double
-# ^^^^^^^^^^^^^^^^ meta.string meta.interpolation variable.language - string
-
- $ConfirmPreference $DebugPreference $ErrorActionPreference $ErrorView
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^ variable.language - punctuation
- $FormatEnumerationLimit $InformationPreference $LogCommandHealthEvent
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-
- $LogCommandLifecycleEvent $LogEngineHealthEvent $LogEngineLifecycleEvent
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
- $LogProviderHealthEvent $LogProviderLifecycleEvent $MaximumAliasCount
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
- $MaximumDriveCount $MaximumErrorCount $MaximumFunctionCount $MaximumHistoryCount
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
- $MaximumVariableCount $OFS $OutputEncoding $PSCulture $PSDebugContext
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^ variable.language - punctuation
- $PSDefaultParameterValues $PSEmailServer $PSItem $PSModuleAutoLoadingPreference
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
- $PSModuleAutoloadingPreference $PSSenderInfo $PSSessionApplicationName
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
- $PSSessionConfigurationName $PSSessionOption $ProgressPreference
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^^ variable.language - punctuation
- $VerbosePreference $WarningPreference $WhatIfPreference
-#^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
-# ^ variable.language punctuation
-# ^^^^^^^^^^^^^^^^ variable.language - punctuation
-<#
-.SYNOPSIS
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^^ keyword.other.documentation
-.DESCRIPTION
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^^^^^ keyword.other.documentation
-.PARAMETER
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^^ keyword.other.documentation
-.EXAMPLE
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^ keyword.other.documentation
-.INPUTS
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^ keyword.other.documentation
-.OUTPUTS
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^ keyword.other.documentation
-.NOTES
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^ keyword.other.documentation
-.LINK
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^ keyword.other.documentation
-.COMPONENT
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^^^ keyword.other.documentation
-.ROLE
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^ keyword.other.documentation
-.FUNCTIONALITY
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^^^^^^^ keyword.other.documentation
-.FORWARDHELPTARGETNAME
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^^^^^^^^^^^^^^^ keyword.other.documentation
-.FORWARDHELPCATEGORY
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^^^^^^^^^^^^^ keyword.other.documentation
-.REMOTEHELPRUNSPACE
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^^^^^^^^^^^^ keyword.other.documentation
-.EXTERNALHELP
-#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
-#^^^^^^^^^^^^ keyword.other.documentation
-#>
-
-#region Test
-#<- punctuation.definition.comment
-#^^^^^^ keyword.other.region.begin
-#<- comment.line.powershell
-# ^^^^ meta.toc-list entity.name.section
-# @@@@ local-definition
-# ^ meta.fold.begin
-#endregion (More comments)
-#<- punctuation.definition.comment.powershell
-#^^^^^^^^^ keyword.other.region.end.powershell
-#<- comment.line
-# ^ meta.fold.end
-
-#region
-#<- punctuation.definition.comment
-#^^^^^^ keyword.other.region.begin
-#<- comment.line.powershell
-# ^ meta.fold.begin
-#endregion (More comments)
-#<- punctuation.definition.comment.powershell
-#^^^^^^^^^ keyword.other.region.end.powershell
-#<- comment.line
-# ^ meta.fold.end
diff --git a/bin/Publish.ps1 b/bin/Publish.ps1
deleted file mode 100644
index 3dac4059..00000000
--- a/bin/Publish.ps1
+++ /dev/null
@@ -1,52 +0,0 @@
-<#
- .DESCRIPTION
- Publishes to 'master' after deleting dev files.
-#>
-
-param([string]$Tag)
-
-function AbortIfProcessFailed {
- param([string]$message)
- if ($LASTEXITCODE) { throw $message }
- exit $LASTEXITCODE
-}
-
-function AbortIfDirtyWorkingDirectory {
- if (@(git status --short).Count -ne 0) {
- throw "uncommited changes "
- exit 1
- }
-}
-
-function AbortIfGitNotAvailable {
- get-command git -erroraction stop > $null
-}
-
-function AbortIfNotOnMaster {
- if (@(git branch | select-string "* master" -simplematch).Count -eq 0) {
- throw "not on 'master' branch"
- exit 1
- }
-}
-
-$toDelete = @(
- "manifest.json",
- "tests",
- "bin"
-)
-
-AbortIfGitNotAvailable
-AbortIfDirtyWorkingDirectory
-AbortIfNotOnMaster
-
-try {
- push-location $PSScriptRoot\..
-
- remove-item -recurse $toDelete -exclude "Publish.ps1" -whatif
-
- write-warning "commit the files, tag and push upstream"
-}
-finally {
- pop-location
-}
-
diff --git a/messages.json b/messages.json
index d4d29c7d..633c6190 100644
--- a/messages.json
+++ b/messages.json
@@ -1,3 +1,3 @@
{
- "3.1.1": "messages/prerelease-invitation.md"
+ "5.0.0": "messages/5.0.0.md"
}
diff --git a/messages/5.0.0.md b/messages/5.0.0.md
new file mode 100644
index 00000000..b48dba39
--- /dev/null
+++ b/messages/5.0.0.md
@@ -0,0 +1,37 @@
+# 5.0.0
+
+This is a large syntax change with substantial modification
+to where some keywords are able to be used.
+
+If you find bugs, especially egregious ones that break code
+highlighting further down in the file, please mention them at
+https://github.com/SublimeText/PowerShell/issues and include
+"v5" in the title.
+
+
+## Standout improvements
+
+- Commands are recognized without Verb-Noun format.
+
+- Command arguments are more conscientiously marked,
+ including unquoted strings.
+
+- String contents are sometimes interpreted specially,
+ though not in all cases. Some examples:
+
+ * Here-strings beginning with `using System` are
+ highlighted with C#.
+
+ * Command argument strings recognize wildcards and
+ path separators.
+
+ * Single-quoted strings in certain cases are
+ highlighted with Regular Expressions.
+
+ * Other strings recognize some format placeholders.
+
+- `using` imports can only come at the beginning of a file.
+
+- `meta` scopes are used in more places, which doesn't
+ typically affect highlighting, but sometimes has an
+ effect on ST commands.
diff --git a/messages/prerelease-invitation.md b/messages/prerelease-invitation.md
deleted file mode 100644
index 8f0fc360..00000000
--- a/messages/prerelease-invitation.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# Prelease invitation
-
-Hello PowerShell user. There are improvements underway to bring the
-syntax highlighting for PS more in line with the other Sublime Text
-languages. This means your color scheme should start highlighting
-similar concepts the same colors as you are used to in those other
-languages.
-
-It is not perfect. And, as such, I'm inviting adventurous ST users to
-try it out ahead of time. If that sounds like you, open your Package
-Control Settings (usually `Cmd/Ctrl`+`Shift`+`P`, "Preferences: Package
-Control Settings") and add `"PowerShell"` to the array for
-`install_prereleases` in the right-hand pane.
-
-If you find bugs, especially egregious ones that break code
-highlighting further down in the file, please mention them at
-https://github.com/SublimeText/PowerShell/issues and include "v4" in
-the title.
-
-Thank you. Be well.
diff --git a/Snippets/(beg) scriptblock begin clause.sublime-snippet b/snippets/(beg) scriptblock begin clause.sublime-snippet
similarity index 100%
rename from Snippets/(beg) scriptblock begin clause.sublime-snippet
rename to snippets/(beg) scriptblock begin clause.sublime-snippet
diff --git a/Snippets/(catch) catch {...}.sublime-snippet b/snippets/(catch) catch {...}.sublime-snippet
similarity index 100%
rename from Snippets/(catch) catch {...}.sublime-snippet
rename to snippets/(catch) catch {...}.sublime-snippet
diff --git a/Snippets/(comm) comment block.sublime-snippet b/snippets/(comm) comment block.sublime-snippet
similarity index 100%
rename from Snippets/(comm) comment block.sublime-snippet
rename to snippets/(comm) comment block.sublime-snippet
diff --git a/Snippets/(elif) elseif {...}.sublime-snippet b/snippets/(elif) elseif {...}.sublime-snippet
similarity index 100%
rename from Snippets/(elif) elseif {...}.sublime-snippet
rename to snippets/(elif) elseif {...}.sublime-snippet
diff --git a/Snippets/(elifi) elseif in-line.sublime-snippet b/snippets/(elifi) elseif in-line.sublime-snippet
similarity index 100%
rename from Snippets/(elifi) elseif in-line.sublime-snippet
rename to snippets/(elifi) elseif in-line.sublime-snippet
diff --git a/Snippets/(else) else {...}.sublime-snippet b/snippets/(else) else {...}.sublime-snippet
similarity index 100%
rename from Snippets/(else) else {...}.sublime-snippet
rename to snippets/(else) else {...}.sublime-snippet
diff --git a/Snippets/(elsei) else in-line.sublime-snippet b/snippets/(elsei) else in-line.sublime-snippet
similarity index 100%
rename from Snippets/(elsei) else in-line.sublime-snippet
rename to snippets/(elsei) else in-line.sublime-snippet
diff --git a/Snippets/(end) scriptblock end clause.sublime-snippet b/snippets/(end) scriptblock end clause.sublime-snippet
similarity index 100%
rename from Snippets/(end) scriptblock end clause.sublime-snippet
rename to snippets/(end) scriptblock end clause.sublime-snippet
diff --git a/Snippets/(fil) new filter.sublime-snippet b/snippets/(fil) new filter.sublime-snippet
similarity index 100%
rename from Snippets/(fil) new filter.sublime-snippet
rename to snippets/(fil) new filter.sublime-snippet
diff --git a/Snippets/(fin) finally {...}.sublime-snippet b/snippets/(fin) finally {...}.sublime-snippet
similarity index 100%
rename from Snippets/(fin) finally {...}.sublime-snippet
rename to snippets/(fin) finally {...}.sublime-snippet
diff --git a/Snippets/(fun) define function.sublime-snippet b/snippets/(fun) define function.sublime-snippet
similarity index 100%
rename from Snippets/(fun) define function.sublime-snippet
rename to snippets/(fun) define function.sublime-snippet
diff --git a/Snippets/(here) heredoc string (single quoted).sublime-snippet b/snippets/(here) heredoc string (single quoted).sublime-snippet
similarity index 100%
rename from Snippets/(here) heredoc string (single quoted).sublime-snippet
rename to snippets/(here) heredoc string (single quoted).sublime-snippet
diff --git a/Snippets/(hhere) heredoc string (double quoted).sublime-snippet b/snippets/(hhere) heredoc string (double quoted).sublime-snippet
similarity index 100%
rename from Snippets/(hhere) heredoc string (double quoted).sublime-snippet
rename to snippets/(hhere) heredoc string (double quoted).sublime-snippet
diff --git a/Snippets/(if) if {...}.sublime-snippet b/snippets/(if) if {...}.sublime-snippet
similarity index 100%
rename from Snippets/(if) if {...}.sublime-snippet
rename to snippets/(if) if {...}.sublime-snippet
diff --git a/Snippets/(ifelse) if {...} else {...}.sublime-snippet b/snippets/(ifelse) if {...} else {...}.sublime-snippet
similarity index 100%
rename from Snippets/(ifelse) if {...} else {...}.sublime-snippet
rename to snippets/(ifelse) if {...} else {...}.sublime-snippet
diff --git a/Snippets/(ifi) if in-line.sublime-snippet b/snippets/(ifi) if in-line.sublime-snippet
similarity index 100%
rename from Snippets/(ifi) if in-line.sublime-snippet
rename to snippets/(ifi) if in-line.sublime-snippet
diff --git a/Snippets/(mydocs) path to My Documents.sublime-snippet b/snippets/(mydocs) path to My Documents.sublime-snippet
similarity index 100%
rename from Snippets/(mydocs) path to My Documents.sublime-snippet
rename to snippets/(mydocs) path to My Documents.sublime-snippet
diff --git a/Snippets/(proc) scriptblock process clause.sublime-snippet b/snippets/(proc) scriptblock process clause.sublime-snippet
similarity index 100%
rename from Snippets/(proc) scriptblock process clause.sublime-snippet
rename to snippets/(proc) scriptblock process clause.sublime-snippet
diff --git a/Snippets/(sd) enable script debug stepping.sublime-snippet b/snippets/(sd) enable script debug stepping.sublime-snippet
similarity index 100%
rename from Snippets/(sd) enable script debug stepping.sublime-snippet
rename to snippets/(sd) enable script debug stepping.sublime-snippet
diff --git a/Snippets/(sub) $(...) complex subexpression.sublime-snippet b/snippets/(sub) $(...) complex subexpression.sublime-snippet
similarity index 100%
rename from Snippets/(sub) $(...) complex subexpression.sublime-snippet
rename to snippets/(sub) $(...) complex subexpression.sublime-snippet
diff --git a/Snippets/(thisdir) path to current script.sublime-snippet b/snippets/(thisdir) path to current script.sublime-snippet
similarity index 100%
rename from Snippets/(thisdir) path to current script.sublime-snippet
rename to snippets/(thisdir) path to current script.sublime-snippet
diff --git a/Snippets/(tmp) create temp file.sublime-snippet b/snippets/(tmp) create temp file.sublime-snippet
similarity index 100%
rename from Snippets/(tmp) create temp file.sublime-snippet
rename to snippets/(tmp) create temp file.sublime-snippet
diff --git a/Snippets/(try) try {...}.sublime-snippet b/snippets/(try) try {...}.sublime-snippet
similarity index 100%
rename from Snippets/(try) try {...}.sublime-snippet
rename to snippets/(try) try {...}.sublime-snippet
diff --git a/snippets/PowerShell.sublime-completions b/snippets/PowerShell.sublime-completions
new file mode 100644
index 00000000..63ce686e
--- /dev/null
+++ b/snippets/PowerShell.sublime-completions
@@ -0,0 +1,69 @@
+{
+ "scope": "source.powershell",
+
+ "completions": [
+ {
+ "trigger": "dict",
+ "contents": "@{$1$0}",
+ "annotation": "hashtable",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "arr",
+ "contents": "@($0)",
+ "annotation": "array",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "req",
+ "contents": "#requires -$0",
+ "annotation": "requires",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "reqp",
+ "contents": "#requires -pssnapin $0",
+ "annotation": "requires",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "reqv",
+ "contents": "#requires -version ${0:2}",
+ "annotation": "requires",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "void",
+ "contents": "[void] ($1)$0",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "sb",
+ "contents": "\\${$1}$0",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "wd",
+ "contents": "write-debug -message \"$1\"$0",
+ "annotation": "write-debug",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "wh",
+ "contents": "write-host \"$1\"",
+ "annotation": "write-host",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "ww",
+ "contents": "write-warning $0",
+ "annotation": "write-warning",
+ "kind": "snippet",
+ },
+ {
+ "trigger": "param",
+ "contents": "param(\\$${1:paramName})",
+ "kind": "snippet",
+ },
+ ],
+}
diff --git a/Snippets/env.sublime-snippet b/snippets/env.sublime-snippet
similarity index 100%
rename from Snippets/env.sublime-snippet
rename to snippets/env.sublime-snippet
diff --git a/Support/Comments.tmPreferences b/support/Comments.tmPreferences
similarity index 100%
rename from Support/Comments.tmPreferences
rename to support/Comments.tmPreferences
diff --git a/Fold.tmPreferences b/support/Fold.tmPreferences
similarity index 94%
rename from Fold.tmPreferences
rename to support/Fold.tmPreferences
index ce6f43ae..326c37c4 100644
--- a/Fold.tmPreferences
+++ b/support/Fold.tmPreferences
@@ -9,9 +9,9 @@
begin
- meta.fold.begin
+ meta.fold.block.begin
end
- meta.fold.end
+ meta.fold.block.end
begin
diff --git a/Indentation.tmPreferences b/support/Indentation.tmPreferences
similarity index 78%
rename from Indentation.tmPreferences
rename to support/Indentation.tmPreferences
index 5759b67d..3014a7db 100644
--- a/Indentation.tmPreferences
+++ b/support/Indentation.tmPreferences
@@ -1,5 +1,4 @@
-
name
diff --git a/support/PowerShell.sublime-build b/support/PowerShell.sublime-build
new file mode 100644
index 00000000..774d9789
--- /dev/null
+++ b/support/PowerShell.sublime-build
@@ -0,0 +1,24 @@
+{
+ "cmd": ["pwsh", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "$file"],
+ "selector": "source.powershell",
+ "env": {
+ "TERM": "dumb",
+ },
+ // https://regex101.com/r/P1ZwkU/2
+ "file_regex": "^[Aa]t (?:(?:.+ in|[:\\w<>-]+,) )?(.+?):(?: line )?(\\d+)(?: char:(\\d+))?",
+
+ "variants": [
+ {
+ "name": "Windows PowerShell (<=5.1)",
+ "cmd": ["echo", "powershell.exe is only available on Windows. Did you want a different build variant?"],
+
+ "windows": {
+ "cmd": ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "$file"],
+ },
+ },
+ {
+ "name": "Pester",
+ "cmd": ["pwsh", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", "Invoke-Pester"],
+ }
+ ],
+}
diff --git a/support/Symbol List - Region.tmPreferences b/support/Symbol List - Region.tmPreferences
new file mode 100644
index 00000000..14a08fd5
--- /dev/null
+++ b/support/Symbol List - Region.tmPreferences
@@ -0,0 +1,17 @@
+
+
+
+ scope
+ source.powershell entity.name.section
+ settings
+
+ showInSymbolList
+ 1
+ symbolTransformation
+
+ s/\s{2,}/ /g; # collapse whitespace
+ s/^/#region /;# prepend "#region " to the region name
+
+
+
+
diff --git a/syntax/embed/C# (for PowerShell).sublime-syntax b/syntax/embed/C# (for PowerShell).sublime-syntax
new file mode 100644
index 00000000..4eb40f24
--- /dev/null
+++ b/syntax/embed/C# (for PowerShell).sublime-syntax
@@ -0,0 +1,21 @@
+%YAML 1.2
+---
+scope: source.cs.embedded.powershell
+version: 2
+hidden: true
+
+extends: Packages/C#/C#.sublime-syntax
+
+contexts:
+
+ inside_triple_quoted_raw_string_syntax:
+ - meta_include_prototype: false
+ - include: immediately_pop
+
+ inside_verbatim_string_syntax:
+ - meta_include_prototype: false
+ - include: immediately_pop
+
+ inside_verbatim_format_string_syntax:
+ - meta_include_prototype: false
+ - include: immediately_pop
diff --git a/tests/syntax_test_Class.ps1 b/tests/syntax_test_Class.ps1
new file mode 100644
index 00000000..2b926db7
--- /dev/null
+++ b/tests/syntax_test_Class.ps1
@@ -0,0 +1,625 @@
+# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
+using namespace system.management.automation
+#^^^^ keyword.control.import.powershell
+# ^^^^^^^^^ keyword.control.import.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^ punctuation.accessor.dot.powershell
+
+class Foo : Bar, Baz { }
+#^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+#^^^^ keyword.declaration.class.powershell
+# ^^^ entity.name.class.powershell
+# @@@ definition
+# ^ punctuation.separator.type.powershell
+# ^^^ entity.other.inherited-class.powershell
+# @@@ reference
+# ^ punctuation.separator.sequence.powershell
+# ^^^ entity.other.inherited-class.powershell
+# @@@ reference
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+
+# Define a class
+class TypeName
+#^^^^^^^^^^^^^ meta.class.powershell
+#^^^^ keyword.declaration.class.powershell
+# ^^^^^^^^ entity.name.class.powershell
+# @@@@@@@@ definition
+{
+ # Property with validate set
+ # <- punctuation.definition.comment
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line
+ [ValidateSet("val1", "Val2")]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [string] $P1
+#^^^^^^^^^^^^^^^ meta.class.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ # Static property
+ # <- punctuation.definition.comment
+ # ^^^^^^^^^^^^^^^ comment.line
+ static [hashtable] $P2
+#^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^^^^^^ storage.modifier.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ # Hidden property does not show as result of Get-Member
+ # <- punctuation.definition.comment
+ # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line
+ hidden [int] $P3
+#^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^^^^^^ storage.modifier.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ # Constructor
+ # <- punctuation.definition.comment
+ # ^^^^^^^^^^^ comment.line
+ TypeName ([string] $s) {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+ $this.P1 = $s
+#^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
+# ^^^^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^ variable.other.member.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ }
+# ^ - meta.function
+ # Static method
+ # <- punctuation.definition.comment
+ # ^^^^^^^^^^^^^ comment.line
+ static [void] MemberMethod1([hashtable] $h) {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^^^^^^ storage.modifier.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+ [TypeName]::P2 = $h
+#^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^ punctuation.accessor.double-colon.powershell
+# ^^ variable.other.member.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ }
+
+ # Instance method
+ # <- punctuation.definition.comment
+ # ^^^^^^^^^^^^^^^ comment.line
+ [int] MemberMethod2([int] $i) {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+ return $this.P3
+#^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
+# ^^^^^^ keyword.control.flow.return.powershell
+# ^^^^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^ variable.other.member.powershell
+ }
+}
+
+[TypeName]::MemberMethod1()
+# @@@@@@@@@@@@@ reference
+
+$object.MemberMethod2()
+# @@@@@@@@@@@@@ reference
+
+
+# PowerShell documentation examples
+# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_classes
+
+# Example 1 - Minimal definition
+class Device {
+# @@@@@@ definition
+ [string]$Brand
+}
+
+$dev = [Device]::new()
+# @@@ reference
+$dev.Brand = "Fabrikam, Inc."
+$dev
+
+
+# Example 2 - Class with instance members
+class Book {
+# @@@@ definition
+ # Class properties
+ [string] $Title
+ [string] $Author
+ [string] $Synopsis
+ [string] $Publisher
+ [datetime] $PublishDate
+ [int] $PageCount
+ [string[]] $Tags
+ # Default constructor
+ Book() { $this.Init(@{}) }
+# @@@@ definition
+# @@@@ reference
+ # Convenience constructor from hashtable
+ Book([hashtable]$Properties) { $this.Init($Properties) }
+# @@@@ definition
+# @@@@ reference
+ # Common constructor for title and author
+ Book([string]$Title, [string]$Author) {
+# @@@@ definition
+ $this.Init(@{Title = $Title; Author = $Author })
+# @@@@ reference
+ }
+ # Shared initializer method
+ [void] Init([hashtable]$Properties) {
+# @@@@ definition
+ foreach ($Property in $Properties.Keys) {
+ $this.$Property = $Properties.$Property
+ }
+ }
+ # Method to calculate reading time as 2 minutes per page
+ [timespan] GetReadingTime() {
+# @@@@@@@@@@@@@@ definition
+ if ($this.PageCount -le 0) {
+ throw 'Unable to determine reading time from page count.'
+ }
+ $Minutes = $this.PageCount * 2
+ return [timespan]::new(0, $Minutes, 0)
+# @@@ reference
+ }
+ # Method to calculate how long ago a book was published
+ [timespan] GetPublishedAge() {
+# @@@@@@@@@@@@@@@ definition
+ if (
+ $null -eq $this.PublishDate -or
+ $this.PublishDate -eq [datetime]::MinValue
+ ) { throw 'PublishDate not defined' }
+
+ return (Get-Date) - $this.PublishDate
+# @@@@@@@@ reference
+ }
+ # Method to return a string representation of the book
+ [string] ToString() {
+# @@@@@@@@ definition
+ return "$($this.Title) by $($this.Author) ($($this.PublishDate.Year))"
+ }
+}
+
+[BookList]::Add([Book]::new(@{
+# @@@ reference
+# @@@ reference
+ Title = 'The Fellowship of the Ring'
+ Author = 'J.R.R. Tolkien'
+ Publisher = 'George Allen & Unwin'
+ PublishDate = '1954-07-29'
+ PageCount = 423
+ Tags = @('Fantasy', 'Adventure')
+}))
+
+[BookList]::Find({
+# @@@@ reference
+ param ($b)
+
+ $b.PublishDate -gt '1950-01-01'
+}).Title
+
+[BookList]::FindAll({
+# @@@@@@@ reference
+ param($b)
+
+ $b.Author -match 'Tolkien'
+}).Title
+
+[BookList]::Remove($Book)
+# @@@@@@ reference
+[BookList]::Books.Title
+
+[BookList]::RemoveBy('Author', 'J.R.R. Tolkien')
+# @@@@@@@@ reference
+"Titles: $([BookList]::Books.Title)"
+
+[BookList]::Add($Book)
+# @@@ reference
+[BookList]::Add($Book)
+# @@@ reference
+
+
+# Example 3 - Class with static members
+class BookList {
+# @@@@@@@@ definition
+ # Static property to hold the list of books
+ static [System.Collections.Generic.List[Book]] $Books
+ # Static method to initialize the list of books. Called in the other
+ # static methods to avoid needing to explicit initialize the value.
+ static [void] Initialize() { [BookList]::Initialize($false) }
+# @@@@@@@@@@ definition
+# @@@@@@@@@@ reference
+ static [bool] Initialize([bool]$Force) {
+# @@@@@@@@@@ definition
+ if ([BookList]::Books.Count -gt 0 -and -not $Force) {
+ return $false
+ }
+
+ [BookList]::Books = [System.Collections.Generic.List[Book]]::new()
+# @@@ reference
+
+ return $true
+ }
+ # Ensure a book is valid for the list.
+ static [void] Validate([book]$Book) {
+# @@@@@@@@ definition
+ $Prefix = @(
+ 'Book validation failed: Book must be defined with the Title,'
+ 'Author, and PublishDate properties, but'
+ ) -join ' '
+ if ($null -eq $Book) { throw "$Prefix was null" }
+ if ([string]::IsNullOrEmpty($Book.Title)) {
+# @@@@@@@@@@@@@ reference
+ throw "$Prefix Title wasn't defined"
+ }
+ if ([string]::IsNullOrEmpty($Book.Author)) {
+# @@@@@@@@@@@@@ reference
+ throw "$Prefix Author wasn't defined"
+ }
+ if ([datetime]::MinValue -eq $Book.PublishDate) {
+ throw "$Prefix PublishDate wasn't defined"
+ }
+ }
+ # Static methods to manage the list of books.
+ # Add a book if it's not already in the list.
+ static [void] Add([Book]$Book) {
+# @@@ definition
+ [BookList]::Initialize()
+# @@@@@@@@@@ reference
+ [BookList]::Validate($Book)
+# @@@@@@@@ reference
+ if ([BookList]::Books.Contains($Book)) {
+# @@@@@@@@ reference
+ throw "Book '$Book' already in list"
+ }
+
+ $FindPredicate = {
+ param([Book]$b)
+
+ $b.Title -eq $Book.Title -and
+ $b.Author -eq $Book.Author -and
+ $b.PublishDate -eq $Book.PublishDate
+ }.GetNewClosure()
+#^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
+#^^^^^^^^ meta.block.powershell
+# ^ punctuation.section.braces.end.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@ reference
+# ^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^ punctuation.section.arguments.end.powershell
+ if ([BookList]::Books.Find($FindPredicate)) {
+# @@@@ reference
+ throw "Book '$Book' already in list"
+ }
+
+ [BookList]::Books.Add($Book)
+# @@@ reference
+ }
+ # Clear the list of books.
+ static [void] Clear() {
+# @@@@@ definition
+ [BookList]::Initialize()
+# @@@@@@@@@@ reference
+ [BookList]::Books.Clear()
+# @@@@@ reference
+ }
+ # Find a specific book using a filtering scriptblock.
+ static [Book] Find([scriptblock]$Predicate) {
+# @@@@ definition
+ [BookList]::Initialize()
+# @@@@@@@@@@ reference
+ return [BookList]::Books.Find($Predicate)
+# @@@@ reference
+ }
+ # Find every book matching the filtering scriptblock.
+ static [Book[]] FindAll([scriptblock]$Predicate) {
+# @@@@@@@ definition
+ [BookList]::Initialize()
+# @@@@@@@@@@ reference
+ return [BookList]::Books.FindAll($Predicate)
+# @@@@@@@ reference
+ }
+ # Remove a specific book.
+ static [void] Remove([Book]$Book) {
+# @@@@@@ definition
+ [BookList]::Initialize()
+# @@@@@@@@@@ reference
+ [BookList]::Books.Remove($Book)
+# @@@@@@ reference
+ }
+ # Remove a book by property value.
+ static [void] RemoveBy([string]$Property, [string]$Value) {
+# @@@@@@@@ definition
+ [BookList]::Initialize()
+# @@@@@@@@@@ reference
+ $Index = [BookList]::Books.FindIndex({
+# @@@@@@@@@ reference
+ param($b)
+ $b.$Property -eq $Value
+ }.GetNewClosure())
+#^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell meta.function-call.arguments.powershell
+#^^^^^^^^ meta.block.powershell
+# ^ punctuation.section.braces.end.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@ reference
+# ^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^ punctuation.section.arguments.end.powershell
+# ^ punctuation.section.arguments.end.powershell
+ if ($Index -ge 0) {
+ [BookList]::Books.RemoveAt($Index)
+# @@@@@@@@ reference
+ }
+ }
+}
+
+
+ # Example 4 - Class definition with and without Runspace affinity
+
+ # Class definition with Runspace affinity (default behavior)
+ class UnsafeClass {
+ # @@@@@@@@@@@ definition
+ static [Object] ShowRunspaceId($Val) {
+ # @@@@@@@@@@@@@@ definition
+ return [pscustomobject]@{
+ ThreadId = [Threading.Thread]::CurrentThread.ManagedThreadId
+ RunspaceId = [runspace]::DefaultRunspace.Id
+ }
+ }
+ }
+
+ $unsafe = [UnsafeClass]::new()
+ # @@@ reference
+
+ while ($true) {
+ 1..10 | ForEach-Object -Parallel {
+ # @@@@@@@@@@@@@@ reference
+ Start-Sleep -ms 100
+ # @@@@@@@@@@@ reference
+ ($Using:unsafe)::ShowRunspaceId($_)
+ # @@@@@@@@@@@@@@ reference
+ }
+ }
+
+ # Class definition with NoRunspaceAffinity attribute
+ [NoRunspaceAffinity()]
+ class SafeClass {
+ # @@@@@@@@@ definition
+ static [Object] ShowRunspaceId($Val) {
+ # @@@@@@@@@@@@@@ definition
+ return [pscustomobject]@{
+ ThreadId = [Threading.Thread]::CurrentThread.ManagedThreadId
+ RunspaceId = [runspace]::DefaultRunspace.Id
+ }
+ }
+ }
+
+ $safe = [SafeClass]::new()
+ # @@@ reference
+
+ while ($true) {
+ 1..10 | ForEach-Object -Parallel {
+ # @@@@@@@@@@@@@@ reference
+ Start-Sleep -ms 100
+ # @@@@@@@@@@@ reference
+ ($Using:safe)::ShowRunspaceId($_)
+ # @@@@@@@@@@@@@@ reference
+ }
+ }
+
+
+ class Vehicle {
+# ^^^^^^^^^^^^^^^ meta.class.powershell
+# ^^^^^ keyword.declaration.class.powershell
+# ^^^^^^^ entity.name.class.powershell
+# @@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+ Vehicle() {}
+#^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^ entity.name.function.powershell
+# @@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ Vehicle([string]$Owner) {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^ entity.name.function.powershell
+# @@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+ $this.Owner = $Owner
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
+# ^^^^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^ variable.other.member.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ }
+#^^^^^^^^ meta.class.powershell meta.function.powershell
+# ^ punctuation.section.block.end.powershell
+
+ [int]$Mileage
+#^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ [int]$Age
+#^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ [string]$Owner
+#^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ [void]Drive([int]$NumberOfMiles) {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^ entity.name.function.powershell
+# @@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^^^^^^^^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+ $this.Mileage += $NumberOfMiles
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
+# ^^^^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^ variable.other.member.powershell
+# ^^ keyword.operator.assignment.augmented.powershell
+# ^^^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ }
+#^^^^^^^^ meta.class.powershell meta.function.powershell
+# ^ punctuation.section.block.end.powershell
+
+ static [System.Array] GetAvailableColors() {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell
+# ^^^^^^ storage.modifier.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^ meta.generic-name.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@@@@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+ return 'yellow', 'red'
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.class.powershell meta.function.powershell
+# ^^^^^^ keyword.control.flow.return.powershell
+# ^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ }
+#^^^^^^^^ meta.class.powershell meta.function.powershell
+# ^ punctuation.section.block.end.powershell
+ }
+#^^^^ meta.class.powershell
+# ^ punctuation.section.block.end.powershell
+
+ $fiat.Drive(42)
+#^^^ meta.class.powershell
+# ^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@ reference
+# ^^^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.section.arguments.end.powershell
+ [Vehicle]::GetAvailableColors()
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^ punctuation.accessor.double-colon.powershell
+# ^^^^^^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@@@@@@ reference
+# ^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^ punctuation.section.arguments.end.powershell
diff --git a/tests/syntax_test_DSC.ps1 b/tests/syntax_test_DSC.ps1
new file mode 100644
index 00000000..ff66f2e4
--- /dev/null
+++ b/tests/syntax_test_DSC.ps1
@@ -0,0 +1,116 @@
+# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
+
+"<- Exit the imports context block"
+
+ Configuration MyDscConfiguration {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^^^^^^^^^ entity.name.function.powershell
+# ^ punctuation.section.block.begin.powershell
+ Node "TEST-PC1" {
+#^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^ keyword.context.block.powershell
+# ^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.block.begin.powershell
+ WindowsFeature MyFeatureInstance {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^^ keyword.other.powershell
+# ^^^^^^^^^^^^^^^^^ entity.name.label.powershell
+# ^ meta.block.powershell punctuation.section.braces.begin.powershell
+ Ensure = 'Present'
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ Name = 'RSAT'
+ }
+ WindowsFeature My2ndFeatureInstance {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^^ keyword.other.powershell
+# ^^^^^^^^^^^^^^^^^^^^ entity.name.label.powershell
+# ^ meta.block.powershell punctuation.section.braces.begin.powershell
+ Ensure = 'Present'
+ Name = 'Bitlocker'
+ }
+#^^^^^^^^^^^^ meta.function.powershell meta.block.powershell
+# ^ punctuation.section.braces.end.powershell
+ }
+ }
+ MyDscConfiguration
+
+
+ Configuration MyDscConfiguration
+ {
+ param
+#^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^ keyword.declaration.parameter.powershell
+ (
+ [string[]]$ComputerName='localhost'
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^ punctuation.section.brackets.end.powershell
+# ^^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ )
+
+ Node $ComputerName
+ {
+ WindowsFeature MyFeatureInstance
+ {
+ Ensure = 'Present'
+ Name = 'RSAT'
+ }
+
+ WindowsFeature My2ndFeatureInstance
+ {
+ Ensure = 'Present'
+ Name = 'Bitlocker'
+ }
+ }
+ }
+ MyDscConfiguration
+
+
+ Configuration MyDscConfiguration
+ {
+ Node @('localhost', 'Server01')
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^ keyword.context.block.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.array-expression.powershell
+# ^ keyword.other.array.begin.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+ {
+ WindowsFeature MyFeatureInstance
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^^ keyword.other.powershell
+# ^^^^^^^^^^^^^^^^^ entity.name.label.powershell
+ {
+ Ensure = 'Present'
+ Name = 'RSAT'
+ }
+
+ WindowsFeature My2ndFeatureInstance
+ {
+ Ensure = 'Present'
+ Name = 'Bitlocker'
+ }
+ }
+ }
+ MyDscConfiguration
diff --git a/tests/syntax_test_Function.ps1 b/tests/syntax_test_Function.ps1
new file mode 100644
index 00000000..ebe8c465
--- /dev/null
+++ b/tests/syntax_test_Function.ps1
@@ -0,0 +1,506 @@
+# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
+
+using module Microsoft.Management
+#^^^^ keyword.control.import.powershell
+# ^^^^^^ keyword.control.import.powershell
+# ^^^^^^^^^^^^^^^^^^^^ meta.path.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^^^ support.type.powershell
+
+function Test-Path {}
+# @@@@@@@@@ definition
+<#
+# <- punctuation.definition.comment.block.begin
+ .Synopsis
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ Short description
+ .DESCRIPTION
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ Long description
+ .EXAMPLE
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ Example of how to use this cmdlet
+ .EXAMPLE
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ Another example of how to use this cmdlet
+ .INPUTS
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ Inputs to this cmdlet (if any)
+ .OUTPUTS
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ Output from this cmdlet (if any)
+ .NOTES
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ General notes
+ .COMPONENT
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ The component this cmdlet belongs to
+ .ROLE
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ The role this cmdlet belongs to
+ .FUNCTIONALITY
+ # <- punctuation.definition.keyword
+ # ^ keyword.other.documentation
+ The functionality that best describes this cmdlet
+ .ForwardHelpCategory Alias
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.powershell comment.documentation.embedded.powershell
+# ^ punctuation.definition.keyword.documentation.powershell
+# ^^^^^^^^^^^^^^^^^^^ keyword.other.documentation.powershell
+# ^^^^^ support.type.powershell
+
+ .parameter foo
+#^^^^^^^^^^^^^^^^^ comment.block.powershell comment.documentation.embedded.powershell
+# ^ punctuation.definition.keyword.documentation.powershell
+# ^^^^^^^^^ keyword.other.documentation.param.powershell
+# ^^^ variable.parameter.powershell
+
+ .LINK https://example.com
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.block.powershell comment.documentation.embedded.powershell
+# ^ punctuation.definition.keyword.documentation.powershell
+# ^^^^ keyword.other.documentation.powershell
+# ^^^^^^^^^^^^^^^^^^^ markup.underline.link.powershell
+
+ This should not be considered documentaton -> .role
+ # ^ - keyword.operator.documentation
+#>
+# <- punctuation.definition.comment.block.end
+function Verb-Noun {
+#^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+#^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+ [CmdletBinding(DefaultParameterSetName = 'Parameter Set 1',
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+ SupportsShouldProcess = $true,
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.attribute.powershell
+# ^^^^^^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+ PositionalBinding = $false,
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.attribute.powershell
+# ^^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^ constant.language.boolean.false.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+ HelpUri = 'http://www.microsoft.com/',
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.attribute.powershell
+# ^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+ ConfirmImpact = 'Medium')]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.attribute.powershell
+# ^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [Alias()]
+#^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [OutputType([String])]
+#^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ Param
+#^^^^^^^^ meta.function.powershell
+# ^^^^^ keyword.declaration.parameter.powershell
+ (
+#^^^^ meta.function.powershell
+# ^ meta.block.parameters.powershell punctuation.section.block.begin.powershell
+ # Param1 help description
+ # <- comment.line punctuation.definition.comment
+ # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
+ [Parameter(Mandatory=$true,
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+ ValueFromPipeline=$true,
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell meta.attribute.powershell
+# ^^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+ ValueFromPipelineByPropertyName = $true,
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell meta.attribute.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+ ValueFromRemainingArguments=$false,
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell meta.attribute.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^ constant.language.boolean.false.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+ Position=0,
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell meta.attribute.powershell
+# ^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.sequence.powershell
+ ParameterSetName = 'Parameter Set 1')]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell meta.attribute.powershell
+# ^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [ValidateNotNullOrEmpty()]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [ValidateNotNull()]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [ValidateNotNullOrEmpty()]
+ #^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
+ # <- punctuation.section.brackets.begin
+ # ^^^^^^^^^^^^^^^^^^^^^ support.function.attribute
+ # ^ punctuation.section.group.begin
+ # ^ punctuation.section.group.end
+ # ^ punctuation.section.brackets.end
+ [ValidateCount(0,5)]
+ #^^^^^^^^^^^^^^^^^^^ meta.attribute
+ # <- punctuation.section.brackets.begin
+ # ^^^^^^^^^^^^ support.function.attribute
+ # ^ punctuation.section.group.begin
+ # ^ constant.numeric.value
+ # ^ punctuation.separator
+ # ^ constant.numeric.value
+ # ^ punctuation.section.group.end
+ # ^ punctuation.section.brackets.end
+ [ValidateSet("sun", "moon", "earth")]
+ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
+ # <- punctuation.section.brackets.begin
+ # ^ support.function.attribute
+ # ^ punctuation.section.group.begin
+ # ^^^^ string.quoted.double
+ # ^ punctuation.separator
+ # ^^^^^^ string.quoted.double
+ # ^ punctuation.separator
+ # ^^^^^^^ string.quoted.double
+ # ^ punctuation.section.group.end
+ # ^ punctuation.section.brackets.end
+ [Alias("p1")]
+ #^^^^^^^^^^^^ meta.attribute
+ # <- punctuation.section.brackets.begin
+ # ^ support.function.attribute
+ # ^ punctuation.section.group.begin
+ # ^^^^ string.quoted.double
+ # ^ punctuation.section.group.end
+ # ^ punctuation.section.brackets.end
+ $Param1,
+ # <- punctuation.definition.variable
+ # ^ variable.other.readwrite
+ # ^ punctuation.separator
+
+ # Param2 help description
+ # <- comment.line punctuation.definition.comment
+ # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
+ [Parameter(ParameterSetName='Parameter Set 1')]
+ #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
+ # ^^^^^^^^ support.function.attribute
+ # ^^^^^^^^^^^^^^^^ variable.parameter.attribute
+ # ^ keyword.operator.assignment
+ # ^^^^^^^^^^^^^^^^ string.quoted.single
+ # ^ punctuation.section.group.end
+ # ^ punctuation.section.brackets.end
+ # ^ - meta.attribute
+ [AllowNull()]
+ #^^^^^^^^^^^^ meta.attribute
+ # <- meta.attribute punctuation.section.brackets.begin
+ # ^ meta.attribute support.function.attribute
+ # ^ meta.attribute punctuation.section.group.begin
+ # ^ meta.attribute punctuation.section.group.end
+ # ^ meta.attribute punctuation.section.brackets.end
+ [AllowEmptyCollection()]
+ #^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
+ # <- meta.attribute punctuation.section.brackets.begin
+ # ^ meta.attribute support.function.attribute
+ # ^ meta.attribute punctuation.section.group.begin
+ # ^ meta.attribute punctuation.section.group.end
+ # ^ meta.attribute punctuation.section.brackets.end
+ [AllowEmptyString()]
+ #^^^^^^^^^^^^^^^^^^^ meta.attribute
+ # <- meta.attribute punctuation.section.brackets.begin
+ # ^ meta.attribute support.function.attribute
+ # ^ meta.attribute punctuation.section.group.begin
+ # ^ meta.attribute punctuation.section.group.end
+ # ^ meta.attribute punctuation.section.brackets.end
+ [ValidateScript({$true})]
+ #^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute
+ # <- meta.attribute punctuation.section.brackets.begin
+ # ^^^^^^^^^^^^^ support.function.attribute
+ # ^ punctuation.section.group.begin
+ # ^ meta.attribute
+ # ^ punctuation.definition.variable
+ # ^^^^ constant.language
+ # ^ meta.attribute
+ # ^ punctuation.section.group.end
+ # ^ punctuation.section.brackets.end
+ [ValidateRange(0,5)]
+ #^^^^^^^^^^^^^^^^^^^ meta.attribute
+ # <- meta.attribute punctuation.section.brackets.begin
+ # ^^^^^^^^^^^^ support.function.attribute
+ # ^ punctuation.section.group.begin
+ # ^ constant.numeric.value
+ # ^ punctuation.separator
+ # ^ constant.numeric.value
+ # ^ punctuation.section.group.end
+ # ^ punctuation.section.brackets.end
+ [int32]
+#^^^^^^^^^^^^^^ meta.function.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+ $Param2,
+#^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+
+ # Param3 help description
+ # <- comment.line punctuation.definition.comment
+ # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
+ [Parameter(ParameterSetName='Another Parameter Set')]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [ValidatePattern("[a-z]*")]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [ValidateLength(0,15)]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [String]
+#^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+ $Param3,
+#^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+
+ # Param4 help description
+ # <- comment.line punctuation.definition.comment
+ # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
+ [Parameter(ParameterSetName='Parameter Set 1')]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [ValidateScript({Test-Path $_})] # Make sure cmdlets don't break highlighting
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^^^^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@ reference
+# ^^^ meta.function-call.arguments.powershell
+# ^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.braces.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.powershell
+# ^ punctuation.definition.comment.powershell
+ [string]
+#^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+ $Param4,
+#^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+
+ # Param5 help description
+ # <- comment.line punctuation.definition.comment
+ # ^^^^^^^^^^^^^^^^^^^^^^^ comment.line
+ [Parameter(ParameterSetName='Parameter Set 1')]
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^^^^^^^ variable.parameter.attribute.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+ [ValidatePattern('(?=^.{1,254}$)(^(?:(?!\d+\.)[a-zA-Z0-9_\-]{1,63}\.?)+(?:[a-zA-Z]{2,})$)')] # this regex shouldn't break highlighting
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.attribute.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^^^^^ support.function.attribute.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.regexp.embedded
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line.powershell
+# ^ punctuation.definition.comment.powershell
+ [string]
+#^^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+ $Param5
+#^^^^^^^^^^^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ )
+#^^^^ meta.function.powershell meta.block.parameters.powershell
+# ^ punctuation.section.block.end.powershell
+
+ Begin
+#^^^^^^^^ meta.function.powershell
+# ^^^^^ keyword.context.block.powershell
+ {
+#^^^^ meta.function.powershell
+# ^ punctuation.section.block.begin.powershell
+ }
+ Process {
+#^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^ keyword.context.block.powershell
+# ^ punctuation.section.block.begin.powershell
+ if ($pscmdlet.ShouldProcess("Target", "Operation")) {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^ keyword.control.conditional.if.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.arguments.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ meta.block.powershell punctuation.section.braces.begin.powershell
+ }
+ }
+ End {
+#^^^^^^^^ meta.function.powershell
+# ^^^ keyword.context.block.powershell
+# ^ punctuation.section.block.begin.powershell
+
+ }
+ clean { }
+#^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^ keyword.context.block.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+}
diff --git a/tests/syntax_test_Pester.ps1 b/tests/syntax_test_Pester.ps1
new file mode 100644
index 00000000..d52ea208
--- /dev/null
+++ b/tests/syntax_test_Pester.ps1
@@ -0,0 +1,69 @@
+# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
+
+BeforeAll {
+ # your function
+ function Get-Planet ([string]$Name='*')
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.powershell meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^ entity.name.function.powershell
+# ^ punctuation.section.parameters.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.parameters.end.powershell
+ {
+ $planets = @(
+ @{ Name = 'Mercury' }
+ @{ Name = 'Venus' }
+ @{ Name = 'Earth' }
+ @{ Name = 'Mars' }
+ @{ Name = 'Jupiter' }
+ @{ Name = 'Saturn' }
+ @{ Name = 'Uranus' }
+ @{ Name = 'Neptune' }
+ ) | foreach { [PSCustomObject]$_ }
+
+ $planets | where { $_.Name -like $Name }
+ }
+}
+
+# Pester tests
+Describe 'Get-Planet' {
+ It "Given no parameters, it lists all 8 planets" {
+ $allPlanets = Get-Planet
+ $allPlanets.Count | Should -Be 8
+ }
+
+ Context "Filtering by Name" {
+ It "Given valid -Name '', it returns ''" -TestCases @(
+ @{ Filter = 'Earth'; Expected = 'Earth' }
+ @{ Filter = 'ne*' ; Expected = 'Neptune' }
+ @{ Filter = 'ur*' ; Expected = 'Uranus' }
+ @{ Filter = 'm*' ; Expected = 'Mercury', 'Mars' }
+ ) {
+ param ($Filter, $Expected)
+
+ $planets = Get-Planet -Name $Filter
+ $planets.Name | Should -Be $Expected
+ }
+
+ It "Given invalid parameter -Name 'Alpha Centauri', it returns `$null" {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.block.powershell meta.function-call.arguments.powershell meta.block.powershell
+# ^^ meta.function-call.powershell variable.function.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^ constant.character.escape.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ meta.block.powershell punctuation.section.braces.begin.powershell
+ $planets = Get-Planet -Name 'Alpha Centauri'
+ $planets | Should -Be $null
+ }
+ }
+}
diff --git a/tests/syntax_test_PowerShell.ps1 b/tests/syntax_test_PowerShell.ps1
new file mode 100644
index 00000000..015ce416
--- /dev/null
+++ b/tests/syntax_test_PowerShell.ps1
@@ -0,0 +1,2436 @@
+# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
+using namespace System.Management.Automation
+#^^^^ keyword.control.import.powershell
+# ^^^^^^^^^ keyword.control.import.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.path.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^ punctuation.accessor.dot.powershell
+
+#Requires -PSSnapin DiskSnapin -Version 1.2
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^^ variable.parameter
+# ^^^^^^^^ variable.parameter
+#Requires -PSSnapin DiskSnapin
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^^ variable.parameter
+#Requires -Version 3
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^ variable.parameter
+#Requires -Version 3.0
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^ variable.parameter
+#Requires -Version 3 -RunAsAdministrator
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^ variable.parameter
+# ^^^^^^^^^^^^^^^^^^^ variable.parameter
+#Requires -RunAsAdministrator
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^^ variable.parameter
+#Requires -Modules PSWorkflow
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^ variable.parameter
+#Requires -Modules PSWorkflow -ThisIsInvalid
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^ variable.parameter
+# ^^^^^^^^ - variable.parameter
+#Requires -Modules PSWorkflow, ActiveDirectory
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^ variable.parameter
+# ^ punctuation.separator
+#Requires -Modules PSWorkflow,ActiveDirectory
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^ variable.parameter
+# ^ punctuation.separator
+#Requires -ShellId MyLocalShell
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^ variable.parameter
+#Requires -Modules PSWorkflow, @{ModuleName="PSScheduledJob"; ModuleVersion="1.0.0.0"}
+# <- punctuation.definition.keyword
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.requires
+#^^^^^^^^ keyword.control.import.require
+# ^^^^^^^^ variable.parameter
+# ^ punctuation.separator
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.hashtable.powershell
+# ^^^^^^^^^^ meta.mapping.key string.unquoted
+# ^ punctuation.separator.key-value.powershell
+# ^^^^^^^^^^^^^^^^ string.quoted.double
+# ^ punctuation.terminator.statement
+# ^^^^^^^^^^^^^ meta.mapping.key string.unquoted
+# ^ punctuation.separator.key-value.powershell
+# ^^^^^^^^^ string.quoted.double
+
+ :label1
+# ^^^^^^^ entity.name.label.powershell
+# ^ punctuation.definition.label.powershell
+
+ throw "Do not run this file!"
+# ^^^^^ keyword.control.exception.raise.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ # Stop parsing
+ & tool.exe /arg1 'value' /arg2 $value --% /arg3 $value /arg4 "value" # Comment
+# ^ keyword.operator.call.powershell
+# ^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^ keyword.control.stop-parsing.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.powershell
+
+ foo --% stop parsing until pipe | echo
+# ^^^ meta.function-call.powershell variable.function.powershell
+# @@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^ keyword.control.stop-parsing.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.powershell
+# ^ keyword.operator.pipe.powershell
+# ^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@ reference
+
+ & gnutool.exe -s 'short option' --long-option --very_long_option value +plus-option
+# ^ keyword.operator.call.powershell
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^^^^^^^^ variable.parameter.option.powershell
+# ^^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^^^^^ variable.parameter.option.powershell
+# ^^ punctuation.definition.parameter.powershell
+# ^^^^^ string.unquoted.powershell
+# ^^^^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+
+ $job = Get-Process -Name pwsh &
+# ^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^ string.unquoted.powershell
+# ^ keyword.operator.background.powershell
+ Receive-Job $job -Wait
+# ^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@ reference
+# ^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+
+ # Constants
+ $true
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+ $True
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+ $TRUE
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+
+ $false
+# ^^^^^^ constant.language.boolean.false.powershell
+# ^ punctuation.definition.variable.powershell
+ $False
+# ^^^^^^ constant.language.boolean.false.powershell
+# ^ punctuation.definition.variable.powershell
+ $FALSE
+# ^^^^^^ constant.language.boolean.false.powershell
+# ^ punctuation.definition.variable.powershell
+
+ $null
+# ^^^^^ constant.language.null.powershell
+# ^ punctuation.definition.variable.powershell
+ $Null
+# ^^^^^ constant.language.null.powershell
+# ^ punctuation.definition.variable.powershell
+ $NULL
+# ^^^^^ constant.language.null.powershell
+# ^ punctuation.definition.variable.powershell
+
+ # Automatic variables
+ $_, $$, $^, $?
+# ^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+ $args
+# ^^^^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+ $error
+# ^^^^^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+ $home
+# ^^^^^ support.constant.variable.powershell
+# ^ punctuation.definition.variable.powershell
+ $foreach
+# ^^^^^^^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+
+
+ # Normal variables
+ $variable
+# ^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $script:variable
+# ^^^^^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^ storage.modifier.scope.powershell
+# ^ punctuation.accessor.colon.powershell
+ $ENV:ComputerName
+# ^^^^^^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^ support.variable.drive.powershell
+# ^ punctuation.accessor.colon.powershell
+# ^^^^^^^^^^^^^^^^^ variable.other.readwrite.powershell
+ ${variable}
+# ^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.interpolation.begin.powershell
+# ^ punctuation.section.interpolation.end.powershell
+ ${vari-able}
+# ^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.interpolation.begin.powershell
+# ^ punctuation.section.interpolation.end.powershell
+ ${var`iable}
+# ^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.interpolation.begin.powershell
+# ^^ constant.character.escape.powershell
+# ^ punctuation.section.interpolation.end.powershell
+ ${variable`}}
+# ^^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.interpolation.begin.powershell
+# ^^ constant.character.escape.powershell
+# ^ punctuation.section.interpolation.end.powershell
+ ${script:variable}
+# ^^^^^^^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.interpolation.begin.powershell
+# ^^^^^^ storage.modifier.scope.powershell
+# ^ punctuation.accessor.colon.powershell
+# ^ punctuation.section.interpolation.end.powershell
+
+
+ # Variable properties should be highlighted
+ $variable.Name
+# ^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^ variable.other.member.powershell
+
+ # Variable properties should be highlighted
+ $variable.Name.Method( )
+# ^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^ variable.other.member.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@ reference
+# ^^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^ punctuation.section.arguments.end.powershell
+
+# Hashtable
+$properties = @{
+# <- punctuation.definition.variable
+# ^ variable.other.readwrite
+# ^ keyword.operator.assignment
+# ^ keyword.other.hashtable.begin
+# ^ punctuation.section.braces.begin
+ Name = 'Name'
+#^^^^^^^^^^^^^^^^^^^^^ meta.hashtable.powershell
+# ^^^^ meta.mapping.key.powershell string.unquoted.powershell
+# ^ punctuation.separator.key-value.powershell
+# ^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ Something = $else
+#^^^^^^^^^^^^^^^^^^^^ meta.hashtable.powershell
+# ^^^^^^^^^ meta.mapping.key.powershell string.unquoted.powershell
+# ^ punctuation.separator.key-value.powershell
+# ^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ Number = 16
+#^^^^^^^^^^^^^^^^^ meta.hashtable.powershell
+# ^^^^^^ meta.mapping.key.powershell string.unquoted.powershell
+# ^ punctuation.separator.key-value.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+ from = 'hello world'
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.hashtable.powershell
+# ^^^^ meta.mapping.key.powershell string.unquoted.powershell
+# ^ punctuation.separator.key-value.powershell
+# ^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ hash = @{
+#^^^^^^^^^^^^^^^^^ meta.hashtable.powershell
+# ^^^^ meta.mapping.key.powershell string.unquoted.powershell
+# ^ punctuation.separator.key-value.powershell
+# ^^ meta.hashtable.powershell
+# ^ keyword.other.hashtable.begin.powershell
+# ^ punctuation.section.braces.begin.powershell
+ hello = 'world'
+#^^^^^^^^^^^^^^^^^^^^^^ meta.hashtable.powershell meta.hashtable.powershell
+# ^^^^^ meta.mapping.key.powershell string.unquoted.powershell
+# ^ punctuation.separator.key-value.powershell
+# ^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ }
+ # <- punctuation.section.braces.end
+}
+# <- punctuation.section.braces.end
+
+function Invoke-Something {}
+# @@@@@@@@@@@@@@@@ definition
+
+# Spatting
+ Invoke-Something @properties
+# ^^^^^^^^^^^^^^^^ support.function
+# @@@@@@@@@@@@@@@@ reference
+# ^ punctuation.definition.variable
+# ^ variable.other.readwrite
+
+# ScriptBlock
+ {Invoke-Something @properties}
+# ^ punctuation.section.braces.begin
+# ^^^^^^^^^^^^^^^^ support.function
+# @@@@@@@@@@@@@@@@ reference
+# ^ punctuation.definition.variable
+# ^ variable.other.readwrite
+# ^ punctuation.section.braces.end
+{
+# <- punctuation.section.braces.begin
+ Invoke-Something @properties
+# ^^^^^^^^^^^^^^^^ support.function
+# @@@@@@@@@@@@@@@@ reference
+# ^ punctuation.definition.variable
+# ^ variable.other.readwrite
+}
+# <- punctuation.section.braces.end
+$sb = {
+# <- punctuation.definition.variable
+# ^ variable.other.readwrite
+# ^ keyword.operator.assignment
+# ^ punctuation.section.braces.begin
+ Invoke-Something @properties
+# ^^^^^^^^^^^^^^^^ support.function
+# @@@@@@@@@@@@@@@@ reference
+# ^ punctuation.definition.variable
+# ^ variable.other.readwrite
+}
+# <- punctuation.section.braces.end
+
+# Arrays
+$a1 = @(1,2,3,4)
+# <- variable.other.readwrite punctuation.definition.variable
+#^^ variable.other.readwrite
+# ^ keyword.operator.assignment
+# ^ keyword.other.array.begin
+# ^ punctuation.section.group.begin
+# ^ punctuation.section.group.end
+# ^^^^^^^ meta.group.array-expression
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.separator.sequence
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.separator.sequence
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.separator.sequence
+# ^ meta.number.integer.decimal constant.numeric.value
+$a2 = ('one','two','three','four')
+# <- variable.other.readwrite punctuation.definition.variable
+#^^ variable.other.readwrite
+# ^ keyword.operator.assignment
+# ^ punctuation.section.group.begin
+# ^^^^^ string.quoted.single
+# ^ punctuation.separator.sequence
+# ^^^^^ string.quoted.single
+# ^ punctuation.separator.sequence
+# ^^^^^^^ string.quoted.single
+# ^ punctuation.separator.sequence
+# ^^^^^^ string.quoted.single
+# ^ punctuation.section.group.end
+$a3 = $one, $two, $three, $four
+# <- variable.other.readwrite punctuation.definition.variable
+#^^ variable.other.readwrite
+# ^ punctuation.definition.variable
+# ^^^^ variable.other.readwrite
+# ^ punctuation.definition.variable
+# ^^^^ variable.other.readwrite
+# ^ punctuation.definition.variable
+# ^^^^^^ variable.other.readwrite
+# ^ punctuation.definition.variable
+# ^^^^^ variable.other.readwrite
+# ^ keyword.operator.assignment
+# ^ punctuation.separator
+# ^ punctuation.separator
+# ^ punctuation.separator
+$a1[0]
+# <- variable.other.readwrite punctuation.definition.variable
+# ^ variable.other.readwrite
+# ^ punctuation.section.brackets.begin
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.section.brackets.end
+# ^^^ meta.brackets.indexer
+$a2[-1]
+# <- variable.other.readwrite punctuation.definition.variable
+# ^ variable.other.readwrite
+# ^ punctuation.section.brackets.begin
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.section.brackets.end
+# ^^^^ meta.brackets.indexer
+$a3[1..2]
+# <- variable.other.readwrite punctuation.definition.variable
+# ^ variable.other.readwrite
+# ^ punctuation.section.brackets.begin
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^^ keyword.operator.range
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.section.brackets.end
+# ^^^^^^ meta.brackets.indexer
+ @(@($a))
+# ^ keyword.other.array.begin
+# ^ punctuation.section.group.begin
+# ^ keyword.other.array.begin
+# ^ punctuation.section.group.begin
+# ^ variable.other.readwrite punctuation.definition.variable
+# ^^ variable.other.readwrite
+# ^^ punctuation.section.group.end
+ @(($i = 10); (++$j))
+# ^ keyword.other.array.begin
+# ^^ punctuation.section.group.begin
+# ^ variable.other.readwrite punctuation.definition.variable
+# ^^ variable.other.readwrite
+# ^ keyword.operator.assignment
+# ^^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.section.group.end
+# ^ punctuation.terminator.statement
+# ^ punctuation.section.group.begin
+# ^^ keyword.operator.assignment
+# ^ variable.other.readwrite punctuation.definition.variable
+# ^ variable.other.readwrite
+# ^^ punctuation.section.group.end
+ @($i = 10)
+# ^ keyword.other.array.begin
+# ^ punctuation.section.group.begin
+# ^ variable.other.readwrite punctuation.definition.variable
+# ^^ variable.other.readwrite
+# ^ keyword.operator.assignment
+# ^^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.section.group.end
+ $i[($y - 1) + $x]
+# ^ variable.other.readwrite punctuation.definition.variable
+# ^^ variable.other.readwrite
+# ^ punctuation.section.brackets.begin
+# ^ punctuation.section.group.begin
+# ^ variable.other.readwrite punctuation.definition.variable
+# ^^ variable.other.readwrite
+# ^ keyword.operator.arithmetic
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.section.group.end
+# ^ keyword.operator.arithmetic
+# ^ variable.other.readwrite punctuation.definition.variable
+# ^^ variable.other.readwrite
+# ^ punctuation.section.brackets.end
+# ^^^^^^^^^^^^^^^ meta.brackets.indexer
+
+# Numeric constants
+
+ -3 +3 3 3l 3lm 3lmb
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ meta.number.integer.decimal constant.numeric.suffix
+# ^^ meta.number.integer.decimal
+# ^ - constant.numeric
+# ^^^^ meta.number.integer.decimal
+# ^ constant.numeric.value
+# ^^^ constant.numeric.suffix
+
+ 3y 3uy 3s 3us 3u 3ul # PowerShell 6.2+
+# ^^ meta.number.integer.decimal
+# ^ constant.numeric.value
+# ^ constant.numeric.suffix
+# ^^^ meta.number.integer.decimal
+# ^ constant.numeric.value
+# ^^ constant.numeric.suffix
+# ^^ meta.number.integer.decimal
+# ^ constant.numeric.value
+# ^ constant.numeric.suffix
+# ^^^ meta.number.integer.decimal
+# ^ constant.numeric.value
+# ^^ constant.numeric.suffix
+# ^^ meta.number.integer.decimal
+# ^ constant.numeric.value
+# ^ constant.numeric.suffix
+# ^^^ meta.number.integer.decimal
+# ^ constant.numeric.value
+# ^^ constant.numeric.suffix
+
+ 3n # PowerShell 7.0+
+# ^^ meta.number.integer.decimal
+# ^ constant.numeric.value
+# ^ constant.numeric.suffix
+
+ .5
+# ^^ meta.number.float.decimal constant.numeric.value - constant constant
+# ^ punctuation.separator.decimal
+
+ +.5
+# ^ keyword.operator.unary
+# ^^ meta.number.float.decimal constant.numeric.value - constant constant
+# ^ punctuation.separator.decimal
+
+ # BUG: Don't mark the dot as a function
+ 1.
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ - meta.number - constant.numeric
+
+ 1.f 1.f()
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.accessor.dot
+# ^ variable.other.member
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.accessor.dot
+# @ reference
+# ^ meta.function-call variable.function
+# ^ meta.function-call.arguments punctuation.section.arguments.begin
+# ^ meta.function-call.arguments punctuation.section.arguments.end
+
+ 1.d
+# ^^^ meta.number.float.decimal - constant constant
+# ^^ constant.numeric.value
+# ^ punctuation.separator.decimal
+# ^ constant.numeric.suffix
+
+ 1.lGB
+# ^^^^^ meta.number.float.decimal
+# ^^ constant.numeric.value
+# ^ punctuation.separator.decimal
+# ^^^ constant.numeric.suffix
+
+ 1.dGB
+# ^^^^^ meta.number.float.decimal
+# ^^ constant.numeric.value
+# ^ punctuation.separator.decimal
+# ^^^ constant.numeric.suffix
+
+ 1.e+12d
+# ^^^^^^^ meta.number.float.decimal
+# ^^^^^^ constant.numeric.value
+# ^ punctuation.separator.decimal
+# ^ constant.numeric.suffix
+
+ 1e+12d
+# ^^^^^^ meta.number.float.decimal
+# ^^^^^ constant.numeric.value
+# ^ constant.numeric.suffix
+
+ 1.5
+# ^^^ meta.number.float.decimal constant.numeric.value
+# ^ punctuation.separator.decimal
+
+ -1.5
+# ^ keyword.operator.unary
+# ^^^ meta.number.float.decimal constant.numeric.value
+# ^ punctuation.separator.decimal
+
+ -3 + -2
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ keyword.operator.arithmetic
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+
+ -3+-2
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ keyword.operator.arithmetic
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+
+ 3++2
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ keyword.operator.arithmetic
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+
+ +2
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+
+ -3+-
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^^ keyword.operator
+
+ 10/-10
+# ^^ meta.number.integer.decimal constant.numeric.value
+# ^ keyword.operator.arithmetic
+# ^^ meta.number.integer.decimal constant.numeric.value
+
+ 10/-10D
+# ^^ meta.number.integer.decimal constant.numeric.value
+# ^ keyword.operator.arithmetic
+# ^^^ meta.number.float.decimal
+# ^^ constant.numeric.value
+# ^ constant.numeric.suffix
+
+ -10.002L
+# ^ keyword.operator.unary
+# ^^^^^^^ meta.number.float.decimal
+# ^^^^^^ constant.numeric.value
+# ^ punctuation.separator.decimal
+# ^ constant.numeric.suffix
+
+ $x..5.40D
+# ^ punctuation.definition.variable
+# ^^ variable.other.readwrite
+# ^^ keyword.operator.range
+# ^^^^^ meta.number.float.decimal
+# ^^^^ constant.numeric.value
+# ^ punctuation.separator.decimal
+# ^ constant.numeric.suffix
+
+ -500..-495
+# ^ keyword.operator.unary
+# ^^^ meta.number.integer.decimal constant.numeric.value
+# ^^ keyword.operator.range
+# ^ keyword.operator.unary
+# ^^^ meta.number.integer.decimal constant.numeric.value
+
+ $true..3
+# ^ punctuation.definition.variable
+# ^^^^ constant.language
+# ^^ keyword.operator.range
+# ^ meta.number.integer.decimal constant.numeric.value
+
+ -2..$null
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^^ keyword.operator.range
+# ^^^^^ constant.language
+# ^ punctuation.definition.variable
+
+ -3..3
+# ^ keyword.operator.unary
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^^ keyword.operator.range
+
+ 1..3
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^^ keyword.operator.range
+
+ 6,10,-3
+# ^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.separator.sequence -constant
+# ^^ meta.number.integer.decimal constant.numeric.value
+# ^ punctuation.separator.sequence -constant
+# ^ meta.number.integer.decimal constant.numeric.value
+
+ 0x476 0X476 0x476l 0x47m 0x47mb
+# ^^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^^ constant.numeric.value
+# ^^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^^ constant.numeric.value
+# ^^^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^^ constant.numeric.value
+# ^ constant.numeric.suffix
+# ^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^ - constant.numeric
+# ^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^^ constant.numeric.suffix
+
+ +0x20 +0X20 +0x20l +0x20m +0x20mb
+# ^ keyword.operator.unary
+# ^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^ keyword.operator.unary
+# ^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^ constant.numeric.suffix
+# ^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^ - constant.numeric
+# ^^^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^^ constant.numeric.suffix
+
+ -0x20 -0X20 -0x20l -0x20m -0x20mb
+# ^ keyword.operator.unary
+# ^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^ keyword.operator.unary
+# ^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^ keyword.operator.unary
+# ^^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^ constant.numeric.suffix
+# ^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^ - constant.numeric
+# ^^^^^^ meta.number.integer.hexadecimal
+# ^^ constant.numeric.base
+# ^^ constant.numeric.value
+# ^^ constant.numeric.suffix
+
+
+###[ Types ]###################################################################
+
+ [string]
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+
+ [string[]]
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^ punctuation.section.brackets.end.powershell
+
+ [int32]
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+
+ [System.Collections.Generic.Dictionary[[System.String, mscorlib],[System.Management.Automation.ParameterMetadata,System.Management.Automation]]]
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic-name.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^^^ support.type.powershell
+# ^^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^ meta.generic-name.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^ support.type.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.generic-name.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^^^^^^^^^^ support.type.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^^^^^^^^^^^^ meta.generic-name.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^^^ support.type.powershell
+# ^^^ punctuation.section.brackets.end.powershell
+
+ [System.Array+SZArrayEnumerator]
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^ meta.generic-name.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^ support.type.powershell
+# ^ punctuation.accessor.plus.powershell
+# ^^^^^^^^^^^^^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+
+ [int]::MinValue
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^ punctuation.accessor.double-colon.powershell
+# ^^^^^^^^ variable.other.member.powershell
+
+ [System.DateTime]::Parse('2016/09/21')
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^ meta.generic-name.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^ punctuation.accessor.double-colon.powershell
+# ^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@ reference
+# ^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.arguments.end.powershell
+
+
+###[ Commands ]################################################################
+
+ Invoke-Something -foobar
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+ Invoke-Something -foobar value
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^ string.unquoted.powershell
+ Invoke-Something -foobar:$true
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+ Invoke-Something -foobar: $true
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+ Invoke-Something -p1 v1 -p2 10 -p3 'value' -switch -verbose
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^ string.unquoted.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+ Invoke-Something (1..20 | Invoke-Something) -p2 'value'
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^ keyword.operator.range.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ keyword.operator.pipe.powershell
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^ punctuation.section.group.end.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ Invoke-Something -p1 v2 -p2 30 | Invoke-Something -switch
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^ string.unquoted.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ keyword.operator.pipe.powershell
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+ Invoke-Something -p1 {
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^ meta.function-call.arguments.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^ meta.block.powershell punctuation.section.braces.begin.powershell
+ Invoke-Something -foobar:$true
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+ } | Invoke-Something
+#^^^^^^^^^ meta.function-call.arguments.powershell
+#^^^^^^^^ meta.block.powershell
+# ^ punctuation.section.braces.end.powershell
+# ^ keyword.operator.pipe.powershell
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+
+ Invoke-Something -p1 value `
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^ string.unquoted.powershell
+# ^ punctuation.separator.continuation.line.powershell
+ -p2 14.4 `
+#^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+# ^ punctuation.separator.continuation.line.powershell
+ # An indented comment doesn't interrupt line continuation
+ -p3 $value | Invoke-Something -verbose
+#^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.pipe.powershell
+# ^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+
+ Get-ChildItem |
+# ^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@ reference
+# ^^ meta.function-call.arguments.powershell
+# ^ keyword.operator.pipe.powershell
+ Select Name,Length
+# ^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@ reference
+# ^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^ string.unquoted.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^ string.unquoted.powershell
+
+ Do-Something && ContinueOn-Success || ContinueOn-Failure
+# ^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@ reference
+# ^ meta.function-call.arguments.powershell
+# ^^ keyword.operator.pipe.conditional.powershell
+# ^^^^^^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@@@@@@ reference
+# ^ meta.function-call.arguments.powershell
+# ^^ keyword.operator.pipe.conditional.powershell
+# ^^^^^^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@@@@@@ reference
+
+ # Commands (Built-in variables)
+ ls *.ps1 -recurse
+# ^^ meta.function-call.powershell variable.function.powershell
+# @@ reference
+# ^^^^^ string.unquoted.powershell
+# ^ constant.other.wildcard.asterisk.powershell
+# ^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+
+ # Issue 164
+ Do-Cleanup
+# ^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@ reference
+ If-Thing
+# ^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@ reference
+ Something-Else
+# ^^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@@ reference
+
+ # Commands (executable files)
+ . .\scripts\Test-Foo.ps1 -parameter 'value'
+# ^ keyword.operator.source.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ & tool.exe
+# ^ keyword.operator.call.powershell
+# ^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@ reference
+
+ something.cmd
+# ^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@ reference
+
+ øyvind.com
+# ^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@ reference
+
+ & '.\script name with spaces.ps1'
+# ^ keyword.operator.call.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.string.powershell string.quoted.single.powershell meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ reference
+# ^ punctuation.definition.string.begin.powershell
+# ^ constant.other.path.self.powershell
+# ^ punctuation.separator.path.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ & ".\script name with spaces.ps1"
+# ^ keyword.operator.call.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.string.interpolated.powershell string.quoted.double.powershell meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ reference
+# ^ punctuation.definition.string.begin.powershell
+# ^ constant.other.path.self.powershell
+# ^ punctuation.separator.path.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ # switch
+ switch ("fourteen") {}
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ switch -CaseSensitive ("fourteen") {}
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ switch -Regex ("fourteen") {}
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ switch -Wildcard ($a) {}
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ switch -regex -file .\somefile.txt {}
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^ string.unquoted.powershell
+# ^ constant.other.path.self.powershell
+# ^ punctuation.separator.path.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ switch (3) {}
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^ meta.function-call.arguments.powershell
+# ^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ switch (4, 2) {}
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+
+ switch -Regex -File $filePath {
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ meta.block.powershell punctuation.section.braces.begin.powershell
+ '.' {}
+#^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ default {}
+#^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^^^^^^^ keyword.control.conditional.default.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ }
+#^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^ punctuation.section.braces.end.powershell
+
+ switch -Wildcard -CaseSensitive ($something) {
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ meta.block.powershell punctuation.section.braces.begin.powershell
+ '.' {}
+#^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ default {}
+#^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^^^^^^^ keyword.control.conditional.default.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ }
+#^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^ punctuation.section.braces.end.powershell
+
+ switch ('this') {
+# ^^^^^^ keyword.control.conditional.switch.powershell
+# ^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ meta.block.powershell punctuation.section.braces.begin.powershell
+ 'this' {}
+#^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ default {}
+#^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^^^^^^^ keyword.control.conditional.default.powershell
+# ^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ }
+#^^^^ meta.function-call.arguments.powershell meta.block.powershell
+# ^ punctuation.section.braces.end.powershell
+
+ data {
+ "Thank you for using my PowerShell Organize.pst script."
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.data.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ "It is provided free of charge to the community."
+ "I appreciate your comments and feedback."
+ }
+#^^^^^^^^ meta.block.data.powershell
+# ^ punctuation.section.block.end.powershell
+
+# <- - meta
+
+ # Functions and filters
+ functioN MyFunction{}
+#^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# @@@@@@@@@@ definition
+# ^^^^^^^^^^ entity.name.function.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+# ^ - meta
+ function My-Function {}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# @@@@@@@@@@@ definition
+# ^^^^^^^^^^^ entity.name.function.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ Function My.Function{}
+#^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# @@@@@@@@@@@ definition
+# ^^^^^^^^^^^ entity.name.function.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ function My-Function.Other{}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# @@@@@@@@@@@@@@@@@ definition
+# ^^^^^^^^^^^^^^^^^ entity.name.function.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ function Some.other.function{}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@@@@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ FUNCTION MyFunction2 {}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ function New-File { }
+#^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ function New-File ($Name) { }
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^^^^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ New-File
+# ^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@ reference
+ function NewFile($Name) { }
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^ entity.name.function.powershell
+# @@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^^^^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ filter myfilter($param) {}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^^^^^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ Filter my-Filter ($param){}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^^^^^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+
+ function Test-Drive([string]$roman) {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@ definition
+# ^ punctuation.section.parameters.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^^^^^ variable.parameter.powershell
+# ^ punctuation.definition.variable.begin.powershell
+# ^ punctuation.section.parameters.end.powershell
+# ^ punctuation.section.block.begin.powershell
+ $roman | c:\users\Me\Documents\Programming\F#\test.exe $roman
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.pipe.powershell
+# ^ meta.function-call.powershell variable.function.powershell
+# @ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^ keyword.operator.ternary.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.powershell
+# ^ punctuation.separator.path.powershell
+# ^ punctuation.separator.path.powershell
+# ^ punctuation.separator.path.powershell
+# ^ punctuation.separator.path.powershell
+# ^ punctuation.separator.path.powershell
+# ^^^^^^^^^^^^^^^^^ comment.line.powershell
+# ^ punctuation.definition.comment.powershell
+ $roman | c:\users\Me\Documents\Programming\F\test.exe $roman
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.pipe.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ reference
+# ^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ }
+#^^^^^^^^ meta.function.powershell
+# ^ punctuation.section.block.end.powershell
+
+
+ # Control words
+ foreach ($item in $collection) {
+# ^^^^^^^ keyword.control.loop.for.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^ keyword.control.loop.in.powershell
+# ^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ meta.block.powershell punctuation.section.braces.begin.powershell
+ }
+#^^^^ meta.block.powershell
+# ^ punctuation.section.braces.end.powershell
+
+ try { }
+# ^^^ keyword.control.exception.try.powershell
+# ^^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ catch { }
+# ^^^^^ keyword.control.exception.catch.powershell
+# ^^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+
+ # Redirection
+ notepad.exe > log.txt
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^ keyword.operator.redirection.powershell
+# ^^^^^^^ string.unquoted.powershell
+ notepad.exe 1> log.txt
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^ constant.numeric.decimal.file-descriptor.powershell
+# ^ keyword.operator.redirection.powershell
+# ^^^^^^^ string.unquoted.powershell
+ notepad.exe *> log.txt
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^ constant.numeric.decimal.file-descriptor.powershell
+# ^ keyword.operator.redirection.powershell
+# ^^^^^^^ string.unquoted.powershell
+ notepad.exe 2>&1
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^ constant.numeric.decimal.file-descriptor.powershell
+# ^^ keyword.operator.redirection.powershell
+# ^ constant.numeric.decimal.file-descriptor.powershell
+ notepad.exe 3>&1
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^ constant.numeric.decimal.file-descriptor.powershell
+# ^^ keyword.operator.redirection.powershell
+# ^ constant.numeric.decimal.file-descriptor.powershell
+ notepad.exe 4>&1
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^ constant.numeric.decimal.file-descriptor.powershell
+# ^^ keyword.operator.redirection.powershell
+# ^ constant.numeric.decimal.file-descriptor.powershell
+ notepad.exe 5>&1
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^ constant.numeric.decimal.file-descriptor.powershell
+# ^^ keyword.operator.redirection.powershell
+# ^ constant.numeric.decimal.file-descriptor.powershell
+ notepad.exe 6>&1
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^ constant.numeric.decimal.file-descriptor.powershell
+# ^^ keyword.operator.redirection.powershell
+# ^ constant.numeric.decimal.file-descriptor.powershell
+ notepad.exe 2>&1> log.txt
+# ^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@ reference
+# ^ constant.numeric.decimal.file-descriptor.powershell
+# ^^ keyword.operator.redirection.powershell
+# ^ constant.numeric.decimal.file-descriptor.powershell
+# ^ keyword.operator.redirection.powershell
+# ^^^^^^^ string.unquoted.powershell
+
+ # Operators
+ if (10 -cgt 100) { }
+# ^^ keyword.control.conditional.if.powershell
+# ^^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^ punctuation.section.braces.end.powershell
+ $a -is $b
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $b -contains $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $x -notcontains $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $c -in $b
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $c -notin $x
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $a -match $b
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $a -notmatch $b
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $x -like $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ 100 -and 0
+# ^^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+ $a -ceq 4 -and $a -ine $d -or
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+ $c -is [Type]
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+ $c -isnot [Type]
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+ $c -as [Type]
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^ keyword.operator.cast.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+ $k = $y -bor $k
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $x = $y -band $x
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $z = -bnot $x
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $l = 1 -shl 10
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+ $r = 10 -shr 1
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+ $k = $y -xor $b
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $k = $y -bxor $b
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ 1 -bxor1
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+ 1-bxor1
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+ $a -bxor$a
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $a-bxor$a
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ -bnot1
+# ^^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+ -bnot$a
+# ^^^^^ keyword.operator.bitwise.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $a -icontains $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $a -ccontains $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $a -iNotContains $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $a -cNotContains $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $a -cmatch $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $x -iMatch $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $x -iNotMatch $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $a -iLike $b
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ $b -cLike $c
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+ "hey" -cgt "Hey"
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ "Hey" -igt "hey"
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ "hey" -cge "Hey"
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ "Hey" -ige "hey"
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ "HEY" -clt "hey"
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ "HEY" -ilt "hey"
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ "HEY" -cle "hey"
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+ "HEY" -ile "hey"
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ function Test-Function {}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^^^^ entity.name.function.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+# @@@@@@@@@@@@@ definition
+ function New-Object {}
+#^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^ entity.name.function.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+# @@@@@@@@@@ definition
+ Test-Function -Class ClassName
+# ^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# ^^^^^^ variable.parameter.option.powershell - storage - keyword
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^ string.unquoted.powershell
+# @@@@@@@@@@@@@ reference
+ New-Object -TypeName System.Diagnostics.Process
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.powershell - keyword
+ New-Object -TypeName System.Data
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^ string.unquoted.powershell - keyword
+ New-Object -TypeName Sy-stem.if
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^ string.unquoted.powershell - keyword
+ New-Object -TypeName S_ystem.Clean
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^ string.unquoted.powershell - keyword
+ New-Object -TypeName Sy_stem-.Throw
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^ string.unquoted.powershell - keyword
+
+ New-Object -TypeName System(Component)
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^ string.unquoted.powershell
+# ^^^^^^^^^^^ - string
+# @@@@@@@@@ reference
+
+ New-Object -TypeName System.Component)
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^^^ string.unquoted.powershell
+# ^ - meta.function-call - string
+
+ (New-Object -TypeName SystemComponent).run()
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^^ string.unquoted.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^ meta.function-call.powershell variable.function.powershell
+# @@@ reference
+# ^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^ punctuation.section.arguments.end.powershell
+
+ New-Object -TypeName System[Component]
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^^^^ string.unquoted.powershell
+
+ New-Object -TypeName System.Component]
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^^^^ string.unquoted.powershell
+
+ New-Object -TypeName System{Compon{ent}}
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^^^^^^ string.unquoted.powershell
+
+ New-Object -TypeName System.Component}
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^^^^^^^^^^^^^^^ string.unquoted.powershell
+# ^^ - meta.function-call - string
+
+ echo `"test`"
+# ^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@ reference
+# ^^ constant.character.escape.powershell
+# ^^^^^^ string.unquoted.powershell - string.quoted
+# ^^ constant.character.escape.powershell
+
+ @("any","array","has").foreach({ $_ })
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.group.array-expression.powershell
+# ^ keyword.other.array.begin.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@ reference
+# ^^^^^^^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^^^^^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.braces.end.powershell
+# ^ punctuation.section.arguments.end.powershell
+ @('any','array','has').foreach{ $_ }
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.group.array-expression.powershell
+# ^ keyword.other.array.begin.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.braces.end.powershell
+ @("any","array","has").where({ $_.Length -gt 3 })
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.group.array-expression.powershell
+# ^ keyword.other.array.begin.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^ variable.other.member.powershell
+# ^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.section.braces.end.powershell
+# ^ punctuation.section.arguments.end.powershell
+ @("any","array","has").where{ $_.Length -gt 3 }
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.group.array-expression.powershell
+# ^ keyword.other.array.begin.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^^^^^^^^^^^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^^ variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^ variable.other.member.powershell
+# ^^^ keyword.operator.comparison.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.section.braces.end.powershell
+
+ function join-path {}
+#^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+
+ $file = join-path $env:SystemDrive "$([System.io.path]::GetRandomFileName()).ps1"
+# ^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^ support.variable.drive.powershell
+# ^ punctuation.accessor.colon.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^ string.quoted.double.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interpolation.powershell
+# ^^ punctuation.section.interpolation.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.powershell.embedded
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^^^^^ meta.generic-name.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^ punctuation.accessor.double-colon.powershell
+# ^^^^^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@@@@@ reference
+# ^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^ punctuation.section.arguments.end.powershell
+# ^ punctuation.section.interpolation.end.powershell
+# ^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ function out-file {}
+#^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ $ScriptBlock | Out-File $file -Force
+# ^^^^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.pipe.powershell
+# ^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@ reference
+# ^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+ function get-something {}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ function Out-WithYou {}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ get-thing | Out-WithYou > $null # destroy
+# ^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@ reference
+# ^ meta.function-call.arguments.powershell
+# ^ keyword.operator.pipe.powershell
+# ^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^ keyword.operator.redirection.powershell
+# ^^^^^ constant.language.null.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^ comment.line.powershell
+# ^ punctuation.definition.comment.powershell
+
+ function get-number {}
+#^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ "When you call a method: $( get-number | %{ invoke-command $( [string]::format("Like (this{0})","what?") ) $var } )"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.interpolation.powershell
+# ^^ punctuation.section.interpolation.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.powershell.embedded
+# ^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@ reference
+# ^ meta.function-call.arguments.powershell
+# ^ keyword.operator.pipe.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.powershell
+# ^ keyword.control.loop.for.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^^^^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.group.complex.subexpression.powershell
+# ^ keyword.other.variable.definition.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ storage.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^^ punctuation.accessor.double-colon.powershell
+# ^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@ reference
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.arguments.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.braces.end.powershell
+# ^ punctuation.section.interpolation.end.powershell
+# ^ string.quoted.double.powershell punctuation.definition.string.end.powershell
+
+ ([MyType])::Name[2]
+# ^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^ punctuation.accessor.double-colon.powershell
+# ^^^^ variable.other.member.powershell
+# ^^^ meta.brackets.indexer.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.section.brackets.end.powershell
+ ([MyType])::Name.ToString()[2]
+# ^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^^^^^^ support.type.powershell
+# ^ punctuation.section.brackets.end.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^ punctuation.accessor.double-colon.powershell
+# ^^^^ variable.other.member.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@ reference
+# ^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^ punctuation.section.arguments.end.powershell
+# ^^^ meta.brackets.indexer.powershell
+# ^ punctuation.section.brackets.begin.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.section.brackets.end.powershell
+
+"This is the DebugPreference variable: $DebugPreference"
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.double
+# ^^^^^^^^^^^^^^^^ meta.string meta.interpolation variable.language - string
+
+ $ConfirmPreference $DebugPreference $ErrorActionPreference $ErrorView
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^ variable.language - punctuation
+ $FormatEnumerationLimit $InformationPreference $LogCommandHealthEvent
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+
+ $LogCommandLifecycleEvent $LogEngineHealthEvent $LogEngineLifecycleEvent
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+ $LogProviderHealthEvent $LogProviderLifecycleEvent $MaximumAliasCount
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
+ $MaximumDriveCount $MaximumErrorCount $MaximumFunctionCount $MaximumHistoryCount
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+ $MaximumVariableCount $OFS $OutputEncoding $PSCulture $PSDebugContext
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^ variable.language - punctuation
+ $PSDefaultParameterValues $PSEmailServer $PSItem $PSModuleAutoLoadingPreference
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+ $PSModuleAutoloadingPreference $PSSenderInfo $PSSessionApplicationName
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+ $PSSessionConfigurationName $PSSessionOption $ProgressPreference
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^^ variable.language - punctuation
+ $VerbosePreference $WarningPreference $WhatIfPreference
+#^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^^ variable.language - punctuation
+# ^ variable.language punctuation
+# ^^^^^^^^^^^^^^^^ variable.language - punctuation
+<#
+.SYNOPSIS
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^^ keyword.other.documentation
+.DESCRIPTION
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^^^^^ keyword.other.documentation
+.PARAMETER
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^^ keyword.other.documentation
+.EXAMPLE
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^ keyword.other.documentation
+.INPUTS
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^ keyword.other.documentation
+.OUTPUTS
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^ keyword.other.documentation
+.NOTES
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^ keyword.other.documentation
+.LINK
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^ keyword.other.documentation
+.COMPONENT
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^^^ keyword.other.documentation
+.ROLE
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^ keyword.other.documentation
+.FUNCTIONALITY
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^^^^^^^ keyword.other.documentation
+.FORWARDHELPTARGETNAME
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^^^^^^^^^^^^^^^ keyword.other.documentation
+.FORWARDHELPCATEGORY
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^^^^^^^^^^^^^ keyword.other.documentation
+.REMOTEHELPRUNSPACE
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^^^^^^^^^^^^ keyword.other.documentation
+.EXTERNALHELP
+#<- comment.block comment.documentation.embedded punctuation.definition.keyword.documentation
+#^^^^^^^^^^^^ keyword.other.documentation
+#>
+
+#region Test
+#<- punctuation.definition.preprocessor
+#^^^^^^ keyword.control.directive.region
+# ^^^^ entity.name.section
+# @@@@ local-definition "#region Test"
+# ^ meta.fold.block.begin
+ Do-Stuff
+# @@@@@@@@ reference
+#endregion (More comments)
+#<- meta.fold.block.end punctuation.definition.preprocessor
+#^^^^^^^^^ keyword.control.directive.endregion
+# ^^^^^^^^^^^^^^^ variable.other.section.powershell
+
+#region
+#<- punctuation.definition.preprocessor
+#^^^^^^ keyword.control.directive.region
+# ^ meta.fold.block.begin
+#endregion (More comments)
+#<- meta.fold.block.end punctuation.definition.preprocessor
+#^^^^^^^^^ keyword.control.directive.endregion
+# ^^^^^^^^^^^^^^^ variable.other.section.powershell
+
+function Process-DeploymentConfig {
+# @@@@@@@@@@@@@@@@@@@@@@@@ definition
+ [CmdletBinding()]
+ param (
+ [Parameter(Mandatory=$true)]
+ [string]$ConfigJson,
+
+ [Parameter(Mandatory=$true)]
+ [hashtable]PathVariables
+ )
+
+ #region PathHelper
+# ^ punctuation.definition.preprocessor
+# ^^^^^^ keyword.control.directive.region
+# ^^^^^^^^^^ entity.name.section
+# @@@@@@@@@@ local-definition "#region PathHelper"
+# ^ meta.fold.block.begin
+
+ function Resolve-ConfigPath {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@@@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+ [CmdletBinding()]
+ param (
+ [Parameter(Mandatory=$true)]
+ [string]$Path,
+
+ [Parameter(Mandatory=$true)]
+ [hashtable]$PathVariables
+ )
+
+ $Private:ResolvedPath = $Path
+ foreach ($key in $PathVariables.Keys) {
+ $ResolvedPath = $ResolvedPath.Replace($key, $PathVariables[$key])
+# @@@@@@@ reference
+ }
+ return $ResolvedPath
+ }
+ #endregion PathHelper
+# ^ meta.fold.block.end punctuation.definition.preprocessor
+# ^^^^^^ keyword.control.directive.endregion
+# ^^^^^^^^^^ variable.other.section.powershell
+
+
+ Resolve-ConfigPath -Path "Foo" -PathVariables $PathVariables
+# @@@@@@@@@@@@@@@@@@ reference
+}
diff --git a/tests/syntax_test_Workflow.ps1 b/tests/syntax_test_Workflow.ps1
new file mode 100644
index 00000000..be0bbb72
--- /dev/null
+++ b/tests/syntax_test_Workflow.ps1
@@ -0,0 +1,187 @@
+# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
+
+"<- Exit the imports context block"
+
+ workflow w1 {}
+#^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^ entity.name.function.powershell
+# @@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+ Workflow work { sequence {} }
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^ entity.name.function.powershell
+# @@@@ definition
+# ^ punctuation.section.block.begin.powershell
+# ^^^^^^^^^^^ meta.block.powershell
+# ^^^^^^^^ keyword.control.flow.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^ punctuation.section.block.end.powershell
+# ^ punctuation.section.block.end.powershell
+
+ workflow Test-Workflow {
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.declaration.function.powershell
+# ^^^^^^^^^^^^^ entity.name.function.powershell
+# @@@@@@@@@@@@@ definition
+# ^ punctuation.section.block.begin.powershell
+ parallel {
+#^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^ keyword.control.flow.powershell
+# ^ punctuation.section.block.begin.powershell
+ Get-Process
+# @@@@@@@@@@@ reference
+ Get-Service
+#^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@ reference
+ }
+ }
+
+
+ workflow Test-Workflow {
+# @@@@@@@@@@@@@ definition
+ $a = 3
+#^^^^^^^^^^^^^ meta.function.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+
+ ## Without $Using, the $a workflow variable isn't visible
+ ## in inline script.
+ inlinescript {"Inline A0 = $a"}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^ keyword.control.context.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^^^^^^^^^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^ meta.interpolation.powershell variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ string.quoted.double.powershell punctuation.definition.string.end.powershell
+# ^ punctuation.section.block.end.powershell
+
+ ## $Using imports the variable and its current value.
+ inlinescript {"Inline A1 = $Using:a"}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.powershell
+# ^^^^^^^^^^^^ keyword.control.context.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^^^^^^^^^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^ meta.interpolation.powershell variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^ storage.modifier.scope.powershell
+# ^ punctuation.accessor.colon.powershell
+# ^ string.quoted.double.powershell punctuation.definition.string.end.powershell
+# ^ punctuation.section.block.end.powershell
+ }
+ Test-Workflow
+# @@@@@@@@@@@@@ reference
+
+
+ workflow Test-Workflow {
+# @@@@@@@@@@@@@ definition
+ $a = 3
+
+ ## Changes to the inlinescript variable value don't
+ ## change the workflow variable.
+ inlinescript {
+ $a = $Using:a+1;
+ "Inline A = $a"
+ }
+ "Workflow A = $a"
+
+ ## To change the variable in workflow scope, return the
+ ## new value.
+ $a = inlinescript {$b = $Using:a+1; $b}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.powershell
+# ^^^^^^^^^^^^ keyword.control.context.powershell
+# ^ punctuation.section.block.begin.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^ storage.modifier.scope.powershell
+# ^ punctuation.accessor.colon.powershell
+# ^ keyword.operator.unary.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.terminator.statement.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.block.end.powershell
+ "Workflow New A = $a"
+ }
+ Test-Workflow
+# @@@@@@@@@@@@@ reference
+
+
+ workflow Test-Workflow {
+# @@@@@@@@@@@@@ definition
+ $ie = inlinescript {
+ $ie = New-Object -ComObject InternetExplorer.Application -Property @{navigate2="www.microsoft.com"}
+# @@@@@@@@@@ reference
+
+ $ie.Visible = $true
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^ variable.other.member.powershell
+# ^ keyword.operator.assignment.powershell
+# ^^^^^ constant.language.boolean.true.powershell
+# ^ punctuation.definition.variable.powershell
+ }
+
+ $ie
+ }
+ Test-Workflow
+# @@@@@@@@@@@@@ reference
+
+
+ workflow Test-Workflow {
+# @@@@@@@@@@@@@ definition
+ parallel {
+ Get-Process
+# @@@@@@@@@@@ reference
+ Get-Service
+#^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell
+# ^^^^^^^^^^^ meta.function-call.powershell support.function.powershell
+# @@@@@@@@@@@ reference
+
+ sequence {
+# ^ meta.function.powershell meta.block.powershell meta.block.powershell punctuation.section.block.begin.powershell
+ $Hotfix = Get-Content 'D:\HotFixes\Required.txt'
+# @@@@@@@@@@@ reference
+ foreach ($h in $Hotfix) {D:\Scripts\Verify-Hotfix.ps1 -Hotfix $h}
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.powershell meta.block.powershell meta.block.powershell
+# ^^^^^^^ keyword.control.loop.for.powershell
+# ^^^^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^ keyword.control.loop.in.powershell
+# ^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.group.end.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.powershell
+# ^ punctuation.section.braces.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@@@@@@@@@@@@@@@@@@@@@ reference
+# ^^^^^^^ variable.parameter.option.powershell
+# ^ punctuation.definition.parameter.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.braces.end.powershell
+ }
+ }
+ }
diff --git a/tests/syntax_test_partial-symbols.ps1 b/tests/syntax_test_partial-symbols.ps1
new file mode 100644
index 00000000..0371a95b
--- /dev/null
+++ b/tests/syntax_test_partial-symbols.ps1
@@ -0,0 +1,16 @@
+# SYNTAX TEST partial-symbols "Packages/PowerShell/PowerShell.sublime-syntax"
+
+
+ data TextMsgs {
+# ^^^^^^^^^^^^^^^ meta.block.data.powershell
+# ^^^^ keyword.control.context.powershell
+# ^^^^^^^^ entity.name.section.powershell
+# ^ punctuation.section.block.begin.powershell
+ ConvertFrom-StringData -StringData @'
+# @@@@@@@@@@@@@@@@@@@@@@ reference
+ Text001 = Windows 7
+ Text002 = Windows Server 2008 R2
+'@
+ }
+
+ $TextMsgs
diff --git a/Tests/syntax_test_reindent.ps1 b/tests/syntax_test_reindent.ps1
similarity index 100%
rename from Tests/syntax_test_reindent.ps1
rename to tests/syntax_test_reindent.ps1
diff --git a/tests/syntax_test_strings.ps1 b/tests/syntax_test_strings.ps1
new file mode 100644
index 00000000..4bfcdbea
--- /dev/null
+++ b/tests/syntax_test_strings.ps1
@@ -0,0 +1,798 @@
+# SYNTAX TEST "Packages/PowerShell/PowerShell.sublime-syntax"
+
+###[ Single Quoted Strings ]###################################################
+
+ 'This is a single quoted string.'
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell - meta.string.interpolated
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ 'This is a
+# ^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell - meta.string.interpolated
+# ^ punctuation.definition.string.begin.powershell
+ single quoted string.'
+#^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell - meta.string.interpolated
+# ^ punctuation.definition.string.end.powershell
+
+ 'This #also'
+# ^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell - comment
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ 'This "string" is nice.'
+# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell - constant
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ '$This is a single ''quoted'' string.'
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell - meta.string.interpolated
+# ^ punctuation.definition.string.begin.powershell
+# ^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ '$(Invoke-Something)'
+# ^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell - meta.interpolation - variable - support
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ 'Not escape chars: `", `n, `$, `b, `"'
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell - constant
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ ‘curly ‘‘quotes'’ are equivalent to straight ones'
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ @'
+# ^^ meta.string.powershell string.quoted.single.heredoc.powershell punctuation.definition.string.begin.powershell - meta.string.interpolated
+ A 'single quoted' "heredoc"
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.heredoc.powershell - punctuation
+ '@
+#^^^^^ meta.string.powershell string.quoted.single.heredoc.powershell - punctuation
+'@
+#^ meta.string.powershell string.quoted.single.heredoc.powershell punctuation.definition.string.end.powershell
+
+ @'
+ using System;
+#^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.heredoc.powershell source.cs
+# ^^^^^ keyword.control.import.cs
+# ^^^^^^ meta.path.cs
+# ^ punctuation.terminator
+'@
+
+###[ Double Quoted Strings ]###################################################
+
+ "This is a double quoted string."
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ "This is a
+# ^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+ double quoted string."
+#^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ "This #also"
+# ^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell - comment
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ "This 'string' is nice."
+# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell - constant
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ "$This is a double ""quoted"" string."
+# ^ meta.string string.quoted.double
+# ^^^^^ meta.string meta.interpolation variable.language - string
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string string.quoted.double - meta.interpolation
+# ^^ constant.character.escape
+# ^^ constant.character.escape
+
+ # In double-quoted strings, only the variable should be highlighted, not the property
+ "This is my $variable.Name!"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^^^^^^^^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^ meta.interpolation.powershell variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^ string.quoted.double.powershell - meta.interpolation - variable - punctuation.accessor
+# ^ punctuation.definition.string.end.powershell
+
+ # When used in a subexpression, both should be highlighted
+ "This is my $($variable.Name)!"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^^^^^^^^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^ meta.interpolation.powershell - string
+# ^^ punctuation.section.interpolation.begin.powershell
+# ^^^^^^^^^^^^^^ source.powershell.embedded
+# ^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^ variable.other.member.powershell
+# ^ punctuation.section.interpolation.end.powershell
+# ^^ string.quoted.double.powershell - meta.interpolation
+# ^ punctuation.definition.string.end.powershell
+
+ # When used in a subexpression, still don't extend past its closing
+ "This is my $($variable.Name).Name!"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^^^^^^^^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^ meta.interpolation.powershell
+# ^^ punctuation.section.interpolation.begin.powershell
+# ^^^^^^^^^^^^^^ source.powershell.embedded
+# ^^^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^ variable.other.member.powershell
+# ^ punctuation.section.interpolation.end.powershell
+# ^^^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ # $ENV:ComputerName should be highlighted
+ "This is the name of my computer: $ENV:ComputerName"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^ meta.interpolation.powershell variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^ support.variable.drive.powershell
+# ^ punctuation.accessor.colon.powershell
+# ^ string.quoted.double.powershell punctuation.definition.string.end.powershell
+
+ # Here as well
+ "This is the name of my computer: ${ENV:ComputerName}"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^ meta.interpolation.powershell variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^ punctuation.section.interpolation.begin.powershell
+# ^^^ support.variable.drive.powershell
+# ^ punctuation.accessor.colon.powershell
+# ^ punctuation.section.interpolation.end.powershell
+# ^ string.quoted.double.powershell punctuation.definition.string.end.powershell
+
+ # The @splat references only work in argument mode, should not highlight in strings
+ "This is a @double quoted string."
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell - variable - punctuation.definition.variable
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ # Double check scopes for automatic variables in strings
+ "$_ $$ $Pwd"
+# ^^^^^^^^^^^^ meta.string.interpolated.powershell
+# ^ string.quoted.double.powershell punctuation.definition.string.begin.powershell
+# ^^ meta.interpolation.powershell variable.language.powershell - string
+# ^ punctuation.definition.variable.powershell
+# ^ string.quoted.double.powershell
+# ^^ meta.interpolation.powershell variable.language.powershell - string
+# ^ punctuation.definition.variable.powershell
+# ^ string.quoted.double.powershell
+# ^^^^ meta.interpolation.powershell variable.language.powershell - string
+# ^ punctuation.definition.variable.powershell
+# ^ string.quoted.double.powershell punctuation.definition.string.end.powershell
+
+ "$(Invoke-Something)"
+# ^ meta.string string.quoted.double
+# ^^^^^^^^^^^^^^^^^^^ meta.string meta.interpolation - string
+# ^^ punctuation.section.interpolation.begin
+# ^^^^^^^^^^^^^^^^ support.function
+# ^ punctuation.section.interpolation.end
+# @@@@@@@@@@@@@@@@ reference
+
+ “curly ““quotes"” are equivalent to straight ones"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ # Double quoted here-string
+ @"
+# ^^ meta.string.interpolated.powershell string.quoted.double.heredoc.powershell punctuation.definition.string.begin.powershell
+ $This is a 'double quoted'
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell
+#^^^ string.quoted.double.heredoc.powershell
+# ^^^^^ meta.interpolation.powershell variable.language.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.heredoc.powershell
+ Isn't it "nice"??
+#^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.heredoc.powershell - punctuation
+ There is no @splatting here!
+#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.heredoc.powershell
+ "@
+#^^^^^ meta.string.interpolated.powershell string.quoted.double.heredoc.powershell - punctuation
+"@
+#^ meta.string.interpolated.powershell string.quoted.double.heredoc.powershell punctuation.definition.string.end.powershell
+
+
+ "Escaped chars: `", `n, `$, `b, `t, `e, `u{10ffff}, `""
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^^^^^^^^^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ @"
+ using System;
+#^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.heredoc.powershell source.cs
+# ^^^^^ keyword.control.import.cs
+# ^^^^^^ meta.path.cs
+# ^ punctuation.terminator
+"@
+
+
+###[ Regular Expressions ]#####################################################
+
+ 'book' -match 'oo'
+# ^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^ source.regexp.embedded
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ 'big' -match 'b[iou]g'
+# ^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^ source.regexp.embedded
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ 42 -match '[0-9][0-9]'
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^ source.regexp.embedded
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ 'a1\ ' -match '....'
+# ^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^ source.regexp.embedded keyword.other.any.regexp
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ 'ACCOUNT NAME: Administrator' -match 'ACCOUNT NAME:\s*\w*'
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^ source.regexp.embedded
+# ^^ keyword.control.character-class.regexp
+# ^ keyword.operator.quantifier.regexp
+# ^^ keyword.control.character-class.regexp
+# ^ keyword.operator.quantifier.regexp
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ 'SERVER01' -match '[A-Z]+-?\d\d'
+# ^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^ source.regexp.embedded
+# ^^^^^ meta.set.regexp
+# ^ keyword.operator.quantifier.regexp
+# ^ keyword.operator.quantifier.regexp
+# ^^^^ keyword.control.character-class.regexp
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ '111-222-3333' -match '\d{3}-\d{3}-\d{4}'
+# ^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^ source.regexp.embedded
+# ^^ keyword.control.character-class.regexp
+# ^^^ keyword.operator.quantifier.regexp
+# ^^ keyword.control.character-class.regexp
+# ^^^ keyword.operator.quantifier.regexp
+# ^^ keyword.control.character-class.regexp
+# ^^^ keyword.operator.quantifier.regexp
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ 'fishing' -match '^fish$'
+# ^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^ source.regexp.embedded
+# ^ keyword.control
+# ^ keyword.control
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ '3.141' -match '3\.\d{2,}'
+# ^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^ source.regexp.embedded
+# ^^ constant.character.escape.regexp
+# ^^ keyword.control.character-class.regexp
+# ^^^^ keyword.operator.quantifier.regexp
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ 'The last logged on user was CONTOSO\jsmith' -match '(.+was )(.+)'
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^ source.regexp.embedded
+# ^ keyword.other.any.regexp
+# ^ keyword.operator.quantifier.regexp
+# ^ keyword.other.any.regexp
+# ^ keyword.operator.quantifier.regexp
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ $string -match 'was (?.+)\\(?.+)'
+# ^^^^^^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+# ^^^^^^ keyword.operator.logical.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.regexp.embedded
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ 'Hello World' -replace '(\w+) \w+', '$1 Universe'
+# ^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^^^ keyword.operator.string.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^ source.regexp.embedded
+# ^^ keyword.control.character-class.regexp
+# ^ keyword.operator.quantifier.regexp
+# ^^ keyword.control.character-class.regexp
+# ^ keyword.operator.quantifier.regexp
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^ source.regexp.embedded
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ "Hello World" -replace "(\w+) \w+", "`$1 Universe"
+ '5.72' -replace '(.+)', '$$$1'
+# ^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^^^^^^^ keyword.operator.string.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^ source.regexp.embedded
+# ^ keyword.other.any.regexp
+# ^ keyword.operator.quantifier.regexp
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^ meta.string.powershell
+# ^ string.quoted.single.powershell punctuation.definition.string.begin.powershell
+# ^^^^ source.regexp.embedded
+# ^ string.quoted.single.powershell punctuation.definition.string.end.powershell
+ "5.72" -replace "(.+)", "`$`$`$1"
+
+###[ String Formatting ]#######################################################
+
+ "{0:N2}" -f $a
+# ^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ "{0:D8}" -f $a
+# ^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ "{0:C2}" -f $a
+# ^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ "{0:P0}" -f $a
+# ^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ "{0:X0}" -f $a
+# ^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ variable.other.readwrite.powershell
+# ^ punctuation.definition.variable.powershell
+
+ (1.11).ToString("#.#")
+# ^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.accessor.dot.powershell
+# ^^^^^^^^ meta.function-call.powershell variable.function.powershell
+# @@@@@@@@ reference
+# ^^^^^^^ meta.function-call.arguments.powershell
+# ^ punctuation.section.arguments.begin.powershell
+# ^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.section.arguments.end.powershell
+
+ "{1,10} {0,10} {2,10:x}" -f "First", "Second", 255
+# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+
+ ("{0,6}" -f 4.99), ("{0,6:##.00}" -f 15.9)
+# ^^^^^^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+# ^ punctuation.section.group.end.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+# ^ punctuation.section.group.end.powershell
+
+ "{0:R}" -f (1mb/2.0)
+# ^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^ meta.group.powershell
+# ^ punctuation.section.group.begin.powershell
+# ^^^ meta.number.integer.decimal.powershell
+# ^ constant.numeric.value.powershell
+# ^^ constant.numeric.suffix.powershell
+# ^ keyword.operator.arithmetic.powershell
+# ^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+# ^ punctuation.section.group.end.powershell
+
+ "{0:00.0}" -f 4.12341234
+# ^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+
+ "{0:##.#}" -f 4.12341234
+# ^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+
+ "{0:#,#.#}" -f 1234.121234
+# ^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^ constant.other.format-spec.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+
+ "{0:##,,.000}" -f 1048576
+# ^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^^^^ constant.other.format-spec.powershell
+# ^^ punctuation.separator.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+
+ "{this is not a #comment}"
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell - comment - constant.other.placeholder
+# ^ punctuation.definition.string.begin.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ "{0:##.#E000}" -f 2.71828
+# ^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^^^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+
+ "{0:#.00'##'}" -f 2.71828
+# ^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^^^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+
+ "{0:#.00""##""}" -f 2.71828
+# ^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^^^^^^ constant.other.format-spec.powershell
+# ^^ constant.character.escape.powershell
+# ^^ constant.character.escape.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+
+ "{0:#.00`u{00b5}}" -f 2.54
+# ^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^^^^^^^^ meta.format-spec.powershell constant.other.format-spec.powershell
+# ^^^^^^^^ constant.character.escape.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+
+ "{0:POS;NEG;ZERO}" -f -14
+# ^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^^^^^^^^ constant.other.format-spec.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^ keyword.operator.unary.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+
+ "{0:$## Please}" -f 14
+# ^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell - comment
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^^^^^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^ meta.number.integer.decimal.powershell constant.numeric.value.powershell
+
+ "{0,-8:P1}" -f 1.75
+# ^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+
+ "{0,10:N3}{1,10:N3}{2,10:N3}{3,10:N3}" -f 0.2, 0.3, 0.45, 0.91
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.interpolated.powershell string.quoted.double.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+# ^ punctuation.separator.sequence.powershell
+# ^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell
+
+ # Single-quoted format string
+ '{0:00000.000}' -f 7.125
+# ^^^^^^^^^^^^^^^ meta.string.powershell string.quoted.single.powershell
+# ^ punctuation.definition.string.begin.powershell
+# ^^^^^^^^^^^^^ constant.other.placeholder.powershell
+# ^ punctuation.definition.placeholder.begin.powershell
+# ^ punctuation.separator.format-spec.powershell
+# ^^^^^^^^^ constant.other.format-spec.powershell
+# ^ punctuation.definition.placeholder.end.powershell
+# ^ punctuation.definition.string.end.powershell
+# ^^ keyword.operator.string-format.powershell
+# ^ punctuation.definition.keyword.powershell
+# ^^^^^ meta.number.float.decimal.powershell constant.numeric.value.powershell
+# ^ punctuation.separator.decimal.powershell