diff --git a/lib/rouge/lexers/powershell.rb b/lib/rouge/lexers/powershell.rb index 21f916dc14..1f76892e9b 100644 --- a/lib/rouge/lexers/powershell.rb +++ b/lib/rouge/lexers/powershell.rb @@ -165,6 +165,7 @@ class Powershell < RegexLexer end state :parameters do + rule %r/`./m, Str::Escape rule %r/\s*?\n/, Text::Whitespace, :pop! rule %r/[;(){}\]]/, Punctuation, :pop! rule %r/[|=]/, Operator, :pop! diff --git a/spec/visual/samples/powershell b/spec/visual/samples/powershell index 9d490b6e01..d27f754479 100644 --- a/spec/visual/samples/powershell +++ b/spec/visual/samples/powershell @@ -95,7 +95,7 @@ process { } ########################### -# Control structures +# Control structures ########################### if ($var1 -eq $var2) @@ -114,15 +114,15 @@ Foreach ($Thing in $Things ) { } ########################### -# Classes +# Classes ########################### class Child : Parent, Relatives { [int] hidden $var = 8 - + Child ([string]$a, [string]$b, [int]$capacity) { $this.var = $a - } + } [string]toString() { return "A string" @@ -194,5 +194,8 @@ Write-Output "Updating: $($file.FullName)" # Without Error $gitUserName = "$($userAdObject.Properties['sn']), $($userAdObject.Properties['givenName'])" -# With Error +# Grave escaping $gitExeString = "$gitExeFolder\git.exe" &("$gitExeString") config --add --global user.name `"$gitUserName`" +Get-ChildItem -Include *.txt ` + -Recurse +Write-Output `$hello