From 4d57caedaa53da50eb55e574762cb82502b5fc02 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 12 Sep 2010 02:04:21 +0200 Subject: switch to geshi for highlighting Signed-off-by: Florian Pritz --- system/application/libraries/geshi/powershell.php | 277 ++++++++++++++++++++++ 1 file changed, 277 insertions(+) create mode 100644 system/application/libraries/geshi/powershell.php (limited to 'system/application/libraries/geshi/powershell.php') diff --git a/system/application/libraries/geshi/powershell.php b/system/application/libraries/geshi/powershell.php new file mode 100644 index 000000000..fe8a5da07 --- /dev/null +++ b/system/application/libraries/geshi/powershell.php @@ -0,0 +1,277 @@ + 'PowerShell', + 'COMMENT_SINGLE' => array(1 => '#'), + 'COMMENT_MULTI' => array(), + 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, + 'QUOTEMARKS' => array("'", '"'), + 'ESCAPE_CHAR' => '`', + 'KEYWORDS' => array( + 1 => array( + // Cmdlets + 'Add-Content', 'Add-History', 'Add-Member', 'Add-PSSnapin', 'Clear-Content', 'Clear-Item', + 'Clear-ItemProperty', 'Clear-Variable', 'Compare-Object', 'ConvertFrom-SecureString', + 'Convert-Path', 'ConvertTo-Html', 'ConvertTo-SecureString', 'Copy-Item', 'Copy-ItemProperty', + 'Export-Alias', 'Export-Clixml', 'Export-Console', 'Export-Csv', 'ForEach-Object', + 'Format-Custom', 'Format-List', 'Format-Table', 'Format-Wide', 'Get-Acl', 'Get-Alias', + 'Get-AuthenticodeSignature', 'Get-ChildItem', 'Get-Command', 'Get-Content', 'Get-Credential', + 'Get-Culture', 'Get-Date', 'Get-EventLog', 'Get-ExecutionPolicy', 'Get-Help', 'Get-History', + 'Get-Host', 'Get-Item', 'Get-ItemProperty', 'Get-Location', 'Get-Member', + 'Get-PfxCertificate', 'Get-Process', 'Get-PSDrive', 'Get-PSProvider', 'Get-PSSnapin', + 'Get-Service', 'Get-TraceSource', 'Get-UICulture', 'Get-Unique', 'Get-Variable', + 'Get-WmiObject', 'Group-Object', 'Import-Alias', 'Import-Clixml', 'Import-Csv', + 'Invoke-Expression', 'Invoke-History', 'Invoke-Item', 'Join-Path', 'Measure-Command', + 'Measure-Object', 'Move-Item', 'Move-ItemProperty', 'New-Alias', 'New-Item', + 'New-ItemProperty', 'New-Object', 'New-PSDrive', 'New-Service', 'New-TimeSpan', + 'New-Variable', 'Out-Default', 'Out-File', 'Out-Host', 'Out-Null', 'Out-Printer', + 'Out-String', 'Pop-Location', 'Push-Location', 'Read-Host', 'Remove-Item', + 'Remove-ItemProperty', 'Remove-PSDrive', 'Remove-PSSnapin', 'Remove-Variable', 'Rename-Item', + 'Rename-ItemProperty', 'Resolve-Path', 'Restart-Service', 'Resume-Service', 'Select-Object', + 'Select-String', 'Set-Acl', 'Set-Alias', 'Set-AuthenticodeSignature', 'Set-Content', + 'Set-Date', 'Set-ExecutionPolicy', 'Set-Item', 'Set-ItemProperty', 'Set-Location', + 'Set-PSDebug', 'Set-Service', 'Set-TraceSource', 'Set-Variable', 'Sort-Object', 'Split-Path', + 'Start-Service', 'Start-Sleep', 'Start-Transcript', 'Stop-Process', 'Stop-Service', + 'Stop-Transcript', 'Suspend-Service', 'Tee-Object', 'Test-Path', 'Trace-Command', + 'Update-FormatData', 'Update-TypeData', 'Where-Object', 'Write-Debug', 'Write-Error', + 'Write-Host', 'Write-Output', 'Write-Progress', 'Write-Verbose', 'Write-Warning' + ), + 2 => array( + // Aliases + 'ac', 'asnp', 'clc', 'cli', 'clp', 'clv', 'cpi', 'cpp', 'cvpa', 'diff', 'epal', 'epcsv', 'fc', + 'fl', 'ft', 'fw', 'gal', 'gc', 'gci', 'gcm', 'gdr', 'ghy', 'gi', 'gl', 'gm', + 'gp', 'gps', 'group', 'gsv', 'gsnp', 'gu', 'gv', 'gwmi', 'iex', 'ihy', 'ii', 'ipal', 'ipcsv', + 'mi', 'mp', 'nal', 'ndr', 'ni', 'nv', 'oh', 'rdr', 'ri', 'rni', 'rnp', 'rp', 'rsnp', 'rv', + 'rvpa', 'sal', 'sasv', 'sc', 'select', 'si', 'sl', 'sleep', 'sort', 'sp', 'spps', 'spsv', 'sv', + 'tee', 'write', 'cat', 'cd', 'clear', 'cp', 'h', 'history', 'kill', 'lp', 'ls', + 'mount', 'mv', 'popd', 'ps', 'pushd', 'pwd', 'r', 'rm', 'rmdir', 'echo', 'cls', 'chdir', + 'copy', 'del', 'dir', 'erase', 'move', 'rd', 'ren', 'set', 'type' + ), + 3 => array( + // Reserved words + 'break', 'continue', 'do', 'for', 'foreach', 'while', 'if', 'switch', 'until', 'where', + 'function', 'filter', 'else', 'elseif', 'in', 'return', 'param', 'throw', 'trap' + ), + 4 => array( + // Operators + '-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', '-and', '-or', '-band', '-bor', + '-not', '-bnot', '-f', '-casesensitive', '-exact', '-file', '-regex', '-wildcard' + ), + 5 => array( + // Options + '-Year', '-Wrap', '-Word', '-Width', '-WhatIf', '-Wait', '-View', '-Verbose', '-Verb', + '-Variable', '-ValueOnly', '-Value', '-Unique', '-UFormat', '-TypeName', '-Trace', '-TotalCount', + '-Title', '-TimestampServer', '-TargetObject', '-Syntax', '-SyncWindow', '-Sum', '-String', + '-Strict', '-Stream', '-Step', '-Status', '-Static', '-StartupType', '-Start', '-StackName', + '-Stack', '-SourceId', '-SimpleMatch', '-ShowError', '-Separator', '-SecureString', '-SecureKey', + '-SecondValue', '-SecondsRemaining', '-Seconds', '-Second', '-Scope', '-Root', '-Role', + '-Resolve', '-RemoveListener', '-RemoveFileListener', '-Registered', '-ReferenceObject', + '-Recurse', '-RecommendedAction', '-ReadCount', '-Quiet', '-Query', '-Qualifier', '-PSSnapin', + '-PSProvider', '-PSHost', '-PSDrive', '-PropertyType', '-Property', '-Prompt', '-Process', + '-PrependPath', '-PercentComplete', '-Pattern', '-PathType', '-Path', '-PassThru', '-ParentId', + '-Parent', '-Parameter', '-Paging', '-OutVariable', '-OutBuffer', '-Option', '-OnType', '-Off', + '-Object', '-Noun', '-NoTypeInformation', '-NoQualifier', '-NoNewline', '-NoElement', + '-NoClobber', '-NewName', '-Newest', '-Namespace', '-Name', '-Month', '-Minutes', '-Minute', + '-Minimum', '-Milliseconds', '-Message', '-MemberType', '-Maximum', '-LogName', '-LiteralPath', + '-LiteralName', '-ListenerOption', '-List', '-Line', '-Leaf', '-Last', '-Key', '-ItemType', + '-IsValid', '-IsAbsolute', '-InputObject', '-IncludeEqual', '-IncludeChain', '-Include', + '-IgnoreWhiteSpace', '-Id', '-Hours', '-Hour', '-HideTableHeaders', '-Head', '-GroupBy', + '-Functionality', '-Full', '-Format', '-ForegroundColor', '-Force', '-First', '-FilterScript', + '-Filter', '-FilePath', '-Expression', '-ExpandProperty', '-Expand', '-ExecutionPolicy', + '-ExcludeProperty', '-ExcludeDifferent', '-Exclude', '-Exception', '-Examples', '-ErrorVariable', + '-ErrorRecord', '-ErrorId', '-ErrorAction', '-End', '-Encoding', '-DisplayName', '-DisplayHint', + '-DisplayError', '-DifferenceObject', '-Detailed', '-Destination', '-Description', '-Descending', + '-Depth', '-DependsOn', '-Delimiter', '-Debugger', '-Debug', '-Days', '-Day', '-Date', + '-CurrentOperation', '-Culture', '-Credential', '-Count', '-Container', '-Confirm', + '-ComputerName', '-Component', '-Completed', '-ComObject', '-CommandType', '-Command', + '-Column', '-Class', '-ChildPath', '-Character', '-Certificate', '-CategoryTargetType', + '-CategoryTargetName', '-CategoryReason', '-CategoryActivity', '-Category', '-CaseSensitive', + '-Body', '-BinaryPathName', '-Begin', '-BackgroundColor', '-Average', '-AutoSize', '-Audit', + '-AsString', '-AsSecureString', '-AsPlainText', '-As', '-ArgumentList', '-AppendPath', '-Append', + '-Adjust', '-Activity', '-AclObject' + ), + 6 => array( + '_','args','DebugPreference','Error','ErrorActionPreference', + 'foreach','Home','Host','Input','LASTEXITCODE','MaximumAliasCount', + 'MaximumDriveCount','MaximumFunctionCount','MaximumHistoryCount', + 'MaximumVariableCount','OFS','PsHome', + 'ReportErrorShowExceptionClass','ReportErrorShowInnerException', + 'ReportErrorShowSource','ReportErrorShowStackTrace', + 'ShouldProcessPreference','ShouldProcessReturnPreference', + 'StackTrace','VerbosePreference','WarningPreference','PWD' + ) + ), + 'SYMBOLS' => array( + '(', ')', '[', ']', '{', '}', '=', '<', '>', '@', '|', '&', ',', '?', + '+=', '-=', '*=', '/=', '%=', '*', '/', '%', '!', '+', '-', '++', '--' + ), + 'CASE_SENSITIVE' => array( + GESHI_COMMENTS => false, + 1 => false, + 2 => false, + 3 => false, + 4 => false, + 5 => false, + 6 => true + ), + 'STYLES' => array( + 'KEYWORDS' => array( + 1 => 'color: #008080; font-weight: bold;', + 2 => 'color: #008080; font-weight: bold;', + 3 => 'color: #0000FF;', + 4 => 'color: #FF0000;', + 5 => 'color: #008080; font-style: italic;', + 6 => 'color: #000080;' + ), + 'COMMENTS' => array( + 1 => 'color: #008000;', + 'MULTI' => 'color: #008000;' + ), + 'ESCAPE_CHAR' => array( + 0 => 'color: #008080; font-weight: bold;' + ), + 'BRACKETS' => array( + 0 => 'color: #000000;' + ), + 'STRINGS' => array( + 0 => 'color: #800000;' + ), + 'NUMBERS' => array( + 0 => 'color: #804000;' + ), + 'METHODS' => array( + 0 => 'color: pink;' + ), + 'SYMBOLS' => array( + 0 => 'color: pink;' + ), + 'REGEXPS' => array( + 0 => 'color: #800080;', + 3 => 'color: #008080;', + 4 => 'color: #008080;', + 5 => 'color: #800000;', + 6 => 'color: #000080;' + ), + 'SCRIPT' => array( + ) + ), + 'URLS' => array( + 1 => '', + 2 => '', + 3 => '', + 4 => '', + 5 => '', + 6 => 'about:blank', + ), + 'OOLANG' => false, + 'OBJECT_SPLITTERS' => array( + ), + 'REGEXPS' => array( + // special after pipe + 3 => array( + 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)((\[.*\])?\])', + GESHI_REPLACE => '\2', + GESHI_MODIFIERS => 'si', + GESHI_BEFORE => '\1', + GESHI_AFTER => '\3' + ), + // Classes + 4 => array( + GESHI_SEARCH => '(\[)(System\.Reflection\.Assembly|System\.Net\.CredentialCache|Microsoft\.SharePoint\.SPFileLevel|Microsoft\.SharePoint\.Publishing\.PublishingWeb|Microsoft\.SharePoint\.Publishing|Microsoft\.SharePoint\.SPWeb)(\])', + GESHI_REPLACE => '\2', + GESHI_MODIFIERS => 'i', + GESHI_BEFORE => '\1', + GESHI_AFTER => '\3' + ), + // Members + // There's about a hundred million of these, add the ones you need as you need them + 5 => array ( + GESHI_SEARCH => '(::)(ReflectionOnlyLoadFrom|ReflectionOnlyLoad|ReferenceEquals|LoadWithPartialName|LoadFrom|LoadFile|Load|GetExecutingAssembly|GetEntryAssembly|GetCallingAssembly|GetAssembly|Equals|DefaultNetworkCredentials|DefaultCredentials|CreateQualifiedName|Checkout|Draft|Published|IsPublishingWeb)', + GESHI_REPLACE => '\2', + GESHI_MODIFIERS => '', + GESHI_BEFORE => '\1', + GESHI_AFTER => '' + ), + // Special variables + 6 => array( + GESHI_SEARCH => '(\$)(\$[_\^]?|\?)(?!\w)', + GESHI_REPLACE => '\1\2', + GESHI_MODIFIERS => '', + GESHI_BEFORE => '', + GESHI_AFTER => '' + ), + // variables + //BenBE: Please note that changes here and in Keyword group 6 have to be synchronized in order to work properly. + //This Regexp must only match, if keyword group 6 doesn't. If this assumption fails + //Highlighting of the keywords will be incomplete or incorrect! + 0 => "(?)[\\\$](\w+)(?=[^|\w])", + ), + 'STRICT_MODE_APPLIES' => GESHI_NEVER, + 'SCRIPT_DELIMITERS' => array( + ), + 'HIGHLIGHT_STRICT_BLOCK' => array( + ), + 'PARSER_CONTROL' => array( + 'KEYWORDS' => array( + 4 => array( + 'DISALLOWED_AFTER' => '(?![a-zA-Z])', + 'DISALLOWED_BEFORE' => '' + ), + 6 => array( + 'DISALLOWED_BEFORE' => '(?)\$' + ) + ) + ) +); + +?> \ No newline at end of file -- cgit v1.2.3-24-g4f1b