plugins/geshi/geshi/powershell.php
changeset 3 f3e2bbbd2155
parent 2 9e3258dfae15
--- a/plugins/geshi/geshi/powershell.php	Fri May 29 19:30:59 2009 -0400
+++ b/plugins/geshi/geshi/powershell.php	Fri May 29 19:40:15 2009 -0400
@@ -4,7 +4,7 @@
  * ---------------------------------
  * Author: Frode Aarebrot (frode@aarebrot.net)
  * Copyright: (c) 2008 Frode Aarebrot (http://www.aarebrot.net)
- * Release Version: 1.0.8.2
+ * Release Version: 1.0.8.4
  * Date Started: 2008/06/20
  *
  * PowerShell language file for GeSHi.
@@ -47,7 +47,7 @@
  ************************************************************************************/
 
 $language_data = array (
-    'LANG_NAME' => 'posh',
+    'LANG_NAME' => 'PowerShell',
     'COMMENT_SINGLE' => array(1 => '#'),
     'COMMENT_MULTI' => array(),
     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
@@ -139,6 +139,16 @@
             '-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(
@@ -151,7 +161,8 @@
         2 => false,
         3 => false,
         4 => false,
-        5 => false
+        5 => false,
+        6 => true
         ),
     'STYLES' => array(
         'KEYWORDS' => array(
@@ -160,6 +171,7 @@
             3 => 'color: #0000FF;',
             4 => 'color: #FF0000;',
             5 => 'color: #008080; font-style: italic;',
+            6 => 'color: #000080;'
             ),
         'COMMENTS' => array(
             1 => 'color: #008000;',
@@ -175,7 +187,7 @@
             0 => 'color: #800000;'
             ),
         'NUMBERS' => array(
-            0 => 'color: #000000;'
+            0 => 'color: #804000;'
             ),
         'METHODS' => array(
             0 => 'color: pink;'
@@ -199,13 +211,12 @@
         3 => '',
         4 => '',
         5 => '',
+        6 => 'about:blank',
         ),
     'OOLANG' => false,
     'OBJECT_SPLITTERS' => array(
         ),
     'REGEXPS' => array(
-        // variables
-        0 => "[\\$][a-zA-Z0-9_]*",
         // 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)((\[.*\])?\])',
@@ -233,18 +244,34 @@
             ),
         // Special variables
         6 => array(
-            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)',
+            GESHI_SEARCH => '(\$)(\$[_\^]?|\?)(?!\w)',
             GESHI_REPLACE => '\1\2',
             GESHI_MODIFIERS => '',
             GESHI_BEFORE => '',
-            GESHI_AFTER => '\3'
+            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