Created
July 17, 2013 16:14
-
-
Save jm-welch/6022056 to your computer and use it in GitHub Desktop.
PowerShell syntax highlighting test script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Syntax test script for PowerGUI | |
# ------------------------------- | |
# To modify syntax highlighting, use the Script Colors addin | |
# from http://www.powergui.org/entry.jspa?externalID=3023 | |
# Or edit PowerShellSyntax.xml in your PowerGUI install path | |
cls | |
<# Formatted types in example below | |
$myarray : variable | |
function, if : reserved word | |
MyFunc : function | |
6,2 : numbers (int) | |
0x3 : number (hex) | |
=,-,* : operators | |
-eq : operator word | |
$false, $args : autovars | |
Write-Host : cmdlet | |
-NoNewline : cmdlet parameter | |
Green : string (unquoted) | |
#> | |
$myarray = ('day', "ignore") | |
function MyFunc { | |
if (6-2*0x3 -eq $false){ | |
Write-Host "Oh, happy " -NoNewline | |
Write-Host $args[0] -ForegroundColor Green | |
} | |
} | |
MyFunc $myarray[0] | |
#region Formatting type definitions from PowerShellSyntax.xml | |
# region/endregion tags are formatted as Reserved Words, and allow code folding | |
function StringTypes{ | |
# Placing these in a function so they aren't executed | |
'Single-quoted string' | |
"Double-quoted sring" | |
@' | |
Single-quoted here-string | |
'@ | |
@" | |
Double-quoted here-string | |
"@ | |
} | |
<# Auto-Vars | |
$$ $? $^ $_ $Args $DebugPreference $Error $ErrorActionPreference $foreach $Home | |
$Input $LASTEXITCODE $MaximumAliasCount $MaximumDriveCount $MaximumFunctionCount $MaximumHistoryCount $MaximumVariableCount $PsHome $Host $OFS | |
$ReportErrorShowExceptionClass $ReportErrorShowInnerException $ReportErrorShowSource $ReportErrorShowStackTrace $ShouldProcessPreference $ShouldProcessReturnPreference $StackTrace $VerbosePreference $WarningPreference $PWD | |
$true $false | |
#> | |
<# Reserved Words | |
break continue do for foreach while if switch until function | |
filter else elseif in return param throw trap default begin | |
process end try catch finally workflow parallel sequence | |
inlinescript checkpoint-workflow suspend-workflow | |
#> | |
<# Operators/OperatorWords | |
-eq -ne -gt -ge -lt -le -ieq -ine -igt -ige | |
-ilt -ile -ceq -cne -cgt -cge -clt -cle -like -notlike | |
-match -notmatch -ilike -inotlike -imatch -inotmatch -clike -cnotlike -cmatch -cnotmatch | |
-contains -notcontains -icontains -inotcontains -ccontains -cnotcontains -isnot -is -as -replace | |
-ireplace -creplace -split -join -and -or -band -bor -not -bnot | |
-f -xor -bxor += -= *= /= %= -- ++ | |
+ - * / % = ! | |
-regex -wildcard -exact -casesensitive -file | |
#> | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment