Skip to content

Commit

Permalink
Add powershell builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
miparnisari committed Aug 1, 2018
1 parent 11aaec0 commit 9abf2cd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/rouge/lexers/powershell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class Powershell < Shell
Export-BCSecretKey Export-IscsiTargetServerConfiguration
Export-ODataEndpointProxy Export-RDPersonalSessionDesktopAssignment
Export-RDPersonalVirtualDesktopAssignment Export-ScheduledTask
Find-NetIPsecRule Find-NetRoute Format-Hex Format-Volume Get-AppBackgroundTask
Find-NetIPsecRule Find-NetRoute ForEach-Object Format-Hex Format-Volume Get-AppBackgroundTask
Get-AppvVirtualProcess Get-AppxLastError Get-AppxLog Get-AssignedAccess
Get-AutologgerConfig Get-BCClientConfiguration Get-BCContentServerConfiguration
Get-BCDataCache Get-BCDataCacheExtension Get-BCHashCache
Expand Down Expand Up @@ -231,11 +231,11 @@ class Powershell < Shell
New-StorageSubsystemVirtualDisk New-StorageTier New-TemporaryFile
New-VirtualDisk New-VirtualDiskClone New-VirtualDiskSnapshot New-Volume
New-VpnServerAddress Open-NetGPO Optimize-StoragePool Optimize-Volume
Publish-BCFileContent Publish-BCWebContent Publish-SilData Read-PrinterNfcTag
Parse-Path Publish-BCFileContent Publish-BCWebContent Publish-SilData Read-PrinterNfcTag
Register-ClusteredScheduledTask Register-DnsClient Register-IscsiSession
Register-ScheduledTask Register-StorageSubsystem Remove-AutologgerConfig
Remove-BCDataCacheExtension Remove-DAEntryPointTableItem
Remove-DnsClientNrptRule Remove-DscConfigurationDocument
Remove-DnsClientNrptRule Remove-Drive Remove-DscConfigurationDocument
Remove-DtcClusterTMMapping Remove-EtwTraceProvider Remove-EtwTraceSession
Remove-FileShare Remove-InitiatorId Remove-InitiatorIdFromMaskingSet
Remove-IscsiTargetPortal Remove-MaskingSet Remove-MpPreference Remove-MpThreat
Expand Down Expand Up @@ -446,10 +446,10 @@ class Powershell < Shell
Get-CertificateEnrollmentPolicyServer Get-CertificateNotificationTask
Get-ChildItem Get-CimAssociatedInstance Get-CimClass Get-CimInstance
Get-CimSession Get-CIPolicy Get-CIPolicyIdInfo Get-CIPolicyInfo Get-Clipboard
Get-CmsMessage Get-ComputerInfo Get-ComputerRestorePoint Get-Content
Get-CmsMessage Get-Command Get-ComputerInfo Get-ComputerRestorePoint Get-Content
Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-DAPolicyChange
Get-Date Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy
Get-FormatData Get-Host Get-HotFix Get-IISAppPool Get-IISCentralCertProvider
Get-FormatData Get-Help Get-Host Get-HotFix Get-IISAppPool Get-IISCentralCertProvider
Get-IISConfigAttributeValue Get-IISConfigCollection
Get-IISConfigCollectionElement Get-IISConfigElement Get-IISConfigSection
Get-IISServerManager Get-IISSharedConfig Get-IISSite Get-IscsiServerTarget
Expand Down Expand Up @@ -614,11 +614,11 @@ class Powershell < Shell
Unregister-Event Unregister-ScheduledJob Unregister-UevTemplate
Unregister-WindowsDeveloperLicense Update-FormatData Update-List
Update-TypeData Update-UevTemplate Update-WIMBootEntry Use-Transaction
Use-WindowsUnattend Wait-Debugger Wait-Event Wait-Process Write-Debug
Use-WindowsUnattend Wait-Debugger Wait-Event Wait-Process Where-Object Write-Debug
Write-Error Write-EventLog Write-Host Write-Information Write-Output
Write-Progress Write-Verbose Write-Warning \% \? ac asnp cat cd chdir clc clear
clhy cli clp cls clv cnsn compare copy cp cpi cpp curl cvpa dbp del diff dir
dnsn ebp echo epal epcsv epsn erase etsn exsn fc fl foreach ft fw gal gbp gc
dnsn ebp echo epal epcsv epsn erase etsn exsn fc fl ft fw gal gbp gc
gci gcm gcs gdr ghy gi gjb gl gm gmo gp gps gpv group gsn gsnp gsv gu gv gwmi h
history icm iex ihy ii ipal ipcsv ipmo ipsn irm ise iwmi iwr kill lp ls man md
measure mi mount move mp mv nal ndr ni nmo npssc nsn nv ogv oh popd ps pushd
Expand Down Expand Up @@ -668,10 +668,11 @@ class Powershell < Shell
rule /#.*$/, Comment::Single
rule /\b(#{OPERATORS})\s*\b/i, Operator
rule /\b(#{ATTRIBUTES})\s*\b/i, Name::Attribute
rule /\b(#{BUILTINS})\s*\b(?!\.)/i, Name::Builtin
rule /\b(#{KEYWORDS})\s*\b/i, Keyword
rule /\b(#{KEYWORDS_TYPE})\s*\b/i, Keyword::Type
rule /\bcase\b/, Keyword, :case
rule /\b(#{BUILTINS})\s*\b(?!\.)/i, Name::Builtin

end
end
end
Expand Down
12 changes: 12 additions & 0 deletions spec/visual/samples/powershell
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,15 @@ try {
} catch {
write-output "something else"
}

ForEach ($i in (1..1E4)) {

$i

} | Measure-Object

ForEach-Object -InputObject (1..1E4) {

$_

} | Measure-Object

0 comments on commit 9abf2cd

Please sign in to comment.