1 | 1 | simandl | <?php |
2 | | | /************************************************************************************* |
3 | | | * powershell.php |
4 | | | * --------------------------------- |
5 | | | * Author: Frode Aarebrot (frode@aarebrot.net) |
6 | | | * Copyright: (c) 2008 Frode Aarebrot (http://www.aarebrot.net) |
7 | | | * Release Version: 1.0.8.1 |
8 | | | * Date Started: 2008/06/20 |
9 | | | * |
10 | | | * PowerShell language file for GeSHi. |
11 | | | * |
12 | | | * I've tried to make this language file as true to the highlighting in PowerGUI as |
13 | | | * possible. Unfortunately it's not 100% complete, although it is pretty close. |
14 | | | * |
15 | | | * I've included some classes and their members, but there's tons and tons of these. |
16 | | | * I suggest you add the ones you need yourself. I've included a few Sharepoint ones |
17 | | | * in this language file. |
18 | | | * |
19 | | | * CHANGES |
20 | | | * ------- |
21 | | | * 2008/06/20 (1.0.8) |
22 | | | * - First Release |
23 | | | * |
24 | | | * TODO (updated 2008/06/20) |
25 | | | * ------------------------- |
26 | | | * - Color text between Cmdlets/Aliases and pipe/end-of-line |
27 | | | * - Try and get -- and ++ to work in the KEYWORDS array with the other operators |
28 | | | * |
29 | | | ************************************************************************************* |
30 | | | * |
31 | | | * This file is part of GeSHi. |
32 | | | * |
33 | | | * GeSHi is free software; you can redistribute it and/or modify |
34 | | | * it under the terms of the GNU General Public License as published by |
35 | | | * the Free Software Foundation; either version 2 of the License, or |
36 | | | * (at your option) any later version. |
37 | | | * |
38 | | | * GeSHi is distributed in the hope that it will be useful, |
39 | | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
40 | | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
41 | | | * GNU General Public License for more details. |
42 | | | * |
43 | | | * You should have received a copy of the GNU General Public License |
44 | | | * along with GeSHi; if not, write to the Free Software |
45 | | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
46 | | | * |
47 | | | ************************************************************************************/ |
48 | | | |
49 | | | $language_data = array ( |
50 | | | 'LANG_NAME' => 'posh', |
51 | | | 'COMMENT_SINGLE' => array(1 => '#'), |
52 | | | 'COMMENT_MULTI' => array(), |
53 | | | 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, |
54 | | | 'QUOTEMARKS' => array("'", '"'), |
55 | | | 'ESCAPE_CHAR' => '`', |
56 | | | 'KEYWORDS' => array( |
57 | | | 1 => array( |
58 | | | // Cmdlets |
59 | | | 'Add-Content', 'Add-History', 'Add-Member', 'Add-PSSnapin', 'Clear-Content', 'Clear-Item', |
60 | | | 'Clear-ItemProperty', 'Clear-Variable', 'Compare-Object', 'ConvertFrom-SecureString', |
61 | | | 'Convert-Path', 'ConvertTo-Html', 'ConvertTo-SecureString', 'Copy-Item', 'Copy-ItemProperty', |
62 | | | 'Export-Alias', 'Export-Clixml', 'Export-Console', 'Export-Csv', 'ForEach-Object', |
63 | | | 'Format-Custom', 'Format-List', 'Format-Table', 'Format-Wide', 'Get-Acl', 'Get-Alias', |
64 | | | 'Get-AuthenticodeSignature', 'Get-ChildItem', 'Get-Command', 'Get-Content', 'Get-Credential', |
65 | | | 'Get-Culture', 'Get-Date', 'Get-EventLog', 'Get-ExecutionPolicy', 'Get-Help', 'Get-History', |
66 | | | 'Get-Host', 'Get-Item', 'Get-ItemProperty', 'Get-Location', 'Get-Member', |
67 | | | 'Get-PfxCertificate', 'Get-Process', 'Get-PSDrive', 'Get-PSProvider', 'Get-PSSnapin', |
68 | | | 'Get-Service', 'Get-TraceSource', 'Get-UICulture', 'Get-Unique', 'Get-Variable', |
69 | | | 'Get-WmiObject', 'Group-Object', 'Import-Alias', 'Import-Clixml', 'Import-Csv', |
70 | | | 'Invoke-Expression', 'Invoke-History', 'Invoke-Item', 'Join-Path', 'Measure-Command', |
71 | | | 'Measure-Object', 'Move-Item', 'Move-ItemProperty', 'New-Alias', 'New-Item', |
72 | | | 'New-ItemProperty', 'New-Object', 'New-PSDrive', 'New-Service', 'New-TimeSpan', |
73 | | | 'New-Variable', 'Out-Default', 'Out-File', 'Out-Host', 'Out-Null', 'Out-Printer', |
74 | | | 'Out-String', 'Pop-Location', 'Push-Location', 'Read-Host', 'Remove-Item', |
75 | | | 'Remove-ItemProperty', 'Remove-PSDrive', 'Remove-PSSnapin', 'Remove-Variable', 'Rename-Item', |
76 | | | 'Rename-ItemProperty', 'Resolve-Path', 'Restart-Service', 'Resume-Service', 'Select-Object', |
77 | | | 'Select-String', 'Set-Acl', 'Set-Alias', 'Set-AuthenticodeSignature', 'Set-Content', |
78 | | | 'Set-Date', 'Set-ExecutionPolicy', 'Set-Item', 'Set-ItemProperty', 'Set-Location', |
79 | | | 'Set-PSDebug', 'Set-Service', 'Set-TraceSource', 'Set-Variable', 'Sort-Object', 'Split-Path', |
80 | | | 'Start-Service', 'Start-Sleep', 'Start-Transcript', 'Stop-Process', 'Stop-Service', |
81 | | | 'Stop-Transcript', 'Suspend-Service', 'Tee-Object', 'Test-Path', 'Trace-Command', |
82 | | | 'Update-FormatData', 'Update-TypeData', 'Where-Object', 'Write-Debug', 'Write-Error', |
83 | | | 'Write-Host', 'Write-Output', 'Write-Progress', 'Write-Verbose', 'Write-Warning' |
84 | | | ), |
85 | | | 2 => array( |
86 | | | // Aliases |
87 | | | 'ac', 'asnp', 'clc', 'cli', 'clp', 'clv', 'cpi', 'cpp', 'cvpa', 'diff', 'epal', 'epcsv', 'fc', |
88 | | | 'fl', 'ft', 'fw', 'gal', 'gc', 'gci', 'gcm', 'gdr', 'ghy', 'gi', 'gl', 'gm', |
89 | | | 'gp', 'gps', 'group', 'gsv', 'gsnp', 'gu', 'gv', 'gwmi', 'iex', 'ihy', 'ii', 'ipal', 'ipcsv', |
90 | | | 'mi', 'mp', 'nal', 'ndr', 'ni', 'nv', 'oh', 'rdr', 'ri', 'rni', 'rnp', 'rp', 'rsnp', 'rv', |
91 | | | 'rvpa', 'sal', 'sasv', 'sc', 'select', 'si', 'sl', 'sleep', 'sort', 'sp', 'spps', 'spsv', 'sv', |
92 | | | 'tee', 'write', 'cat', 'cd', 'clear', 'cp', 'h', 'history', 'kill', 'lp', 'ls', |
93 | | | 'mount', 'mv', 'popd', 'ps', 'pushd', 'pwd', 'r', 'rm', 'rmdir', 'echo', 'cls', 'chdir', |
94 | | | 'copy', 'del', 'dir', 'erase', 'move', 'rd', 'ren', 'set', 'type' |
95 | | | ), |
96 | | | 3 => array( |
97 | | | // Reserved words |
98 | | | 'break', 'continue', 'do', 'for', 'foreach', 'while', 'if', 'switch', 'until', 'where', |
99 | | | 'function', 'filter', 'else', 'elseif', 'in', 'return', 'param', 'throw', 'trap' |
100 | | | ), |
101 | | | 4 => array( |
102 | | | // Operators |
103 | | | '-eq', '-ne', '-gt', '-ge', '-lt', '-le', '-ieq', '-ine', '-igt', '-ige', '-ilt', '-ile', |
104 | | | '-ceq', '-cne', '-cgt', '-cge', '-clt', '-cle', '-like', '-notlike', '-match', '-notmatch', |
105 | | | '-ilike', '-inotlike', '-imatch', '-inotmatch', '-clike', '-cnotlike', '-cmatch', '-cnotmatch', |
106 | | | '-contains', '-notcontains', '-icontains', '-inotcontains', '-ccontains', '-cnotcontains', |
107 | | | '-isnot', '-is', '-as', '-replace', '-ireplace', '-creplace', '-and', '-or', '-band', '-bor', |
108 | | | '-not', '-bnot', '-f', '-casesensitive', '-exact', '-file', '-regex', '-wildcard' |
109 | | | ), |
110 | | | 5 => array( |
111 | | | // Options |
112 | | | '-Year', '-Wrap', '-Word', '-Width', '-WhatIf', '-Wait', '-View', '-Verbose', '-Verb', |
113 | | | '-Variable', '-ValueOnly', '-Value', '-Unique', '-UFormat', '-TypeName', '-Trace', '-TotalCount', |
114 | | | '-Title', '-TimestampServer', '-TargetObject', '-Syntax', '-SyncWindow', '-Sum', '-String', |
115 | | | '-Strict', '-Stream', '-Step', '-Status', '-Static', '-StartupType', '-Start', '-StackName', |
116 | | | '-Stack', '-SourceId', '-SimpleMatch', '-ShowError', '-Separator', '-SecureString', '-SecureKey', |
117 | | | '-SecondValue', '-SecondsRemaining', '-Seconds', '-Second', '-Scope', '-Root', '-Role', |
118 | | | '-Resolve', '-RemoveListener', '-RemoveFileListener', '-Registered', '-ReferenceObject', |
119 | | | '-Recurse', '-RecommendedAction', '-ReadCount', '-Quiet', '-Query', '-Qualifier', '-PSSnapin', |
120 | | | '-PSProvider', '-PSHost', '-PSDrive', '-PropertyType', '-Property', '-Prompt', '-Process', |
121 | | | '-PrependPath', '-PercentComplete', '-Pattern', '-PathType', '-Path', '-PassThru', '-ParentId', |
122 | | | '-Parent', '-Parameter', '-Paging', '-OutVariable', '-OutBuffer', '-Option', '-OnType', '-Off', |
123 | | | '-Object', '-Noun', '-NoTypeInformation', '-NoQualifier', '-NoNewline', '-NoElement', |
124 | | | '-NoClobber', '-NewName', '-Newest', '-Namespace', '-Name', '-Month', '-Minutes', '-Minute', |
125 | | | '-Minimum', '-Milliseconds', '-Message', '-MemberType', '-Maximum', '-LogName', '-LiteralPath', |
126 | | | '-LiteralName', '-ListenerOption', '-List', '-Line', '-Leaf', '-Last', '-Key', '-ItemType', |
127 | | | '-IsValid', '-IsAbsolute', '-InputObject', '-IncludeEqual', '-IncludeChain', '-Include', |
128 | | | '-IgnoreWhiteSpace', '-Id', '-Hours', '-Hour', '-HideTableHeaders', '-Head', '-GroupBy', |
129 | | | '-Functionality', '-Full', '-Format', '-ForegroundColor', '-Force', '-First', '-FilterScript', |
130 | | | '-Filter', '-FilePath', '-Expression', '-ExpandProperty', '-Expand', '-ExecutionPolicy', |
131 | | | '-ExcludeProperty', '-ExcludeDifferent', '-Exclude', '-Exception', '-Examples', '-ErrorVariable', |
132 | | | '-ErrorRecord', '-ErrorId', '-ErrorAction', '-End', '-Encoding', '-DisplayName', '-DisplayHint', |
133 | | | '-DisplayError', '-DifferenceObject', '-Detailed', '-Destination', '-Description', '-Descending', |
134 | | | '-Depth', '-DependsOn', '-Delimiter', '-Debugger', '-Debug', '-Days', '-Day', '-Date', |
135 | | | '-CurrentOperation', '-Culture', '-Credential', '-Count', '-Container', '-Confirm', |
136 | | | '-ComputerName', '-Component', '-Completed', '-ComObject', '-CommandType', '-Command', |
137 | | | '-Column', '-Class', '-ChildPath', '-Character', '-Certificate', '-CategoryTargetType', |
138 | | | '-CategoryTargetName', '-CategoryReason', '-CategoryActivity', '-Category', '-CaseSensitive', |
139 | | | '-Body', '-BinaryPathName', '-Begin', '-BackgroundColor', '-Average', '-AutoSize', '-Audit', |
140 | | | '-AsString', '-AsSecureString', '-AsPlainText', '-As', '-ArgumentList', '-AppendPath', '-Append', |
141 | | | '-Adjust', '-Activity', '-AclObject' |
142 | | | ) |
143 | | | ), |
144 | | | 'SYMBOLS' => array( |
145 | | | '(', ')', '[', ']', '{', '}', '=', '<', '>', '@', '|', '&', ',', '?', |
146 | | | '+=', '-=', '*=', '/=', '%=', '*', '/', '%', '!', '+', '-', '++', '--' |
147 | | | ), |
148 | | | 'CASE_SENSITIVE' => array( |
149 | | | GESHI_COMMENTS => false, |
150 | | | 1 => false, |
151 | | | 2 => false, |
152 | | | 3 => false, |
153 | | | 4 => false, |
154 | | | 5 => false |
155 | | | ), |
156 | | | 'STYLES' => array( |
157 | | | 'KEYWORDS' => array( |
158 | | | 1 => 'color: #008080; font-weight: bold;', |
159 | | | 2 => 'color: #008080; font-weight: bold;', |
160 | | | 3 => 'color: #0000FF;', |
161 | | | 4 => 'color: #FF0000;', |
162 | | | 5 => 'color: #008080; font-style: italic;', |
163 | | | ), |
164 | | | 'COMMENTS' => array( |
165 | | | 1 => 'color: #008000;', |
166 | | | 'MULTI' => 'color: #008000;' |
167 | | | ), |
168 | | | 'ESCAPE_CHAR' => array( |
169 | | | |
170 | | | ), |
171 | | | 'BRACKETS' => array( |
172 | | | |
173 | | | ), |
174 | | | 'STRINGS' => array( |
175 | | | |
176 | | | ), |
177 | | | 'NUMBERS' => array( |
178 | | | |
179 | | | ), |
180 | | | 'METHODS' => array( |
181 | | | |
182 | | | ), |
183 | | | 'SYMBOLS' => array( |
184 | | | |
185 | | | ), |
186 | | | 'REGEXPS' => array( |
187 | | | |
188 | | | 3 => 'color: #008080;', |
189 | | | 4 => 'color: #008080;', |
190 | | | 5 => 'color: #800000;', |
191 | | | 6 => 'color: #000080;' |
192 | | | ), |
193 | | | 'SCRIPT' => array( |
194 | | | ) |
195 | | | ), |
196 | | | 'URLS' => array( |
197 | | | 1 => '', |
198 | | | 2 => '', |
199 | | | 3 => '', |
200 | | | 4 => '', |
201 | | | 5 => '', |
202 | | | ), |
203 | | | 'OOLANG' => false, |
204 | | | 'OBJECT_SPLITTERS' => array( |
205 | | | ), |
206 | | | 'REGEXPS' => array( |
207 | | | // variables |
208 | | | |
209 | | | // special after pipe |
210 | | | 3 => array( |
211 | | | GESHI_SEARCH => '(\[)(int|long|string|char|bool|byte|double|decimal|float|single|regex|array|xml|scriptblock|switch|hashtable|type|ref|psobject|wmi|wmisearcher|wmiclass|object)((\[.*\])?\])', |
212 | | | GESHI_REPLACE => '\2', |
213 | | | GESHI_MODIFIERS => 'si', |
214 | | | GESHI_BEFORE => '\1', |
215 | | | GESHI_AFTER => '\3' |
216 | | | ), |
217 | | | // Classes |
218 | | | 4 => array( |
219 | | | GESHI_SEARCH => '(\[)(System\.Reflection\.Assembly|System\.Net\.CredentialCache|Microsoft\.SharePoint\.SPFileLevel|Microsoft\.SharePoint\.Publishing\.PublishingWeb|Microsoft\.SharePoint\.Publishing|Microsoft\.SharePoint\.SPWeb)(\])', |
220 | | | GESHI_REPLACE => '\2', |
221 | | | GESHI_MODIFIERS => 'i', |
222 | | | GESHI_BEFORE => '\1', |
223 | | | GESHI_AFTER => '\3' |
224 | | | ), |
225 | | | // Members |
226 | | | // There's about a hundred million of these, add the ones you need as you need them |
227 | | | 5 => array ( |
228 | | | GESHI_SEARCH => '(::)(ReflectionOnlyLoadFrom|ReflectionOnlyLoad|ReferenceEquals|LoadWithPartialName|LoadFrom|LoadFile|Load|GetExecutingAssembly|GetEntryAssembly|GetCallingAssembly|GetAssembly|Equals|DefaultNetworkCredentials|DefaultCredentials|CreateQualifiedName|Checkout|Draft|Published|IsPublishingWeb)', |
229 | | | GESHI_REPLACE => '\2', |
230 | | | GESHI_MODIFIERS => '', |
231 | | | GESHI_BEFORE => '\1', |
232 | | | GESHI_AFTER => '' |
233 | | | ), |
234 | | | // Special variables |
235 | | | 6 => array( |
236 | | | GESHI_SEARCH => '(\$)(\$|\?|\$\^|_|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)', |
237 | | | GESHI_REPLACE => '\1\2', |
238 | | | GESHI_MODIFIERS => '', |
239 | | | GESHI_BEFORE => '', |
240 | | | GESHI_AFTER => '\3' |
241 | | | ), |
242 | | | ), |
243 | | | 'STRICT_MODE_APPLIES' => GESHI_NEVER, |
244 | | | 'SCRIPT_DELIMITERS' => array( |
245 | | | ), |
246 | | | 'HIGHLIGHT_STRICT_BLOCK' => array( |
247 | | | ), |
248 | | | ); |
249 | | | |
250 | | | ?> |