plugins/geshi/geshi/powershell.php
changeset 3 f3e2bbbd2155
parent 2 9e3258dfae15
equal deleted inserted replaced
2:9e3258dfae15 3:f3e2bbbd2155
     2 /*************************************************************************************
     2 /*************************************************************************************
     3  * powershell.php
     3  * powershell.php
     4  * ---------------------------------
     4  * ---------------------------------
     5  * Author: Frode Aarebrot (frode@aarebrot.net)
     5  * Author: Frode Aarebrot (frode@aarebrot.net)
     6  * Copyright: (c) 2008 Frode Aarebrot (http://www.aarebrot.net)
     6  * Copyright: (c) 2008 Frode Aarebrot (http://www.aarebrot.net)
     7  * Release Version: 1.0.8.2
     7  * Release Version: 1.0.8.4
     8  * Date Started: 2008/06/20
     8  * Date Started: 2008/06/20
     9  *
     9  *
    10  * PowerShell language file for GeSHi.
    10  * PowerShell language file for GeSHi.
    11  *
    11  *
    12  * I've tried to make this language file as true to the highlighting in PowerGUI as
    12  * I've tried to make this language file as true to the highlighting in PowerGUI as
    45  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    45  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    46  *
    46  *
    47  ************************************************************************************/
    47  ************************************************************************************/
    48 
    48 
    49 $language_data = array (
    49 $language_data = array (
    50     'LANG_NAME' => 'posh',
    50     'LANG_NAME' => 'PowerShell',
    51     'COMMENT_SINGLE' => array(1 => '#'),
    51     'COMMENT_SINGLE' => array(1 => '#'),
    52     'COMMENT_MULTI' => array(),
    52     'COMMENT_MULTI' => array(),
    53     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    53     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
    54     'QUOTEMARKS' => array("'", '"'),
    54     'QUOTEMARKS' => array("'", '"'),
    55     'ESCAPE_CHAR' => '`',
    55     'ESCAPE_CHAR' => '`',
   137             '-Column', '-Class', '-ChildPath', '-Character', '-Certificate', '-CategoryTargetType',
   137             '-Column', '-Class', '-ChildPath', '-Character', '-Certificate', '-CategoryTargetType',
   138             '-CategoryTargetName', '-CategoryReason', '-CategoryActivity', '-Category', '-CaseSensitive',
   138             '-CategoryTargetName', '-CategoryReason', '-CategoryActivity', '-Category', '-CaseSensitive',
   139             '-Body', '-BinaryPathName', '-Begin', '-BackgroundColor', '-Average', '-AutoSize', '-Audit',
   139             '-Body', '-BinaryPathName', '-Begin', '-BackgroundColor', '-Average', '-AutoSize', '-Audit',
   140             '-AsString', '-AsSecureString', '-AsPlainText', '-As', '-ArgumentList', '-AppendPath', '-Append',
   140             '-AsString', '-AsSecureString', '-AsPlainText', '-As', '-ArgumentList', '-AppendPath', '-Append',
   141             '-Adjust', '-Activity', '-AclObject'
   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'
   142             )
   152             )
   143         ),
   153         ),
   144     'SYMBOLS' => array(
   154     'SYMBOLS' => array(
   145         '(', ')', '[', ']', '{', '}', '=', '<', '>', '@', '|', '&', ',', '?',
   155         '(', ')', '[', ']', '{', '}', '=', '<', '>', '@', '|', '&', ',', '?',
   146         '+=', '-=', '*=', '/=', '%=', '*', '/', '%', '!', '+', '-', '++', '--'
   156         '+=', '-=', '*=', '/=', '%=', '*', '/', '%', '!', '+', '-', '++', '--'
   149         GESHI_COMMENTS => false,
   159         GESHI_COMMENTS => false,
   150         1 => false,
   160         1 => false,
   151         2 => false,
   161         2 => false,
   152         3 => false,
   162         3 => false,
   153         4 => false,
   163         4 => false,
   154         5 => false
   164         5 => false,
       
   165         6 => true
   155         ),
   166         ),
   156     'STYLES' => array(
   167     'STYLES' => array(
   157         'KEYWORDS' => array(
   168         'KEYWORDS' => array(
   158             1 => 'color: #008080; font-weight: bold;',
   169             1 => 'color: #008080; font-weight: bold;',
   159             2 => 'color: #008080; font-weight: bold;',
   170             2 => 'color: #008080; font-weight: bold;',
   160             3 => 'color: #0000FF;',
   171             3 => 'color: #0000FF;',
   161             4 => 'color: #FF0000;',
   172             4 => 'color: #FF0000;',
   162             5 => 'color: #008080; font-style: italic;',
   173             5 => 'color: #008080; font-style: italic;',
       
   174             6 => 'color: #000080;'
   163             ),
   175             ),
   164         'COMMENTS' => array(
   176         'COMMENTS' => array(
   165             1 => 'color: #008000;',
   177             1 => 'color: #008000;',
   166             'MULTI' => 'color: #008000;'
   178             'MULTI' => 'color: #008000;'
   167             ),
   179             ),
   173             ),
   185             ),
   174         'STRINGS' => array(
   186         'STRINGS' => array(
   175             0 => 'color: #800000;'
   187             0 => 'color: #800000;'
   176             ),
   188             ),
   177         'NUMBERS' => array(
   189         'NUMBERS' => array(
   178             0 => 'color: #000000;'
   190             0 => 'color: #804000;'
   179             ),
   191             ),
   180         'METHODS' => array(
   192         'METHODS' => array(
   181             0 => 'color: pink;'
   193             0 => 'color: pink;'
   182             ),
   194             ),
   183         'SYMBOLS' => array(
   195         'SYMBOLS' => array(
   197         1 => '',
   209         1 => '',
   198         2 => '',
   210         2 => '',
   199         3 => '',
   211         3 => '',
   200         4 => '',
   212         4 => '',
   201         5 => '',
   213         5 => '',
       
   214         6 => 'about:blank',
   202         ),
   215         ),
   203     'OOLANG' => false,
   216     'OOLANG' => false,
   204     'OBJECT_SPLITTERS' => array(
   217     'OBJECT_SPLITTERS' => array(
   205         ),
   218         ),
   206     'REGEXPS' => array(
   219     'REGEXPS' => array(
   207         // variables
       
   208         0 => "[\\$][a-zA-Z0-9_]*",
       
   209         // special after pipe
   220         // special after pipe
   210         3 => array(
   221         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)((\[.*\])?\])',
   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)((\[.*\])?\])',
   212             GESHI_REPLACE => '\2',
   223             GESHI_REPLACE => '\2',
   213             GESHI_MODIFIERS => 'si',
   224             GESHI_MODIFIERS => 'si',
   231             GESHI_BEFORE => '\1',
   242             GESHI_BEFORE => '\1',
   232             GESHI_AFTER => ''
   243             GESHI_AFTER => ''
   233             ),
   244             ),
   234         // Special variables
   245         // Special variables
   235         6 => array(
   246         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)',
   247             GESHI_SEARCH => '(\$)(\$[_\^]?|\?)(?!\w)',
   237             GESHI_REPLACE => '\1\2',
   248             GESHI_REPLACE => '\1\2',
   238             GESHI_MODIFIERS => '',
   249             GESHI_MODIFIERS => '',
   239             GESHI_BEFORE => '',
   250             GESHI_BEFORE => '',
   240             GESHI_AFTER => '\3'
   251             GESHI_AFTER => ''
   241             ),
   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])",
   242         ),
   258         ),
   243     'STRICT_MODE_APPLIES' => GESHI_NEVER,
   259     'STRICT_MODE_APPLIES' => GESHI_NEVER,
   244     'SCRIPT_DELIMITERS' => array(
   260     'SCRIPT_DELIMITERS' => array(
   245         ),
   261         ),
   246     'HIGHLIGHT_STRICT_BLOCK' => array(
   262     'HIGHLIGHT_STRICT_BLOCK' => array(
   247         ),
   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         )
   248 );
   275 );
   249 
   276 
   250 ?>
   277 ?>