diff options
-rw-r--r-- | pygments/lexers/shell.py | 2 | ||||
-rw-r--r-- | tests/snippets/powershell/test_colon_punctuation.txt | 35 | ||||
-rw-r--r-- | tests/snippets/powershell/test_remoting_session.txt | 4 | ||||
-rw-r--r-- | tests/snippets/powershell/test_session.txt | 2 |
4 files changed, 39 insertions, 4 deletions
diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py index 6283a11a..83529d17 100644 --- a/pygments/lexers/shell.py +++ b/pygments/lexers/shell.py @@ -730,7 +730,7 @@ class PowerShellLexer(RegexLexer): (r'\[[a-z_\[][\w. `,\[\]]*\]', Name.Constant), # .net [type]s (r'-[a-z_]\w*', Name), (r'\w+', Name), - (r'[.,;@{}\[\]$()=+*/\\&%!~?^`|<>-]|::', Punctuation), + (r'[.,;:@{}\[\]$()=+*/\\&%!~?^`|<>-]', Punctuation), ], 'child': [ (r'\)', Punctuation, '#pop'), diff --git a/tests/snippets/powershell/test_colon_punctuation.txt b/tests/snippets/powershell/test_colon_punctuation.txt new file mode 100644 index 00000000..72733c3a --- /dev/null +++ b/tests/snippets/powershell/test_colon_punctuation.txt @@ -0,0 +1,35 @@ +---input--- +$message = (Test-Path C:\) ? "Path exists" : "Path not found" +[math]::pi + +---tokens--- +'$message' Name.Variable +' ' Text +'=' Punctuation +' ' Text +'(' Punctuation +'Test-Path' Name.Builtin +' ' Text +'C' Name +':' Punctuation +'\\' Punctuation +')' Punctuation +' ' Text +'?' Punctuation +' ' Text +'"' Literal.String.Double +'Path exists' Literal.String.Double +'"' Literal.String.Double +' ' Text +':' Punctuation +' ' Text +'"' Literal.String.Double +'Path not found' Literal.String.Double +'"' Literal.String.Double +'\n' Text + +'[math]' Name.Constant +':' Punctuation +':' Punctuation +'pi' Name +'\n' Text diff --git a/tests/snippets/powershell/test_remoting_session.txt b/tests/snippets/powershell/test_remoting_session.txt index 9d9db603..23fa9c2e 100644 --- a/tests/snippets/powershell/test_remoting_session.txt +++ b/tests/snippets/powershell/test_remoting_session.txt @@ -7,11 +7,11 @@ '-NetBIOS' Name '-Hostname' Name ']' Punctuation -':' Error +':' Punctuation ' ' Text 'PS ' Name.Builtin 'C' Name -':' Error +':' Punctuation '\\' Punctuation '>' Punctuation ' ' Text diff --git a/tests/snippets/powershell/test_session.txt b/tests/snippets/powershell/test_session.txt index 38212440..7fe8b42a 100644 --- a/tests/snippets/powershell/test_session.txt +++ b/tests/snippets/powershell/test_session.txt @@ -8,7 +8,7 @@ PS > Get-ChildItem ---tokens--- 'PS ' Name.Builtin 'C' Name -':' Error +':' Punctuation '\\' Punctuation '>' Punctuation ' ' Text |