Closed
Description
Name of the lexer
powershell
Code sample
Select-Object -Property `
Id,
@{
Name = 'Test'
Expression = {
# To avoid errors (as we check for them later in the script), only
# parse the string if it's a non-empty.
if (![String]::IsNullOrEmpty($_.Expires)) {
[DateTime]::ParseExact($_.Expires, $dateFormat, $null)
}
}
}
Sample on rouge.jneen.net.
Additional context
Newlines between curly braces confuse the lexer, so its contents will not be recognized properly (e.g. the comment in the sample above is not highlighted as comment).