diff --git a/demo/docs/powershell.ps1 b/demo/docs/powershell.ps1 index cbcbb20f..d3eb9875 100644 --- a/demo/docs/powershell.ps1 +++ b/demo/docs/powershell.ps1 @@ -3,6 +3,16 @@ function Hello($name) { Write-host "Hello $name" } +function add($left, $right=4) { + if ($right -ne 4) { + return $left + } elseif ($left -eq $right) { + return 3 + } else { + return 2 + } +} + $number = 1 + 2; $number += 3 @@ -12,4 +22,3 @@ $an_array = @(1, 2, 3) $a_hash = @{"something" = "something else"} & notepad .\readme.md - diff --git a/lib/ace/mode/powershell_highlight_rules.js b/lib/ace/mode/powershell_highlight_rules.js index 7681044d..536b49c4 100644 --- a/lib/ace/mode/powershell_highlight_rules.js +++ b/lib/ace/mode/powershell_highlight_rules.js @@ -52,7 +52,7 @@ var PowershellHighlightRules = function() { regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", - regex : "eq|ne|ge|gt|lt|le|like|notlike|match|notmatch|replace" + regex : "\\-(?:" + "eq|ne|ge|gt|lt|le|like|notlike|match|notmatch|replace" + ")" }, { token : "lparen", regex : "[[({]"