[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/geshi/geshi/src/geshi/ -> powershell.php (source)

   1  <?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.9.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' => 'PowerShell',
  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          6 => array(
 144              '_','args','DebugPreference','Error','ErrorActionPreference',
 145              'foreach','Home','Host','Input','LASTEXITCODE','MaximumAliasCount',
 146              'MaximumDriveCount','MaximumFunctionCount','MaximumHistoryCount',
 147              'MaximumVariableCount','OFS','PsHome',
 148              'ReportErrorShowExceptionClass','ReportErrorShowInnerException',
 149              'ReportErrorShowSource','ReportErrorShowStackTrace',
 150              'ShouldProcessPreference','ShouldProcessReturnPreference',
 151              'StackTrace','VerbosePreference','WarningPreference','PWD'
 152              )
 153          ),
 154      'SYMBOLS' => array(
 155          '(', ')', '[', ']', '{', '}', '=', '<', '>', '@', '|', '&', ',', '?',
 156          '+=', '-=', '*=', '/=', '%=', '*', '/', '%', '!', '+', '-', '++', '--'
 157          ),
 158      'CASE_SENSITIVE' => array(
 159          GESHI_COMMENTS => false,
 160          1 => false,
 161          2 => false,
 162          3 => false,
 163          4 => false,
 164          5 => false,
 165          6 => true
 166          ),
 167      'STYLES' => array(
 168          'KEYWORDS' => array(
 169              1 => 'color: #008080; font-weight: bold;',
 170              2 => 'color: #008080; font-weight: bold;',
 171              3 => 'color: #0000FF;',
 172              4 => 'color: #FF0000;',
 173              5 => 'color: #008080; font-style: italic;',
 174              6 => 'color: #000080;'
 175              ),
 176          'COMMENTS' => array(
 177              1 => 'color: #008000;',
 178              'MULTI' => 'color: #008000;'
 179              ),
 180          'ESCAPE_CHAR' => array(
 181              0 => 'color: #008080; font-weight: bold;'
 182              ),
 183          'BRACKETS' => array(
 184              0 => 'color: #000000;'
 185              ),
 186          'STRINGS' => array(
 187              0 => 'color: #800000;'
 188              ),
 189          'NUMBERS' => array(
 190              0 => 'color: #804000;'
 191              ),
 192          'METHODS' => array(
 193              0 => 'color: pink;'
 194              ),
 195          'SYMBOLS' => array(
 196              0 => 'color: pink;'
 197              ),
 198          'REGEXPS' => array(
 199              0 => 'color: #800080;',
 200              3 => 'color: #008080;',
 201              4 => 'color: #008080;',
 202              5 => 'color: #800000;',
 203              6 => 'color: #000080;'
 204              ),
 205          'SCRIPT' => array(
 206              )
 207          ),
 208      'URLS' => array(
 209          1 => '',
 210          2 => '',
 211          3 => '',
 212          4 => '',
 213          5 => '',
 214          6 => 'about:blank',
 215          ),
 216      'OOLANG' => false,
 217      'OBJECT_SPLITTERS' => array(
 218          ),
 219      'REGEXPS' => array(
 220          // special after pipe
 221          3 => array(
 222              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)((\[.*\])?\])',
 223              GESHI_REPLACE => '\2',
 224              GESHI_MODIFIERS => 'si',
 225              GESHI_BEFORE => '\1',
 226              GESHI_AFTER => '\3'
 227              ),
 228          // Classes
 229          4 => array(
 230              GESHI_SEARCH => '(\[)(System\.Reflection\.Assembly|System\.Net\.CredentialCache|Microsoft\.SharePoint\.SPFileLevel|Microsoft\.SharePoint\.Publishing\.PublishingWeb|Microsoft\.SharePoint\.Publishing|Microsoft\.SharePoint\.SPWeb)(\])',
 231              GESHI_REPLACE => '\2',
 232              GESHI_MODIFIERS => 'i',
 233              GESHI_BEFORE => '\1',
 234              GESHI_AFTER => '\3'
 235              ),
 236          // Members
 237          // There's about a hundred million of these, add the ones you need as you need them
 238          5 => array (
 239              GESHI_SEARCH => '(::)(ReflectionOnlyLoadFrom|ReflectionOnlyLoad|ReferenceEquals|LoadWithPartialName|LoadFrom|LoadFile|Load|GetExecutingAssembly|GetEntryAssembly|GetCallingAssembly|GetAssembly|Equals|DefaultNetworkCredentials|DefaultCredentials|CreateQualifiedName|Checkout|Draft|Published|IsPublishingWeb)',
 240              GESHI_REPLACE => '\2',
 241              GESHI_MODIFIERS => '',
 242              GESHI_BEFORE => '\1',
 243              GESHI_AFTER => ''
 244              ),
 245          // Special variables
 246          6 => array(
 247              GESHI_SEARCH => '(\$)(\$[_\^]?|\?)(?!\w)',
 248              GESHI_REPLACE => '\1\2',
 249              GESHI_MODIFIERS => '',
 250              GESHI_BEFORE => '',
 251              GESHI_AFTER => ''
 252              ),
 253          // variables
 254          //BenBE: Please note that changes here and in Keyword group 6 have to be synchronized in order to work properly.
 255          //This Regexp must only match, if keyword group 6 doesn't. If this assumption fails
 256          //Highlighting of the keywords will be incomplete or incorrect!
 257          0 => "(?<!\\\$|>)[\\\$](\w+)(?=[^|\w])",
 258          ),
 259      'STRICT_MODE_APPLIES' => GESHI_NEVER,
 260      'SCRIPT_DELIMITERS' => array(
 261          ),
 262      'HIGHLIGHT_STRICT_BLOCK' => array(
 263          ),
 264      'PARSER_CONTROL' => array(
 265          'KEYWORDS' => array(
 266              4 => array(
 267                  'DISALLOWED_AFTER' => '(?![a-zA-Z])',
 268                  'DISALLOWED_BEFORE' => ''
 269                  ),
 270              6 => array(
 271                  'DISALLOWED_BEFORE' => '(?<!\$>)\$'
 272                  )
 273              )
 274          )
 275  );